Struct SocketCapabilitiesBuilder

Source
pub struct SocketCapabilitiesBuilder<'s> { /* private fields */ }
Expand description

Builder to enable Linux sockopts which improve QUIC performance.

Implementations§

Source§

impl<'s> SocketCapabilitiesBuilder<'s>

Source

pub fn new<S: AsFd>(socket: &'s S) -> Self

Creates a new sockopt builder for socket.

Source

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.

Source

pub fn check_udp_drop(&mut self) -> Result<()>

Enables SO_RXQ_OVFL, which reports dropped packets due to insufficient buffer space.

Source

pub fn txtime(&mut self) -> Result<()>

Enables SO_TXTIME to control packet transmit timestamps for QUIC pacing.

Source

pub fn rxtime(&mut self) -> Result<()>

Enables SO_TIMESTAMPNS, which records a wall-clock timestamp for each received packet.

Source

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.

Source

pub fn ipv4_pktinfo(&mut self) -> Result<()>

Enables IP_PKTINFO to control the source IP in outbound IPv4 packets.

Source

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.

Source

pub fn ipv6_pktinfo(&mut self) -> Result<()>

Enables IPV6_RECVPKTINFO to control the source IP in outbound IPv6 packets.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn finish(self) -> SocketCapabilities

Consumes the builder and returns the configured SocketCapabilities.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,