Struct ckb_app_config::NetworkConfig[][src]

pub struct NetworkConfig {
Show 20 fields pub whitelist_only: bool, pub max_peers: u32, pub max_outbound_peers: u32, pub path: PathBuf, pub dns_seeds: Vec<String>, pub discovery_local_address: bool, pub discovery_announce_check_interval_secs: Option<u64>, pub ping_interval_secs: u64, pub ping_timeout_secs: u64, pub connect_outbound_interval_secs: u64, pub listen_addresses: Vec<Multiaddr>, pub public_addresses: Vec<Multiaddr>, pub bootnodes: Vec<Multiaddr>, pub whitelist_peers: Vec<Multiaddr>, pub upnp: bool, pub bootnode_mode: bool, pub support_protocols: Vec<SupportProtocol>, pub max_send_buffer: Option<usize>, pub reuse_port_on_linux: bool, pub sync: SyncConfig,
}
Expand description

Network config options.

Fields

whitelist_only: bool

Only connect to whitelist peers.

max_peers: u32

Maximum number of allowed connected peers.

The node will evict connections when the number exceeds this limit.

max_outbound_peers: u32

Maximum number of outbound peers.

When node A connects to B, B is the outbound peer of A.

path: PathBuf

Network data storage directory path.

dns_seeds: Vec<String>

A list of DNS servers to discover peers.

discovery_local_address: bool

Whether to probe and store local addresses.

discovery_announce_check_interval_secs: Option<u64>

The interval between discovery announce message checking.

ping_interval_secs: u64

Interval between pings in seconds.

A node pings peer regularly to see whether the connection is alive.

ping_timeout_secs: u64

The ping timeout in seconds.

If a peer does not respond to ping before the timeout, it is evicted.

connect_outbound_interval_secs: u64

The interval between trials to connect more outbound peers.

listen_addresses: Vec<Multiaddr>

Listen addresses.

public_addresses: Vec<Multiaddr>

Public addresses.

Set this if this is different from listen_addresses.

bootnodes: Vec<Multiaddr>

A list of peers used to boot the node discovery.

Bootnodes are used to bootstrap the discovery when local peer storage is empty.

whitelist_peers: Vec<Multiaddr>

A list of peers added in the whitelist.

When whitelist_only is enabled, the node will only connect to peers in this list.

upnp: bool

Enable UPNP when the router supports it.

bootnode_mode: bool

Enable bootnode mode.

It is recommended to enable this when this server is intended to be used as a node in the bootnodes.

support_protocols: Vec<SupportProtocol>

Supported protocols list

max_send_buffer: Option<usize>

Max send buffer size in bytes.

reuse_port_on_linux: bool

Network use reuse port or not

sync: SyncConfig

Chain synchronization config options.

Implementations

Gets the network secret key path.

Gets the peer store path.

Creates missing directories.

Gets maximum inbound peers.

Gets maximum outbound peers.

Gets maximum send buffer size.

Reads the private key from file or generates one if the file does not exist.

Gets the list of whitelist peers.

Gets a list of bootnodes.

Checks whether the outbound peer service should be enabled.

Checks whether the DNS seeding service should be enabled.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

TODO(doc): @quake

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.