NetworkConfig class
Network configuration for the IPFS node.
Defines listen addresses, bootstrap peers, connection limits, and other networking parameters.
Example:
final config = NetworkConfig(
listenAddresses: ['/ip4/0.0.0.0/tcp/4001'],
maxConnections: 100,
);
Constructors
-
NetworkConfig({List<
String> listenAddresses = defaultListenAddresses, List<String> bootstrapPeers = defaultBootstrapPeers, int maxConnections = 50, Duration connectionTimeout = const Duration(seconds: 30), bool enableNatTraversal = false, bool enableMDNS = true, String? nodeId, String? delegatedRoutingEndpoint}) - Creates a network configuration with the given options.
-
NetworkConfig.fromJson(Map<
String, dynamic> json) -
Creates a network configuration from a JSON map.
factory
-
NetworkConfig.withGeneratedId({List<
String> listenAddresses = defaultListenAddresses, List<String> bootstrapPeers = defaultBootstrapPeers, int maxConnections = 50, Duration connectionTimeout = const Duration(seconds: 30), bool enableNatTraversal = false, bool enableMDNS = true}) -
Creates a network configuration with the given options and a generated Peer ID.
factory
Properties
-
bootstrapPeers
→ List<
String> -
Peers to connect to on startup.
final
- connectionTimeout → Duration
-
Timeout for connection attempts.
final
- delegatedRoutingEndpoint → String?
-
Optional HTTP endpoint for delegated routing.
final
- enableMDNS → bool
-
Whether to enable mDNS for local peer discovery. Defaults to true.
final
- enableNatTraversal → bool
-
Whether to enable NAT traversal (UPnP/NAT-PMP). Defaults to false for security.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
listenAddresses
→ List<
String> -
Addresses to listen on for incoming connections.
final
- maxConnections → int
-
Maximum number of concurrent connections.
final
- nodeId → String
-
Unique identifier for this node.
final
- 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
-
toJson(
) → Map< String, dynamic> - Converts the network configuration to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
defaultBootstrapPeers
→ const List<
String> - Default IPFS bootstrap peers.
-
defaultListenAddresses
→ const List<
String> - Default multiaddr listen addresses for TCP.