DHTConfig class
Configuration options for the DHT (Distributed Hash Table)
This class holds settings for Kademlia DHT operations, such as lookup parallelization, bucket sizes, and request timeouts.
Constructors
- DHTConfig({String protocolId = '/ipfs/kad/1.0.0', int alpha = 3, int bucketSize = 20, int maxProvidersPerKey = 20, Duration requestTimeout = const Duration(seconds: 30), int maxRecordsPerQuery = 20, bool enableProviderRecording = true, bool enableValueStorage = true, bool validateProviderRecords = true, bool reproviderEnabled = true, Duration reproviderInterval = const Duration(hours: 12), String reproviderStrategy = 'pinned', int reproviderBatchSize = 100, int reproviderConcurrency = 10, bool reproviderSweepOptimization = true})
-
Creates a new DHTConfig with default Kademlia settings.
const
-
DHTConfig.fromJson(Map<
String, dynamic> json) -
Creates a DHTConfig from JSON.
factory
Properties
- alpha → int
-
Number of parallel lookups (alpha value in Kademlia).
final
- bucketSize → int
-
Size of k-buckets.
final
- enableProviderRecording → bool
-
Whether to enable provider recording.
final
- enableValueStorage → bool
-
Whether to enable value storage.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxProvidersPerKey → int
-
Maximum number of providers to store per key.
final
- maxRecordsPerQuery → int
-
Maximum number of records to return per query.
final
- protocolId → String
-
Protocol identifier for DHT.
final
- reproviderBatchSize → int
-
Maximum number of CIDs to announce in a single batch.
final
- reproviderConcurrency → int
-
Maximum number of concurrent in-flight provide announcements.
final
- reproviderEnabled → bool
-
Whether the periodic reprovider service is enabled.
final
- reproviderInterval → Duration
-
Interval between automatic reprovide runs.
final
- reproviderStrategy → String
-
Reprovide strategy name (e.g.
pinned,roots,all,pinned+mfs,unique,entities).final - reproviderSweepOptimization → bool
-
Whether to enable XOR-ordered proximity grouping for reprovides.
final
- requestTimeout → Duration
-
Time to wait before considering a request as failed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validateProviderRecords → bool
-
Whether to validate incoming provider records for address sanity and
freshness before trusting them.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts the config to JSON.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited