Struct P2PConfig

Source
pub struct P2PConfig {
Show 20 fields pub laddr: String, pub external_address: String, pub seeds: Vec<String>, pub persistent_peers: Vec<String>, pub upnp: bool, pub local_net: bool, pub max_num_inbound_peers: u64, pub max_num_outbound_peers: u64, pub unconditional_peer_ids: Vec<String>, pub persistent_peers_max_dial_period: Duration, pub flush_throttle_timeout: Duration, pub max_packet_msg_payload_size: u64, pub send_rate: u64, pub recv_rate: u64, pub pex: bool, pub seed_mode: bool, pub private_peer_ids: Vec<String>, pub allow_duplicate_ip: bool, pub handshake_timeout: Duration, pub dial_timeout: Duration,
}

Fields§

§laddr: String

Address to listen for incoming connections.

§external_address: String

Address to advertise to peers for them to dial If empty, will use the same port as the laddr, and will introspect on the listener or use UPnP to figure out the address. ip and port are required example: 159.89.10.97:26656

§seeds: Vec<String>

List of seeds

§persistent_peers: Vec<String>

List of persistent peers.

§upnp: bool

UPNP port forwarding

§local_net: bool

Private or local net.

§max_num_inbound_peers: u64

Maximum number of inbound peers

§max_num_outbound_peers: u64

Maximum number of outbound peers to connect to, excluding persistent peers

§unconditional_peer_ids: Vec<String>

List of node IDs, to which a connection will be (re)established ignoring any existing limits

§persistent_peers_max_dial_period: Duration

Maximum pause when redialing a persistent peer (if zero, exponential backoff is used)

§flush_throttle_timeout: Duration

Time to wait before flushing messages out on the connection

§max_packet_msg_payload_size: u64

Maximum size of a message packet payload, in bytes

§send_rate: u64

Rate at which packets can be sent, in bytes/second

§recv_rate: u64

Rate at which packets can be received, in bytes/second

§pex: bool

Set true to enable the peer-exchange reactor

§seed_mode: bool

Seed mode, in which node constantly crawls the network and looks for peers. If another node asks it for addresses, it responds and disconnects.

Does not work if the peer-exchange reactor is disabled.

§private_peer_ids: Vec<String>

Comma separated list of peer IDs to keep private (will not be gossiped to other peers)

§allow_duplicate_ip: bool

Toggle to disable guard against peers connecting from the same ip.

§handshake_timeout: Duration

Peer connection configuration.

§dial_timeout: Duration

Implementations§

Source§

impl P2PConfig

Source

pub fn laddr(self, laddr: &str) -> Self

Source

pub fn external_address(self, external_address: &str) -> Self

Source

pub fn seeds(self, seeds: Vec<String>) -> Self

Source

pub fn persistent_peers(self, persistent_peers: Vec<String>) -> Self

Source

pub fn upnp(self, upnp: bool) -> Self

Source

pub fn local_net(self, local_net: bool) -> Self

Source

pub fn max_num_inbound_peers(self, max_num_inbound_peers: u64) -> Self

Source

pub fn max_num_outbound_peers(self, max_num_outbound_peers: u64) -> Self

Source

pub fn unconditional_peer_ids(self, unconditional_peer_ids: Vec<String>) -> Self

Source

pub fn persistent_peers_max_dial_period( self, persistent_peers_max_dial_period: Duration, ) -> Self

Source

pub fn flush_throttle_timeout(self, flush_throttle_timeout: Duration) -> Self

Source

pub fn send_rate(self, send_rate: u64) -> Self

Source

pub fn recv_rate(self, recv_rate: u64) -> Self

Source

pub fn pex(self, pex: bool) -> Self

Source

pub fn seed_mode(self, seed_mode: bool) -> Self

Source

pub fn private_peer_ids(self, private_peer_ids: Vec<String>) -> Self

Source

pub fn allow_duplicate_ip(self, allow_duplicate_ip: bool) -> Self

Source

pub fn handshake_timeout(self, handshake_timeout: Duration) -> Self

Source

pub fn dial_timeout(self, dial_timeout: Duration) -> Self

Trait Implementations§

Source§

impl Clone for P2PConfig

Source§

fn clone(&self) -> P2PConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for P2PConfig

Source§

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

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

impl Default for P2PConfig

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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