pub struct UdpOptions { /* private fields */ }udp only.Expand description
Options for UdpSocket::bind_with.
use net_io::{UdpBudget, UdpOptions};
let options = UdpOptions::new()
.amplification_factor(3) // a QUIC handshake (RFC 9000)
.global_budget(UdpBudget { datagrams_per_sec: 50_000, bytes_per_sec: 60_000_000, burst: 5_000 });Implementations§
Source§impl UdpOptions
impl UdpOptions
Sourcepub fn new() -> UdpOptions
pub fn new() -> UdpOptions
Factor 1, a 10 s window, UdpBudget::SOURCE_DEFAULT per source, no
global budget, 65,536 sources, IPv6-only for IPv6 addresses.
Sourcepub fn amplification_factor(self, factor: u8) -> UdpOptions
pub fn amplification_factor(self, factor: u8) -> UdpOptions
How many times the bytes received from an unverified source may be sent back to it (1 by default, at most 3; decision D-034).
Sourcepub fn amplification_window(self, window: Duration) -> UdpOptions
pub fn amplification_window(self, window: Duration) -> UdpOptions
How long received bytes count toward a source’s send allowance (10 s by default, at least 1 s). The allowance spans the current and the previous window, so a reply just after a window boundary is not refused.
Sourcepub fn source_budget(self, budget: UdpBudget) -> UdpOptions
pub fn source_budget(self, budget: UdpBudget) -> UdpOptions
The budget of each source address.
Sourcepub fn global_budget(self, budget: UdpBudget) -> UdpOptions
pub fn global_budget(self, budget: UdpBudget) -> UdpOptions
A budget for the whole socket (none by default).
Sourcepub fn source_table(self, entries: u32) -> UdpOptions
pub fn source_table(self, entries: u32) -> UdpOptions
How many sources are tracked (65,536 by default, about 130 bytes each).
Sourcepub fn packet_info(self, on: bool) -> UdpOptions
pub fn packet_info(self, on: bool) -> UdpOptions
IPV6_V6ONLY for an IPv6 address (on by default). Off, an IPv6 socket also
receives IPv4; sources are reported as IPv4 and replies to them work.
Reports each datagram’s destination address in Datagram::destination, for a
socket bound to a wildcard that must answer from the address it was asked on.
One recvmsg per datagram instead of recvfrom. Unix only: bind_with fails
with Unsupported on Windows, and recv_batch does not fill it.
Sourcepub fn ipv6_only(self, on: bool) -> UdpOptions
pub fn ipv6_only(self, on: bool) -> UdpOptions
IPV6_V6ONLY for IPv6 addresses (on by default).