Config class

Config describes a set of settings for a libp2p node

This is not a stable interface. Use the options defined in the root package.

Available extensions

Constructors

Config()

Properties

addrsFactory ↔ AddrsFactory?
getter/setter pair
ambientAutoNATConfig ↔ AmbientAutoNATv2Config?
getter/setter pair
autoNATv2Options ↔ List<AutoNATv2Option>
getter/setter pair
connManager ↔ ConnManager?
getter/setter pair
dialTimeout ↔ Duration
getter/setter pair
disableObservedAddrManager ↔ bool?
getter/setter pair
disableSignedPeerRecord ↔ bool?
getter/setter pair
enableAutoNAT ↔ bool
Whether the AutoNAT service runs. A Config made directly has it off; Libp2p.new_ turns it on unless an option or an assignment set it.
getter/setter pair
enableAutoNATv2Server ↔ bool
Whether the AutoNAT v2 service also answers other peers' reachability checks (the server). Only used when enableAutoNAT is true. Turn it off on a host that is usually behind NAT, such as a phone: each check costs a dial-back, and a dial-back that fails because of this host's own network reports the other peer's address as unreachable. The host still checks its own reachability (the client).
getter/setter pair
enableAutoRelay ↔ bool
getter/setter pair
enableHolePunching ↔ bool
getter/setter pair
enablePing ↔ bool
getter/setter pair
enableRelay ↔ bool
getter/setter pair
enableStunNatDetection ↔ bool
Whether the host asks two STUN servers whether its NAT maps UDP like a cone or like a symmetric NAT (see StunNatTypeProbe), at start and every 10 minutes. Off by default, because it contacts the STUN servers in stunServers (Google's when null). The result is published as EvtNATDeviceTypeChanged; with a symmetric NAT, a hole punch makes one attempt instead of three.
getter/setter pair
eventBus ↔ EventBus?
getter/setter pair
forceReachability ↔ Reachability?
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
identifyProtocolVersion ↔ String?
getter/setter pair
identifyUserAgent ↔ String?
getter/setter pair
insecure ↔ bool
Whether to use insecure connections (no security)
getter/setter pair
isAutoNATSet → bool
Whether an option or an assignment set enableAutoNAT.
no setter
listenAddrs ↔ List<MultiAddr>
List of addresses to listen on
getter/setter pair
muxers ↔ List<StreamMuxer>
List of stream multiplexers to use
getter/setter pair
natManagerFactory ↔ NATManager Function(Network)?
getter/setter pair
negotiationTimeout ↔ Duration?
getter/setter pair
observedAddrActivationThreshold ↔ int?
getter/setter pair
peerKey ↔ KeyPair?
The private key for this node
getter/setter pair
protocolVersion ↔ String?
The protocol version that identifies the family of protocols used by the peer in the Identify protocol.
getter/setter pair
relayDialTimeout ↔ Duration
getter/setter pair
relayMetricsObserver ↔ RelayMetricsObserver?
getter/setter pair
relayServers ↔ List<String>
getter/setter pair
resourceLimiter ↔ Limiter?
The limiter of the host's resource manager. Null gives a ConfigurableLimiter with LimiterConfig.defaults. Use FixedLimiter for no limits. Cannot be set with resourceManager.
getter/setter pair
resourceManager ↔ ResourceManager?
The host's resource manager. Null makes a ResourceManagerImpl with resourceLimiter. The host closes it when the host closes. Cannot be set with resourceLimiter.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityProtocols ↔ List<SecurityProtocol>
List of security protocols to use
getter/setter pair
stunServers ↔ List<({String host, int port})>?
The STUN servers for enableStunNatDetection; null uses StunClientPool.defaultStunServers.
getter/setter pair
transports ↔ List<Transport>
List of transports to use
getter/setter pair
userAgent ↔ String?
The identifier this node will send to other peers when identifying itself, e.g. via the identify protocol.
getter/setter pair

Methods

apply(List<Option> opts) → Future<void>
Apply applies the given options to the config, returning the first error encountered (if any).
newNode() → Future<Host>
Creates a new libp2p Host from the Config.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withAddrsFactory(AddrsFactory factory) → Future<void>

Available on Config, provided by the ConfigOptions extension

withAmbientAutoNAT(AmbientAutoNATv2Config conf) → Future<void>

Available on Config, provided by the ConfigOptions extension

withAutoNAT(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to enable/disable the AutoNAT service.
withAutoNATv2AllowPrivateAddrs() → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 to allow private addresses (for testing)
withAutoNATv2AmplificationAttackPreventionDialWait(Duration duration) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 amplification attack prevention dial wait time
withAutoNATv2DataRequestPolicy(DataRequestPolicyFunc policy) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 with a custom data request policy
withAutoNATv2MetricsTracer(MetricsTracer metricsTracer) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 with a metrics tracer
withAutoNATv2Options(List<AutoNATv2Option> options) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 with specific options
withAutoNATv2Server(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures whether AutoNAT v2 answers other peers' reachability checks. See enableAutoNATv2Server.
withAutoNATv2ServerRateLimit(int rpm, int perPeerRPM, int dialDataRPM) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures AutoNATv2 server rate limits
withAutoRelay(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

withConnManager(ConnManager manager) → Future<void>

Available on Config, provided by the ConfigOptions extension

withDialTimeout(Duration timeout) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures the dial timeout for direct connections.
withEventBus(EventBus bus) → Future<void>

Available on Config, provided by the ConfigOptions extension

withHolePunching(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to enable/disable the Hole Punching service.
withIdentifyDisableObservedAddrManager(bool disable) → Future<void>

Available on Config, provided by the ConfigOptions extension

withIdentifyDisableSignedPeerRecord(bool disable) → Future<void>

Available on Config, provided by the ConfigOptions extension

withIdentifyProtocolVersion(String version) → Future<void>

Available on Config, provided by the ConfigOptions extension

withIdentifyUserAgent(String agent) → Future<void>

Available on Config, provided by the ConfigOptions extension

withIdentity(KeyPair keyPair) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given identity (private key).
withListenAddrs(List<MultiAddr> addrs) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given addresses.
withMuxer(String id, Multiplexer muxerFactory(Conn secureConn, bool isClient)) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given stream multiplexer.
withNatManager(NATManager factory(Network)) → Future<void>

Available on Config, provided by the ConfigOptions extension

withNegotiationTimeout(Duration timeout) → Future<void>

Available on Config, provided by the ConfigOptions extension

withNoSecurity() → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use no security (insecure connections).
withObservedAddrActivationThreshold(int threshold) → Future<void>

Available on Config, provided by the ConfigOptions extension

withPing(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to enable/disable the Ping service.
withProtocolVersion(String version) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given protocol version.
withReachability(Reachability r) → Future<void>

Available on Config, provided by the ConfigOptions extension

withRelay(bool enabled) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to enable/disable the Relay service.
withRelayDialTimeout(Duration timeout) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures the dial timeout for relay connections.
withRelayServers(List<String> servers) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures relay servers to automatically connect to during startup
withResourceLimiter(Limiter limiter) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures the limiter of the host's resource manager. See Config.resourceLimiter.
withResourceManager(ResourceManager manager) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures the host's resource manager. See Config.resourceManager.
withSecurity(SecurityProtocol securityProtocol) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given security protocol.
withStunNatDetection(bool enabled, {List<({String host, int port})>? servers}) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures STUN NAT type detection. See enableStunNatDetection.
withTransport(Transport transport) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given transport.
withUserAgent(String agent) → Future<void>

Available on Config, provided by the ConfigOptions extension

Configures libp2p to use the given user agent.

Operators

operator ==(Object other) → bool
The equality operator.
inherited