pub struct SettingsOpt {Show 30 fields
pub inbound: Vec<Url>,
pub outbound_connections: Option<usize>,
pub inbound_connections: Option<usize>,
pub magic_bytes: MagicBytes,
pub external_addrs: Vec<Url>,
pub peers: Vec<Url>,
pub seeds: Vec<Url>,
pub outbound_connect_timeout: Option<u64>,
pub channel_handshake_timeout: Option<u64>,
pub channel_heartbeat_interval: Option<u64>,
pub node_id: String,
pub active_profiles: Option<Vec<String>>,
pub mixed_profiles: Option<Vec<String>>,
pub tor_socks5_proxy: Option<Url>,
pub nym_socks5_proxy: Option<Url>,
pub i2p_socks5_proxy: Option<Url>,
pub localnet: bool,
pub outbound_peer_discovery_cooloff_time: Option<u64>,
pub outbound_peer_discovery_attempt_time: Option<u64>,
pub getaddrs_max: Option<u32>,
pub p2p_datastore: Option<String>,
pub hostlist: Option<String>,
pub greylist_refinery_interval: Option<u64>,
pub white_connect_percent: Option<usize>,
pub gold_connect_count: Option<usize>,
pub slot_preference_strict: bool,
pub time_with_no_connections: Option<u64>,
pub blacklist: Vec<(String, Vec<String>, Vec<u16>)>,
pub ban_policy: BanPolicy,
pub profiles: HashMap<String, NetworkProfileOpt>,
}Expand description
Defines the network settings so we can have P2P configurations in TOML files.
Fields§
§inbound: Vec<Url>P2P accept address node listens to for inbound connections
outbound_connections: Option<usize>Outbound connection slots number
inbound_connections: Option<usize>Inbound connection slots number
magic_bytes: MagicBytesMagic bytes used to distinguish P2P distinct networks and avoid nodes bleeding due to user config error.
external_addrs: Vec<Url>P2P external addresses node advertises so other peers can reach us and connect to us, as long as inbound addresses are also configured
peers: Vec<Url>Peer nodes to manually connect to
seeds: Vec<Url>Seed nodes to connect to for peers retrieval and/or advertising our own external addresses
outbound_connect_timeout: Option<u64>Connection establishment timeout in seconds
channel_handshake_timeout: Option<u64>Exchange versions (handshake) timeout in seconds
channel_heartbeat_interval: Option<u64>Ping-pong exchange execution interval in seconds
node_id: StringOnly used for debugging. Compromises privacy when set.
active_profiles: Option<Vec<String>>Preferred transports for outbound connections
mixed_profiles: Option<Vec<String>>Transports allowed to be mixed (tcp, tcp+tls, tor, tor+tls). When transport is added to this list the corresponding transport in active_profiles is used to connect to the node. Supported mixing scenarios include tor => tcp, tor+tls => tcp+tls, socks5 => tor, socks5 => tcp, socks5+tls => tor+tls, socks5+tls => tcp+tls where the first one overrides the second.
tor_socks5_proxy: Option<Url>Tor socks5 proxy to connect to when socks5 or socks5+tls are added to active profiles and transport mixing is enabled
nym_socks5_proxy: Option<Url>Nym socks5 proxy to connect to when socks5 or socks5+tls are added to active profiles and transport mixing is enabled
i2p_socks5_proxy: Option<Url>I2p Socks5 proxy to connect to i2p eepsite (hidden services)
localnet: boolIf this is true, strictly follow the gold_connect_count and white_connect_percent settings. Otherwise, connect to greylist entries if we have no white or gold connections.
outbound_peer_discovery_cooloff_time: Option<u64>Cooling off time for peer discovery when unsuccessful
outbound_peer_discovery_attempt_time: Option<u64>Time between peer discovery attempts
getaddrs_max: Option<u32>Maximum number of addresses (with preferred transports) to receive from
seeds and peers.
If undefined, outbound_connections will be used instead.
p2p_datastore: Option<String>P2P datastore path
hostlist: Option<String>Hosts .tsv file to use
greylist_refinery_interval: Option<u64>Pause interval within greylist refinery process
white_connect_percent: Option<usize>Number of whitelist connections
gold_connect_count: Option<usize>Number of goldlist connections
slot_preference_strict: boolAllow localnet hosts
time_with_no_connections: Option<u64>Number of seconds with no connections after which refinery process is paused.
blacklist: Vec<(String, Vec<String>, Vec<u16>)>Nodes to avoid interacting with for the duration of the program, in the format [“host”, [“scheme”, “scheme”], [port, port]] If scheme is left empty it will default to “tcp+tls”. If ports are left empty all ports from this peer will be blocked.
ban_policy: BanPolicyDo not ban nodes that send messages without dispatchers if set
to Relaxed. For most uses, should be set to Strict.
profiles: HashMap<String, NetworkProfileOpt>Network Profile for each transport
Trait Implementations§
Source§impl Clone for SettingsOpt
impl Clone for SettingsOpt
Source§fn clone(&self) -> SettingsOpt
fn clone(&self) -> SettingsOpt
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SettingsOpt
impl Debug for SettingsOpt
Source§impl Default for SettingsOpt
impl Default for SettingsOpt
Source§impl<'de> Deserialize<'de> for SettingsOpt
impl<'de> Deserialize<'de> for SettingsOpt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl StructOpt for SettingsOpt
impl StructOpt for SettingsOpt
Source§fn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
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.§fn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
std::env::args_os).
Calls clap::Error::exit on failure, printing the error message and aborting the program.§fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
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.§fn from_iter<I>(iter: I) -> Self
fn from_iter<I>(iter: I) -> Self
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>
fn from_iter_safe<I>(iter: I) -> Result<Self, Error>
Vec of your making. Read moreSource§impl StructOptToml for SettingsOpt
impl StructOptToml for SettingsOpt
Source§fn merge<'a>(from_toml: Self, from_args: Self, args: &ArgMatches<'_>) -> Selfwhere
Self: Sized + StructOpt + Deserialize<'a>,
fn merge<'a>(from_toml: Self, from_args: Self, args: &ArgMatches<'_>) -> Selfwhere
Self: Sized + StructOpt + Deserialize<'a>,
§fn from_clap_with_toml<'a>(
toml_str: &'a str,
args: &ArgMatches<'_>,
) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
fn from_clap_with_toml<'a>(
toml_str: &'a str,
args: &ArgMatches<'_>,
) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
clap::ArgMatches with initial values from TOML.§fn from_args_with_toml<'a>(toml_str: &'a str) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
fn from_args_with_toml<'a>(toml_str: &'a str) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
§fn from_iter_with_toml<'a, I>(toml_str: &'a str, iter: I) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
fn from_iter_with_toml<'a, I>(toml_str: &'a str, iter: I) -> Result<Self, Error>where
Self: Sized + StructOpt + Deserialize<'a>,
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString> + Clone,
Auto Trait Implementations§
impl Freeze for SettingsOpt
impl RefUnwindSafe for SettingsOpt
impl Send for SettingsOpt
impl Sync for SettingsOpt
impl Unpin for SettingsOpt
impl UnwindSafe for SettingsOpt
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.