Struct vapcore_network::NetworkConfiguration[][src]

pub struct NetworkConfiguration {
    pub config_path: Option<String>,
    pub net_config_path: Option<String>,
    pub listen_address: Option<SocketAddr>,
    pub public_address: Option<SocketAddr>,
    pub udp_port: Option<u16>,
    pub nat_enabled: bool,
    pub nat_type: NatType,
    pub discovery_enabled: bool,
    pub boot_nodes: Vec<String>,
    pub use_secret: Option<Secret>,
    pub min_peers: u32,
    pub max_peers: u32,
    pub max_handshakes: u32,
    pub reserved_protocols: HashMap<ProtocolId, u32>,
    pub reserved_nodes: Vec<String>,
    pub non_reserved_mode: NonReservedPeerMode,
    pub ip_filter: IpFilter,
    pub client_version: String,
}

Network service configuration

Fields

config_path: Option<String>

Directory path to store general network configuration. None means nothing will be saved

net_config_path: Option<String>

Directory path to store network-specific configuration. None means nothing will be saved

listen_address: Option<SocketAddr>

IP address to listen for incoming connections. Listen to all connections by default

public_address: Option<SocketAddr>

IP address to advertise. Detected automatically if none.

udp_port: Option<u16>

Port for UDP connections, same as TCP by default

nat_enabled: bool

Enable NAT configuration

nat_type: NatType

Nat type

discovery_enabled: bool

Enable discovery

boot_nodes: Vec<String>

List of initial node addresses

use_secret: Option<Secret>

Use provided node key instead of default

min_peers: u32

Minimum number of connected peers to maintain

max_peers: u32

Maximum allowed number of peers

max_handshakes: u32

Maximum handshakes

reserved_protocols: HashMap<ProtocolId, u32>

Reserved protocols. Peers with protocol get additional connection slots.

reserved_nodes: Vec<String>

List of reserved node addresses.

non_reserved_mode: NonReservedPeerMode

The non-reserved peer mode.

ip_filter: IpFilter

IP filter

client_version: String

Client identifier

Implementations

impl NetworkConfiguration[src]

pub fn new() -> Self[src]

Create a new instance of default settings.

pub fn new_with_port(port: u16) -> NetworkConfiguration[src]

Create new default configuration with specified listen port.

pub fn new_local() -> NetworkConfiguration[src]

Create new default configuration for localhost-only connection with random port (usefull for testing)

Trait Implementations

impl Clone for NetworkConfiguration[src]

impl Debug for NetworkConfiguration[src]

impl Default for NetworkConfiguration[src]

impl PartialEq<NetworkConfiguration> for NetworkConfiguration[src]

impl StructuralPartialEq for NetworkConfiguration[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,