[−][src]Struct conec::ClientConfig
Client configuration struct
See library documentation for usage example.
Implementations
impl ClientConfig
[src]
pub fn new(id: String, coord: String) -> Self
[src]
Construct new ClientConfig
id
is the Client's name, which will be used to identify it to other clients.coord
is the hostname of the coordinator. The coordinator's TLS certificate must match this name.
By default, Client will attempt to resolve the hostname coord
and connect
on the default port. Use set_port to change the port number, or use
set_addr to specify a SocketAddr rather than
relying on name resolution.
In all cases, the Client will ensure that the Coordinator's TLS certificate
matches the hostname specified as coord
.
pub fn set_port(&mut self, port: u16) -> &mut Self
[src]
Set the Coordinator's port number to port
pub fn set_addr(&mut self, addr: SocketAddr) -> &mut Self
[src]
Set the Coordinator's address to addr
, disabling name resolution
Note that Client will still ensure that Coordinator's TLS certificate matches the name specified to ClientConfig::new.
pub fn enable_keylog(&mut self) -> &mut Self
[src]
Enable logging key material to the file specified by the environment variable SSLKEYLOGFILE
.
pub fn set_ca(&mut self, ca: Certificate) -> &mut Self
[src]
Add a trusted certificate authority
This certificate authority is used to validate the Coordinator's certificate.
pub fn set_ca_from_file(
&mut self,
cert_path: &Path
) -> Result<&mut Self, CertReadError>
[src]
&mut self,
cert_path: &Path
) -> Result<&mut Self, CertReadError>
Add a trusted certificate authority from a file
This is a convenience wrapper around ClientConfig::set_ca. Both PEM and DER formats are supported.
pub fn set_client_ca(&mut self, ca: Certificate) -> &mut Self
[src]
Add a trusted certificate authority for checking Client certs
If no trusted CA is provided, self-signed Client certificates are required.
pub fn set_client_ca_from_file(
&mut self,
cert_path: &Path
) -> Result<&mut Self, CertReadError>
[src]
&mut self,
cert_path: &Path
) -> Result<&mut Self, CertReadError>
Add a trusted certificate authority for checking Client certs from a file
This is a convenience wrapper around ClientConfig::set_client_ca. Both PEM and DER formats are supported.
pub fn set_srcaddr(&mut self, src: SocketAddr) -> &mut Self
[src]
Set the Client's source address explicitly
By default, the source address is set to 0.0.0.0:0
. To bind to a host-assigned
IPv6 port instead, one might call
client_cfg.set_srcaddr(SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), 0));
pub fn enable_stateless_retry(&mut self) -> &mut Self
[src]
Enable QUIC stateless retry.
Per QUIC spec, stateless retry defends against client address spoofing. The downside is that this adds another round-trip to new connections.
pub fn disable_listen(&mut self) -> &mut Self
[src]
Disable Client listening for incoming direct connections
This means that all streams must be proxed through Coordinator
pub fn disable_keepalive(&mut self) -> &mut Self
[src]
Disable Client keepalive messages
By default, Clients send a short keepalive message every 5 seconds. This setting disables that.
Note that when keepalive is disabled, the underlying transport will close idle connections after 10 seconds.
pub fn disable_holepunch(&mut self) -> &mut Self
[src]
Disable holepunching
By default, Clients that are listening for incoming channels will attempt to set up a UDP Holepunch when alerted by the Coordinator that a new channel is incoming. This setting disables that.
pub fn set_cert(
&mut self,
cert: CertificateChain,
key: PrivateKey,
key_der: Vec<u8>
) -> &mut Self
[src]
&mut self,
cert: CertificateChain,
key: PrivateKey,
key_der: Vec<u8>
) -> &mut Self
Set a certificate and key for Client
This certificate is used to authenticate to the Coordinator and when accepting direct connections from other clients.
To be usable, a certificate must meet two criteria:
-
It must be valid for the Client
id
provided to ClientConfig::new, otherwise the coordinator will reject the connection. -
If the Coordinator is configured to accept self-signed certificates (which is the default), this certificate must be self-signed. Otherwise, if the coordinator is configured to accept certificates signed by a particular CA (via CoordConfig::set_client_ca), this certificate must be signed by that CA.
pub fn set_cert_from_file(
&mut self,
cert_path: &Path,
key_path: &Path
) -> Result<&mut Self, CertReadError>
[src]
&mut self,
cert_path: &Path,
key_path: &Path
) -> Result<&mut Self, CertReadError>
Set a certificate and key for Client from file
This is a convenience wrapper around ClientConfig::set_cert. Both PEM and DER formats are supported.
Trait Implementations
impl Clone for ClientConfig
[src]
fn clone(&self) -> ClientConfig
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ClientConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnwindSafe for ClientConfig
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,