Libp2p class

Factory functions for creating options

Constructors

Libp2p()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

addrsFactory(AddrsFactory factory) → Option
ambientAutoNATv2Config(AmbientAutoNATv2Config conf) → Option
autoNAT(bool enabled) → Option
autoNATv2AllowPrivateAddrs() → Option
Configures AutoNATv2 to allow private addresses (for testing)
autoNATv2AmplificationAttackPreventionDialWait(Duration duration) → Option
Configures AutoNATv2 amplification attack prevention dial wait time
autoNATv2DataRequestPolicy(DataRequestPolicyFunc policy) → Option
Configures AutoNATv2 with a custom data request policy
autoNATv2MetricsTracer(MetricsTracer metricsTracer) → Option
Configures AutoNATv2 with a metrics tracer
autoNATv2Options(List<AutoNATv2Option> options) → Option
Configures AutoNATv2 with specific options
autoNATv2Server(bool enabled) → Option
Whether AutoNAT v2 answers other peers' reachability checks. See Config.enableAutoNATv2Server.
autoNATv2ServerRateLimit(int rpm, int perPeerRPM, int dialDataRPM) → Option
Configures AutoNATv2 server rate limits
autoRelay(bool enabled) → Option
connectionGater(ConnGater gater) → Option
Gives the host a connection gater, for example a BasicConnGater with blocked peers, addresses or subnets. As in go-libp2p, the swarm asks it before a dial (ConnGater.interceptPeerDial, ConnGater.interceptAddrDial) and the upgrader and swarm ask it as a connection is accepted, secured and upgraded (ConnGater.interceptAccept, ConnGater.interceptSecured, ConnGater.interceptUpgraded). A rejected connection is closed.
connManager(ConnManager manager) → Option
dialTimeout(Duration timeout) → Option
Configures the dial timeout for direct connections.
eventBus(EventBus bus) → Option
forceReachability(Reachability reachability) → Option
holePunching(bool enabled) → Option
identifyDisableObservedAddrManager(bool disable) → Option
identifyDisableSignedPeerRecord(bool disable) → Option
identifyProtocolVersion(String version) → Option
identifyUserAgent(String agent) → Option
identity(KeyPair keyPair) → Option
Configures libp2p to use the given identity (private key).
listenAddrs(List<MultiAddr> addrs) → Option
Configures libp2p to listen on the given addresses.
muxer(String id, Multiplexer muxerFactory(Conn secureConn, bool isClient)) → Option
Configures libp2p to use the given stream multiplexer.
natManager(NATManager factory(Network)) → Option
negotiationTimeout(Duration timeout) → Option
new_(List<Option> options) → Future<Host>
Creates a new libp2p node with the given options.
newConfig() → Config
Creates a new Config instance.
noSecurity() → Option
Configures libp2p to use no security (insecure connections).
observedAddrActivationThreshold(int threshold) → Option
ping(bool enabled) → Option
Configures libp2p to enable/disable the Ping service.
protocolVersion(String version) → Option
Configures libp2p to use the given protocol version.
relay(bool enabled) → Option
relayDialTimeout(Duration timeout) → Option
Configures the dial timeout for relay connections.
relayMetricsObserver(RelayMetricsObserver observer) → Option
Sets the relay metrics observer for tracking relay client operations
relayServers(List<String> servers) → Option
resourceLimiter(Limiter limiter) → Option
Sets the limits of the host's resource manager. The default is a ConfigurableLimiter with LimiterConfig.defaults; resourceLimiter(FixedLimiter()) removes the limits. See doc/resource-manager.md.
resourceManager(ResourceManager manager) → Option
Gives the host a resource manager, for example ResourceManagerImpl(limiter: ...) or NullResourceManager(). The host closes it when the host closes. Cannot be used with resourceLimiter.
security(SecurityProtocol securityProtocol) → Option
Configures libp2p to use the given security protocol.
stunNatDetection(bool enabled, {List<({String host, int port})>? servers}) → Option
Turns STUN NAT type detection on or off. See Config.enableStunNatDetection.
transport(Transport transport) → Option
Configures libp2p to use the given transport.
userAgent(String agent) → Option
Configures libp2p to use the given user agent.