subspace_networking

Struct Config

source
pub struct Config<LocalRecordProvider> {
Show 26 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 local_records_provider: LocalRecordProvider, 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.

§local_records_provider: LocalRecordProvider

Externally provided implementation of the local records provider

§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<LocalRecordProvider> Config<LocalRecordProvider>
where LocalRecordProvider: LocalRecordProvider,

source

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

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

Trait Implementations§

source§

impl<LocalRecordProvider> Debug for Config<LocalRecordProvider>

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<LocalRecordProvider> Freeze for Config<LocalRecordProvider>
where LocalRecordProvider: Freeze,

§

impl<LocalRecordProvider> !RefUnwindSafe for Config<LocalRecordProvider>

§

impl<LocalRecordProvider> Send for Config<LocalRecordProvider>
where LocalRecordProvider: Send,

§

impl<LocalRecordProvider> !Sync for Config<LocalRecordProvider>

§

impl<LocalRecordProvider> Unpin for Config<LocalRecordProvider>
where LocalRecordProvider: Unpin,

§

impl<LocalRecordProvider> !UnwindSafe for Config<LocalRecordProvider>

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> JsonSchemaMaybe for T