[][src]Struct conec::ClientConfig

pub struct ClientConfig { /* fields omitted */ }

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]

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]

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]

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]

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]

impl Debug for ClientConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,