mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-04-25 14:52:14 +00:00
* upgraded the protocol id to version 2 (i.e. /kad/2.0.0) and made it so v2 peers running in server mode respond to queries from v1 peers. Note: v2 peers will only send queries using the v2 protocol, will only add v2 peers to their routing tables, and will only tell v1 peers about v2 peers. * to run a forked network we now use network specific protocol prefixes instead of manually setting protocol IDs. Use the ProtocolPrefix option instead of the Protocols option. * emit errors during initialization if the user misuses the default protocol prefix by setting parameters inconsistent with the default protocol's network specification * since the Client option has been deprecated it's been removed from the dht's options. While deprecated it is still available in the dht options package. Setting `Client(false)` now puts the node into ModeAuto.
69 lines
2.0 KiB
Go
69 lines
2.0 KiB
Go
// Deprecated: Options are now defined in the root package.
|
|
|
|
package dhtopts
|
|
|
|
import (
|
|
"time"
|
|
|
|
ds "github.com/ipfs/go-datastore"
|
|
"github.com/libp2p/go-libp2p-kad-dht"
|
|
"github.com/libp2p/go-libp2p-record"
|
|
)
|
|
|
|
type Option = dht.Option
|
|
|
|
// Deprecated: use dht.RoutingTableLatencyTolerance
|
|
func RoutingTableLatencyTolerance(latency time.Duration) dht.Option {
|
|
return dht.RoutingTableLatencyTolerance(latency)
|
|
}
|
|
|
|
// Deprecated: use dht.RoutingTableRefreshQueryTimeout
|
|
func RoutingTableRefreshQueryTimeout(timeout time.Duration) dht.Option {
|
|
return dht.RoutingTableRefreshQueryTimeout(timeout)
|
|
}
|
|
|
|
// Deprecated: use dht.RoutingTableRefreshPeriod
|
|
func RoutingTableRefreshPeriod(period time.Duration) dht.Option {
|
|
return dht.RoutingTableRefreshPeriod(period)
|
|
}
|
|
|
|
// Deprecated: use dht.Datastore
|
|
func Datastore(ds ds.Batching) dht.Option { return dht.Datastore(ds) }
|
|
|
|
// Client configures whether or not the DHT operates in client-only mode.
|
|
//
|
|
// Defaults to false (which is ModeAuto).
|
|
// Deprecated: use dht.Mode(ModeClient)
|
|
func Client(only bool) dht.Option {
|
|
if only {
|
|
return dht.Mode(dht.ModeClient)
|
|
}
|
|
return dht.Mode(dht.ModeAuto)
|
|
}
|
|
|
|
// Deprecated: use dht.Mode
|
|
func Mode(m dht.ModeOpt) dht.Option { return dht.Mode(m) }
|
|
|
|
// Deprecated: use dht.Validator
|
|
func Validator(v record.Validator) dht.Option { return dht.Validator(v) }
|
|
|
|
// Deprecated: use dht.NamespacedValidator
|
|
func NamespacedValidator(ns string, v record.Validator) dht.Option {
|
|
return dht.NamespacedValidator(ns, v)
|
|
}
|
|
|
|
// Deprecated: use dht.BucketSize
|
|
func BucketSize(bucketSize int) dht.Option { return dht.BucketSize(bucketSize) }
|
|
|
|
// Deprecated: use dht.MaxRecordAge
|
|
func MaxRecordAge(maxAge time.Duration) dht.Option { return dht.MaxRecordAge(maxAge) }
|
|
|
|
// Deprecated: use dht.DisableAutoRefresh
|
|
func DisableAutoRefresh() dht.Option { return dht.DisableAutoRefresh() }
|
|
|
|
// Deprecated: use dht.DisableProviders
|
|
func DisableProviders() dht.Option { return dht.DisableProviders() }
|
|
|
|
// Deprecated: use dht.DisableValues
|
|
func DisableValues() dht.Option { return dht.DisableValues() }
|