Skip to main content

Module net

Module net 

Source
Expand description

Socket helpers: name resolution and UDP socket setup.

Resolution is deliberately explicit rather than left to TcpStream::connect’s implicit lookup. Two later requirements depend on seeing the resolved addresses:

  • RFC 9298 §3.1 requires a CONNECT-UDP request to be resolved before the 2xx response is sent.
  • The destination ACL (M4) can only filter what it can see.

Structs§

ConnectionResolver
What one connection may ask the resolver to do at once.
ResolverBudget
The server’s share of the blocking pool, handed out one connection at a time.

Constants§

BURST_LOOKUPS
Lookups one connection may take from SHARED_LOOKUPS at once.
LOOKUP_FREE_THREADS
Blocking threads the pool keeps clear of name resolution.
RESERVED_LOOKUP_CEILING
Connections the blocking pool is sized to reserve a lookup slot for.
SHARED_LOOKUPS
Name lookups the whole process may have in flight beyond the one every connection keeps in reserve.

Functions§

blocking_pool_size
The blocking pool the runtime is built with, in threads.
connected_udp_socket
Binds a UDP socket and connects it to target.
fd_limits
The process’s RLIMIT_NOFILE, soft limit first and hard limit second.
fd_soft_limit
The process’s soft limit on open file descriptors, or None if it has none.
holds_address
Whether this host holds ip, meaning a socket of this process may be bound to it.
max_open_files
The Max open files row of a /proc/<pid>/limits file, soft limit first.
prefer_family
Reorders addresses so the preferred address family comes first.
resolve
Resolves host/port to a non-empty list of socket addresses.