pub struct SocketCapabilitiesBuilder<'s> { /* private fields */ }
Expand description
Builder to enable Linux sockopts which improve QUIC performance.
Implementations§
Source§impl<'s> SocketCapabilitiesBuilder<'s>
impl<'s> SocketCapabilitiesBuilder<'s>
Sourcepub fn gso(&mut self, max_send_udp_payload_size: usize) -> Result<()>
pub fn gso(&mut self, max_send_udp_payload_size: usize) -> Result<()>
Enables UDP_SEGMENT
,
a generic segmentation offload (GSO).
GSO improves transmit performance by treating multiple sequential UDP packets as a single entity in the kernel. Segmentation into individual packets happens in the NIC, if it supports GSO. The parameter specifies the packet size.
Sourcepub fn check_udp_drop(&mut self) -> Result<()>
pub fn check_udp_drop(&mut self) -> Result<()>
Enables SO_RXQ_OVFL
,
which reports dropped packets due to insufficient buffer space.
Sourcepub fn txtime(&mut self) -> Result<()>
pub fn txtime(&mut self) -> Result<()>
Enables SO_TXTIME
to control packet transmit timestamps for QUIC pacing.
Sourcepub fn rxtime(&mut self) -> Result<()>
pub fn rxtime(&mut self) -> Result<()>
Enables SO_TIMESTAMPNS
,
which records a wall-clock timestamp for each received packet.
Sourcepub fn gro(&mut self) -> Result<()>
pub fn gro(&mut self) -> Result<()>
Enables UDP_GRO
,
a generic receive offload (GRO).
GRO improves receive performance by allowing the kernel to yield
multiple UDP packets in one recvmsg(2)
call. It is the equivalent of GSO for the receive path.
Sourcepub fn ipv4_pktinfo(&mut self) -> Result<()>
pub fn ipv4_pktinfo(&mut self) -> Result<()>
Enables IP_PKTINFO
to control the source IP in outbound IPv4 packets.
Sourcepub fn ipv4_recvorigdstaddr(&mut self) -> Result<()>
pub fn ipv4_recvorigdstaddr(&mut self) -> Result<()>
Enables IP_RECVORIGDSTADDR
,
which reports each packet’s real IPv4 destination address.
This can be different from the socket’s local address due to netfilter TPROXY rules or eBPF redirects.
Sourcepub fn ipv6_pktinfo(&mut self) -> Result<()>
pub fn ipv6_pktinfo(&mut self) -> Result<()>
Enables IPV6_RECVPKTINFO
to control the source IP in outbound IPv6 packets.
Sourcepub fn ipv6_recvorigdstaddr(&mut self) -> Result<()>
pub fn ipv6_recvorigdstaddr(&mut self) -> Result<()>
Enables IPV6_RECVORIGDSTADDR
,
which reports each packet’s real IPv6 destination address.
This can be different from the socket’s local address due to netfilter TPROXY rules or eBPF redirects.
Sourcepub fn ip_mtu_discover_probe(&mut self) -> Result<()>
pub fn ip_mtu_discover_probe(&mut self) -> Result<()>
Sets IP_MTU_DISCOVER
, to
IP_PMTUDISC_PROBE
, which disables kernel PMTUD and sets the DF
(Don’t Fragment) flag.
Sourcepub fn ipv6_mtu_discover_probe(&mut self) -> Result<()>
pub fn ipv6_mtu_discover_probe(&mut self) -> Result<()>
Sets IPV6_MTU_DISCOVER
, to
IPV6_PMTUDISC_PROBE
, which disables kernel PMTUD and sets the DF
(Don’t Fragment) flag.
Sourcepub fn allows_nonlocal_source(&self) -> Result<bool>
pub fn allows_nonlocal_source(&self) -> Result<bool>
Tests whether IP_FREEBIND
or IP_TRANSPARENT
are
enabled for this socket.
§Warning
These sockopts require elevated permissions to enable, so the builder
will only check their status. If neither of them is enabled, the
PKTINFO
sockopts will cause errors when sending packets.
Sourcepub fn finish(self) -> SocketCapabilities
pub fn finish(self) -> SocketCapabilities
Consumes the builder and returns the configured SocketCapabilities
.
Auto Trait Implementations§
impl<'s> Freeze for SocketCapabilitiesBuilder<'s>
impl<'s> RefUnwindSafe for SocketCapabilitiesBuilder<'s>
impl<'s> Send for SocketCapabilitiesBuilder<'s>
impl<'s> Sync for SocketCapabilitiesBuilder<'s>
impl<'s> Unpin for SocketCapabilitiesBuilder<'s>
impl<'s> UnwindSafe for SocketCapabilitiesBuilder<'s>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more