pub struct Builder { /* private fields */ }
Implementations§
source§impl Builder
impl Builder
pub fn with_handle(self, handle: Handle) -> Builder
sourcepub fn with_receive_address(self, addr: SocketAddr) -> Result<Builder, Error>
pub fn with_receive_address(self, addr: SocketAddr) -> Result<Builder, Error>
Sets the local address for the runtime to listen on. If no send address or tx socket is specified, this address will also be used for transmitting from.
NOTE: this method is mutually exclusive with with_rx_socket
sourcepub fn with_send_address(self, addr: SocketAddr) -> Result<Builder, Error>
pub fn with_send_address(self, addr: SocketAddr) -> Result<Builder, Error>
Sets the local address for the runtime to transmit from. If no send address or tx socket is specified, the receive_address will be used for transmitting.
NOTE: this method is mutually exclusive with with_tx_socket
sourcepub fn with_rx_socket(self, socket: UdpSocket) -> Result<Builder, Error>
pub fn with_rx_socket(self, socket: UdpSocket) -> Result<Builder, Error>
Sets the socket used for receiving for the runtime. If no tx_socket or send address is specified, this socket will be used for transmitting.
NOTE: this method is mutually exclusive with with_receive_address
sourcepub fn with_tx_socket(self, socket: UdpSocket) -> Result<Builder, Error>
pub fn with_tx_socket(self, socket: UdpSocket) -> Result<Builder, Error>
Sets the socket used for transmitting on for the runtime. If no tx_socket or send address is specified, the rx_socket will be used for transmitting.
NOTE: this method is mutually exclusive with with_send_address
sourcepub fn with_send_buffer_size(
self,
send_buffer_size: usize
) -> Result<Builder, Error>
pub fn with_send_buffer_size( self, send_buffer_size: usize ) -> Result<Builder, Error>
Sets the size of the operating system’s send buffer associated with the tx socket
sourcepub fn with_recv_buffer_size(
self,
recv_buffer_size: usize
) -> Result<Builder, Error>
pub fn with_recv_buffer_size( self, recv_buffer_size: usize ) -> Result<Builder, Error>
Sets the size of the operating system’s receive buffer associated with the rx socket
sourcepub fn with_internal_send_buffer_size(
self,
send_buffer_size: usize
) -> Result<Builder, Error>
pub fn with_internal_send_buffer_size( self, send_buffer_size: usize ) -> Result<Builder, Error>
Sets the size of the send buffer associated with the transmit side (internal to s2n-quic)
sourcepub fn with_internal_recv_buffer_size(
self,
recv_buffer_size: usize
) -> Result<Builder, Error>
pub fn with_internal_recv_buffer_size( self, recv_buffer_size: usize ) -> Result<Builder, Error>
Sets the size of the send buffer associated with the receive side (internal to s2n-quic)
sourcepub fn with_max_mtu(self, max_mtu: u16) -> Result<Builder, Error>
pub fn with_max_mtu(self, max_mtu: u16) -> Result<Builder, Error>
Sets the largest maximum transmission unit (MTU) that can be sent on a path (default: 1500)
MTU is the size of the largest IP packet that can be transmitted on a path. This includes the size of the IP header, the size of the UDP header, and the size of the UDP payload containing the QUIC packet(s).
Most networks can support the Ethernet II framing MTU of 1500 bytes. If your network supports
Ethernet jumbo frames, you can set max_mtu
to a higher value (~9000). This will enable
s2n-quic to send probe packets at larger sizes to validate the MTU the network can support, giving a
significant throughput improvement if a large MTU is confirmed.
Note: max_mtu
must be >= initial_mtu
and base_mtu
sourcepub fn with_initial_mtu(self, initial_mtu: u16) -> Result<Builder, Error>
pub fn with_initial_mtu(self, initial_mtu: u16) -> Result<Builder, Error>
Sets the maximum transmission unit (MTU) to use when initiating a connection (default: 1228)
MTU is the size of the largest IP packet that can be transmitted on a path. This includes the size of the IP header, the size of the UDP header, and the size of the UDP payload containing the QUIC packet(s).
By default, s2n-quic will complete the QUIC handshake using packets limited to the base_mtu
(default: 1228). Following the handshake, s2n-quic will send probe packets at larger sizes
to validate the MTU the network can support, up to the max_mtu
(default: 1500).
If you have high confidence your network can support an MTU larger than the default
initial_mtu
, you can set this to a higher value and immediately start using a larger MTU
before the handshake completes. Any packet loss during the handshake suspected of being
caused by this initial_mtu
setting will cause the MTU to drop back to the base_mtu
to
allow the handshake to complete. MTU probing will then begin as usual when the handshake
completes.
Note: initial_mtu
must be >= base_mtu
and <= max_mtu
sourcepub fn with_base_mtu(self, base_mtu: u16) -> Result<Builder, Error>
pub fn with_base_mtu(self, base_mtu: u16) -> Result<Builder, Error>
Sets the smallest maximum transmission unit (MTU) to use when transmitting (default: 1228)
MTU is the size of the largest IP packet that can be transmitted on a path. This includes the size of the IP header, the size of the UDP header, and the size of the UDP payload containing the QUIC packet(s).
QUIC requires that a network path support at least a 1200 byte datagram size, which translates to 1228 bytes including the minimum IP header size (20 bytes) + UDP header size (8 bytes).
If you have high confidence your network can support an MTU larger than the default base_mtu
,
you can set this to a higher value. This will allow every packet s2n-quic transmits to reach
this MTU, even if packet loss results in MTU probing failing. Only configure this value if
it is certain the network path and peer can support the given base_mtu
, as if it cannot
support the base_mtu
, connections will not be able to opened to or from the endpoint.
Note: base_mtu
must be >= 1228 and <= initial_mtu
and max_mtu
sourcepub fn with_gso_disabled(self) -> Result<Builder, Error>
pub fn with_gso_disabled(self) -> Result<Builder, Error>
Disables Generic Segmentation Offload (GSO)
By default, GSO will be used unless the platform does not support it or an attempt to use GSO fails. If it is known that GSO is not available, set this option to explicitly disable it.
sourcepub fn with_gso(self, enabled: bool) -> Result<Builder, Error>
pub fn with_gso(self, enabled: bool) -> Result<Builder, Error>
Configures Generic Segmentation Offload (GSO)
By default, GSO will be used unless the platform does not support it or an attempt to use GSO fails. If it is known that GSO is not available, set this option to explicitly disable it.
sourcepub fn with_gro_disabled(self) -> Result<Builder, Error>
pub fn with_gro_disabled(self) -> Result<Builder, Error>
Disables Generic Receive Offload (GRO)
By default, GRO will be used unless the platform does not support it. If it is known that GRO is not available, set this option to explicitly disable it.
sourcepub fn with_gro(self, enabled: bool) -> Result<Builder, Error>
pub fn with_gro(self, enabled: bool) -> Result<Builder, Error>
Configures Generic Receive Offload (GRO)
By default, GRO will be used unless the platform does not support it. If it is known that GRO is not available, set this option to explicitly disable it.
sourcepub fn with_reuse_address(self, enabled: bool) -> Result<Builder, Error>
pub fn with_reuse_address(self, enabled: bool) -> Result<Builder, Error>
Enables the address reuse (SO_REUSEADDR) socket option
sourcepub fn with_reuse_port(self) -> Result<Builder, Error>
pub fn with_reuse_port(self) -> Result<Builder, Error>
Enables the port reuse (SO_REUSEPORT) socket option