pub struct ConnectionOptions {
pub host: String,
pub port: i64,
pub tls: bool,
pub allow_insecure_tls: bool,
pub pat_token: Option<String>,
}Expand description
Explicit connection configuration. Connection settings used to build the websocket request.
§Example
use lirays::ConnectionOptions;
let opts = ConnectionOptions::new("127.0.0.1", 8245, false, None);
assert_eq!(opts.ws_url().unwrap(), "ws://127.0.0.1:8245/ws");Fields§
§host: StringServer hostname or IP address.
port: i64Server TCP port.
tls: boolEnables wss:// when true, otherwise uses ws://.
allow_insecure_tls: boolSkips certificate validation when true.
This is intended only for local development with self-signed certs.
pat_token: Option<String>Optional PAT token sent as Authorization: Bearer <token>.
Implementations§
Source§impl ConnectionOptions
impl ConnectionOptions
Sourcepub fn new(
host: impl Into<String>,
port: i64,
tls: bool,
pat_token: Option<String>,
) -> Self
pub fn new( host: impl Into<String>, port: i64, tls: bool, pat_token: Option<String>, ) -> Self
Creates a new set of connection options.
Sourcepub fn with_insecure_tls(self, allow_insecure_tls: bool) -> Self
pub fn with_insecure_tls(self, allow_insecure_tls: bool) -> Self
Enables or disables insecure TLS certificate verification bypass.
Sourcepub fn ws_url(&self) -> Result<String, ClientError>
pub fn ws_url(&self) -> Result<String, ClientError>
Returns the final websocket URL in the form ws(s)://host:port/ws.
Trait Implementations§
Source§impl Clone for ConnectionOptions
impl Clone for ConnectionOptions
Source§fn clone(&self) -> ConnectionOptions
fn clone(&self) -> ConnectionOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConnectionOptions
impl RefUnwindSafe for ConnectionOptions
impl Send for ConnectionOptions
impl Sync for ConnectionOptions
impl Unpin for ConnectionOptions
impl UnsafeUnpin for ConnectionOptions
impl UnwindSafe for ConnectionOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more