Struct Config
pub struct Config { /* private fields */ }tcp only.Expand description
The configuration for a TCP/IP transport capability for libp2p.
Implementations§
§impl Config
impl Config
pub fn new() -> Config
pub fn new() -> Config
Creates a new configuration for a TCP/IP transport:
- Nagle’s algorithm is disabled, i.e.
TCP_NODELAYenabled. SeeConfig::nodelay. - Reuse of listening ports is disabled. See
Config::port_reuse. - No custom
IP_TTLis set. The default of the OS TCP stack applies. SeeConfig::ttl. - The size of the listen backlog for new listening sockets is
1024. SeeConfig::listen_backlog.
pub fn listen_backlog(self, backlog: u32) -> Config
pub fn listen_backlog(self, backlog: u32) -> Config
Configures the listen backlog for new listen sockets.
pub fn port_reuse(self, _port_reuse: bool) -> Config
👎Deprecated since 0.42.0: This option does nothing now, since the port reuse policy is now decided on a per-connection basis by the behaviour. The function will be removed in a future release.
pub fn port_reuse(self, _port_reuse: bool) -> Config
Configures port reuse for local sockets, which implies reuse of listening ports for outgoing connections to enhance NAT traversal capabilities.
§Deprecation Notice
The new implementation works on a per-connection basis, defined by the behaviour. This removes the necessity to configure the transport for port reuse, instead the behaviour requiring this behaviour can decide whether to use port reuse or not.
The API to configure port reuse is part of Transport and the option can be found in
libp2p_core::transport::DialOpts.
If PortUse::Reuse is enabled, the transport will try to reuse the local port of the
listener. If that’s not possible, i.e. there is no listener or the transport doesn’t allow
a direct control over ports, a new port (or the default behaviour) is used. If port reuse
is enabled for a connection, this option will be treated on a best-effort basis.
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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