Struct safe_network::routing::NetworkConfig [−][src]
pub struct NetworkConfig {
pub forward_port: bool,
pub external_port: Option<u16>,
pub external_ip: Option<IpAddr>,
pub idle_timeout: Option<Duration>,
pub keep_alive_interval: Option<Duration>,
pub upnp_lease_duration: Option<Duration>,
pub min_retry_duration: Option<Duration>,
}Expand description
QuicP2p configurations
Fields
forward_port: boolSpecify if port forwarding via UPnP should be done or not. This can be set to false if the network is run locally on the network loopback or on a local area network.
external_port: Option<u16>External port number assigned to the socket address of the program. If this is provided, QP2p considers that the local port provided has been mapped to the provided external port number and automatic port forwarding will be skipped.
external_ip: Option<IpAddr>External IP address of the computer on the WAN. This field is mandatory if the node is the genesis node and port forwarding is not available. In case of non-genesis nodes, the external IP address will be resolved using the Echo service.
idle_timeout: Option<Duration>How long to wait to hear from a peer before timing out a connection.
In the absence of any keep-alive messages, connections will be closed if they remain idle for at least this duration.
If unspecified, this will default to DEFAULT_IDLE_TIMEOUT.
keep_alive_interval: Option<Duration>Interval at which to send keep-alives to maintain otherwise idle connections.
Keep-alives prevent otherwise idle connections from timing out.
If unspecified, this will default to DEFAULT_KEEP_ALIVE_INTERVAL.
upnp_lease_duration: Option<Duration>How long UPnP port mappings will last.
Note that UPnP port mappings will be automatically renewed on this interval.
If unspecified, this will default to DEFAULT_UPNP_LEASE_DURATION, which should be
suitable in most cases but some routers may clear UPnP port mapping more frequently.
min_retry_duration: Option<Duration>How long to retry establishing connections and sending messages.
Retrying will continue for at least this duration, but potentially longer as an in-progress back-off delay will not be interrupted.
If unspecified, this will default to DEFAULT_MIN_RETRY_DURATION.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Config, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Config, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Builds the struct from clap::ArgMatches. It’s guaranteed to succeed
if matches originates from an App generated by StructOpt::clap called on
the same type, otherwise it must panic. Read more
Builds the struct from the command line arguments (std::env::args_os).
Calls clap::Error::exit on failure, printing the error message and aborting the program. Read more
Builds the struct from the command line arguments (std::env::args_os).
Unlike StructOpt::from_args, returns clap::Error on failure instead of aborting the program,
so calling .exit is up to you. Read more
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec of your making.
Print the error message and quit the program in case of failure. Read more
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec of your making. Read more
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more