Skip to main content

Module net

Module net 

Source
Expand description

Network abstractions for dependency injection and testing.

The traits and type aliases let network clients use either real tokio networking or simulated turmoil networking through dependency injection. apply_socket_options is the single place every connect path configures its TCP socket.

§Conditional compilation

The module selects TCP types at compile time:

  • Default builds: tokio::net::{TcpStream, TcpListener}
  • Builds with --features turmoil: turmoil::net::{TcpStream, TcpListener}

Production code therefore runs against the simulator without source changes, while default builds incur no runtime dispatch or simulation overhead.

Structs§

RealTcpConnector
Production TCP connector.
TcpListener
A simulated TCP socket server, listening for connections.
TcpStream
A simulated TCP stream between a local and a remote socket.

Traits§

TcpConnector
Trait for network types that can establish TCP connections.