pub struct NetworkArgs {Show 22 fields
pub discovery: DiscoveryArgs,
pub trusted_peers: Vec<TrustedPeer>,
pub trusted_only: bool,
pub bootnodes: Option<Vec<TrustedPeer>>,
pub dns_retries: usize,
pub peers_file: Option<PathBuf>,
pub identity: String,
pub p2p_secret_key: Option<PathBuf>,
pub no_persist_peers: bool,
pub nat: NatResolver,
pub addr: IpAddr,
pub port: u16,
pub max_outbound_peers: Option<usize>,
pub max_inbound_peers: Option<usize>,
pub max_concurrent_tx_requests: u32,
pub max_concurrent_tx_requests_per_peer: u8,
pub max_seen_tx_history: u32,
pub max_pending_pool_imports: usize,
pub soft_limit_byte_size_pooled_transactions_response: usize,
pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
pub max_capacity_cache_txns_pending_fetch: u32,
pub net_if: Option<String>,
}
Expand description
Parameters for configuring the network more granularity via CLI
Fields§
§discovery: DiscoveryArgs
Arguments to setup discovery service.
trusted_peers: Vec<TrustedPeer>
Comma separated enode URLs of trusted peers for P2P connections.
–trusted-peers enode://abcd@192.168.0.1:30303
trusted_only: bool
Connect to or accept from trusted peers only
bootnodes: Option<Vec<TrustedPeer>>
Comma separated enode URLs for P2P discovery bootstrap.
Will fall back to a network-specific default if not specified.
dns_retries: usize
Amount of DNS resolution requests retries to perform when peering.
peers_file: Option<PathBuf>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with --no-persist-peers
.
identity: String
Custom node identity
p2p_secret_key: Option<PathBuf>
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
no_persist_peers: bool
Do not persist peers.
nat: NatResolver
NAT resolution method (any|none|upnp|publicip|extip:<IP>)
addr: IpAddr
Network listening address
port: u16
Network listening port
max_outbound_peers: Option<usize>
Maximum number of outbound requests. default: 100
max_inbound_peers: Option<usize>
Maximum number of inbound requests. default: 30
max_concurrent_tx_requests: u32
Max concurrent GetPooledTransactions
requests.
max_concurrent_tx_requests_per_peer: u8
Max concurrent GetPooledTransactions
requests per peer.
max_seen_tx_history: u32
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
max_pending_pool_imports: usize
Max number of transactions to import concurrently.
soft_limit_byte_size_pooled_transactions_response: usize
Experimental, for usage in research. Sets the max accumulated byte size of transactions to pack in one response. Spec’d at 2MiB.
soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize
Experimental, for usage in research. Sets the max accumulated byte size of transactions to request in one request.
Since RLPx
protocol version 68, the byte size of a transaction is shared as metadata in a
transaction announcement (see RLPx
specs). This allows a node to request a specific size
response.
By default, nodes request only 128 KiB worth of transactions, but should a peer request more, up to 2 MiB, a node will answer with more than 128 KiB.
Default is 128 KiB.
max_capacity_cache_txns_pending_fetch: u32
Max capacity of cache of hashes for transactions pending fetch.
net_if: Option<String>
Name of network interface used to communicate with peers.
If flag is set, but no value is passed, the default interface for docker eth0
is tried.
Implementations§
Source§impl NetworkArgs
impl NetworkArgs
Sourcepub fn resolved_addr(&self) -> IpAddr
pub fn resolved_addr(&self) -> IpAddr
Returns the resolved IP address.
Sourcepub fn resolved_bootnodes(&self) -> Option<Vec<NodeRecord>>
pub fn resolved_bootnodes(&self) -> Option<Vec<NodeRecord>>
Returns the resolved bootnodes if any are provided.
Sourcepub fn network_config<N: NetworkPrimitives>(
&self,
config: &Config,
chain_spec: impl EthChainSpec,
secret_key: SecretKey,
default_peers_file: PathBuf,
) -> NetworkConfigBuilder<N>
pub fn network_config<N: NetworkPrimitives>( &self, config: &Config, chain_spec: impl EthChainSpec, secret_key: SecretKey, default_peers_file: PathBuf, ) -> NetworkConfigBuilder<N>
Build a NetworkConfigBuilder
from a Config
and a EthChainSpec
, in addition to
the values in this option struct.
The default_peers_file
will be used as the default location to store the persistent peers
file if no_persist_peers
is false, and there is no provided peers_file
.
Configured Bootnodes are prioritized, if unset, the chain spec bootnodes are used Priority order for bootnodes configuration:
- –bootnodes flag
- Network preset flags (e.g. –holesky)
- default to mainnet nodes
Sourcepub fn persistent_peers_file(&self, peers_file: PathBuf) -> Option<PathBuf>
pub fn persistent_peers_file(&self, peers_file: PathBuf) -> Option<PathBuf>
If no_persist_peers
is false then this returns the path to the persistent peers file path.
Sourcepub const fn with_unused_p2p_port(self) -> Self
pub const fn with_unused_p2p_port(self) -> Self
Sets the p2p port to zero, to allow the OS to assign a random unused port when the network components bind to a socket.
Sourcepub const fn with_unused_ports(self) -> Self
pub const fn with_unused_ports(self) -> Self
Sets the p2p and discovery ports to zero, allowing the OD to assign a random unused port when network components bind to sockets.
Sourcepub fn adjust_instance_ports(&mut self, instance: u16)
pub fn adjust_instance_ports(&mut self, instance: u16)
Change networking port numbers based on the instance number.
Ports are updated to previous_value + instance - 1
§Panics
Warning: if instance
is zero in debug mode, this will panic.
Sourcepub async fn resolve_trusted_peers(&self) -> Result<Vec<NodeRecord>, Error>
pub async fn resolve_trusted_peers(&self) -> Result<Vec<NodeRecord>, Error>
Resolve all trusted peers at once
Trait Implementations§
Source§impl Args for NetworkArgs
impl Args for NetworkArgs
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id
][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command
] so it can instantiate self
via
[FromArgMatches::update_from_arg_matches_mut
] Read moreSource§impl Clone for NetworkArgs
impl Clone for NetworkArgs
Source§fn clone(&self) -> NetworkArgs
fn clone(&self) -> NetworkArgs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for NetworkArgs
impl Debug for NetworkArgs
Source§impl Default for NetworkArgs
impl Default for NetworkArgs
Source§impl FromArgMatches for NetworkArgs
impl FromArgMatches for NetworkArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§impl PartialEq for NetworkArgs
impl PartialEq for NetworkArgs
impl Eq for NetworkArgs
impl StructuralPartialEq for NetworkArgs
Auto Trait Implementations§
impl Freeze for NetworkArgs
impl RefUnwindSafe for NetworkArgs
impl Send for NetworkArgs
impl Sync for NetworkArgs
impl Unpin for NetworkArgs
impl UnwindSafe for NetworkArgs
Blanket Implementations§
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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> 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> 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.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 344 bytes