subspace_networking

Struct Config

Source
pub struct Config {
Show 25 fields pub keypair: Keypair, pub listen_on: Vec<Multiaddr>, pub listen_on_fallback_to_random_port: bool, pub timeout: Duration, pub identify: Config, pub kademlia: Config, pub gossipsub: Option<Config>, pub yamux_config: Config, pub allow_non_global_addresses_in_dht: bool, pub initial_random_query_interval: Duration, pub known_peers_registry: Box<dyn KnownPeersRegistry>, pub request_response_protocols: Vec<Box<dyn RequestHandler>>, pub reserved_peers: Vec<Multiaddr>, pub max_established_incoming_connections: u32, pub max_established_outgoing_connections: u32, pub max_pending_incoming_connections: u32, pub max_pending_outgoing_connections: u32, pub temporary_bans_cache_size: u32, pub temporary_ban_backoff: ExponentialBackoff, pub libp2p_metrics: Option<Metrics>, pub metrics: Option<SubspaceMetrics>, pub protocol_version: String, pub bootstrap_addresses: Vec<Multiaddr>, pub kademlia_mode: KademliaMode, pub external_addresses: Vec<Multiaddr>,
}
Expand description

Node configuration.

Fields§

§keypair: Keypair

Identity keypair of a node used for authenticated connections.

§listen_on: Vec<Multiaddr>

List of [Multiaddr] on which to listen for incoming connections.

§listen_on_fallback_to_random_port: bool

Fallback to random port if specified (or default) port is already occupied.

§timeout: Duration

Adds a timeout to the setup and protocol upgrade process for all inbound and outbound connections established through the transport.

§identify: Config

The configuration for the Identify behaviour.

§kademlia: Config

The configuration for the Kademlia behaviour.

§gossipsub: Option<Config>

The configuration for the Gossip behaviour.

§yamux_config: Config

Yamux multiplexing configuration.

§allow_non_global_addresses_in_dht: bool

Should non-global addresses be added to the DHT?

§initial_random_query_interval: Duration

How frequently should random queries be done using Kademlia DHT to populate routing table.

§known_peers_registry: Box<dyn KnownPeersRegistry>

A reference to the NetworkingParametersRegistry implementation.

§request_response_protocols: Vec<Box<dyn RequestHandler>>

The configuration for the RequestResponsesBehaviour protocol.

§reserved_peers: Vec<Multiaddr>

Defines set of peers with a permanent connection (and reconnection if necessary).

§max_established_incoming_connections: u32

Established incoming swarm connection limit.

§max_established_outgoing_connections: u32

Established outgoing swarm connection limit.

§max_pending_incoming_connections: u32

Pending incoming swarm connection limit.

§max_pending_outgoing_connections: u32

Pending outgoing swarm connection limit.

§temporary_bans_cache_size: u32

How many temporarily banned unreachable peers to keep in memory.

§temporary_ban_backoff: ExponentialBackoff

Backoff policy for temporary banning of unreachable peers.

§libp2p_metrics: Option<Metrics>

Optional libp2p prometheus metrics. None will disable metrics gathering.

§metrics: Option<SubspaceMetrics>

Internal prometheus metrics. None will disable metrics gathering.

§protocol_version: String

Defines protocol version for the network peers. Affects network partition.

§bootstrap_addresses: Vec<Multiaddr>

Addresses to bootstrap Kademlia network

§kademlia_mode: KademliaMode

Kademlia mode. The default value is set to Static(Client). The peer won’t add its address to other peers` Kademlia routing table. Changing this behaviour implies that a peer can provide pieces to others.

§external_addresses: Vec<Multiaddr>

Known external addresses to the local peer. The addresses will be added on the swarm start and enable peer to notify others about its reachable address.

Implementations§

Source§

impl Config

Source

pub fn new( protocol_version: String, keypair: Keypair, prometheus_registry: Option<&mut Registry>, ) -> Self

Creates a new Config. Applies a subspace-specific version prefix to the protocol_version.

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

This default can only be used for dev networks. Other networks should use Config::new() to apply the correct prefix to the protocol version.

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl !Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeSendSync for T