pub struct Config {
pub name: Option<String>,
pub listener_ip: Option<IpAddr>,
pub desired_listening_port: Option<u16>,
pub allow_random_port: bool,
pub max_connections: u16,
pub max_connections_per_ip: u16,
pub connection_timeout_ms: u16,
}Expand description
The Tcp’s configuration. See the source of Config::default for the defaults.
Fields§
§name: Option<String>A user-friendly identifier of the Tcp. It is visible in the logs, where it allows Tcp instances to be distinguished more easily if multiple are run at the same time.
note: If set to None when the configuration is initially created, it will be automatically assigned
(the string representation of) a sequential, zero-based numeric identifier. So this is essentially never
None, in a running node.
listener_ip: Option<IpAddr>The IP address the Tcp’s connection listener should bind to.
note: If set to None, the Tcp will not listen for inbound connections at all.
desired_listening_port: Option<u16>The desired listening port of the Tcp. If Config::allow_random_port is set to true, the Tcp
will attempt to bind its listener to a different port if the desired one is not available.
note: Config::listener_ip must not be None in order for it to have any effect.
allow_random_port: boolAllow listening on a different port if Config::desired_listening_port is unavailable.
note: Config::listener_ip must not be None in order for it to have any effect.
max_connections: u16The maximum number of active connections Tcp can maintain at any given time.
note: This number can very briefly be breached by 1 in case of inbound connection attempts. It can never be breached by outbound connection attempts, though.
max_connections_per_ip: u16The maximum number of connections Tcp can maintain with a single IP address.
note: Like Config::max_connections, pending connections count towards this limit too.
note: Must not be 0.
connection_timeout_ms: u16The maximum time (in milliseconds) allowed to establish a raw (before the Handshake protocol) TCP connection.