2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: Options are now defined in the root package.
|
|
|
|
|
2018-05-15 19:00:16 +01:00
|
|
|
package dhtopts
|
|
|
|
|
|
|
|
import (
|
2019-09-01 22:10:40 +08:00
|
|
|
"time"
|
2018-05-15 19:00:16 +01:00
|
|
|
|
|
|
|
ds "github.com/ipfs/go-datastore"
|
2020-03-09 13:23:00 -07:00
|
|
|
"github.com/libp2p/go-libp2p-kad-dht"
|
2019-09-01 22:10:40 +08:00
|
|
|
"github.com/libp2p/go-libp2p-record"
|
2018-05-15 19:00:16 +01:00
|
|
|
)
|
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
type Option = dht.Option
|
2020-02-17 20:06:29 +05:30
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.RoutingTableLatencyTolerance
|
|
|
|
func RoutingTableLatencyTolerance(latency time.Duration) dht.Option {
|
|
|
|
return dht.RoutingTableLatencyTolerance(latency)
|
2018-05-15 19:00:16 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.RoutingTableRefreshQueryTimeout
|
|
|
|
func RoutingTableRefreshQueryTimeout(timeout time.Duration) dht.Option {
|
|
|
|
return dht.RoutingTableRefreshQueryTimeout(timeout)
|
2019-09-01 22:10:40 +08:00
|
|
|
}
|
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.RoutingTableRefreshPeriod
|
|
|
|
func RoutingTableRefreshPeriod(period time.Duration) dht.Option {
|
|
|
|
return dht.RoutingTableRefreshPeriod(period)
|
2018-05-15 19:00:16 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.Datastore
|
|
|
|
func Datastore(ds ds.Batching) dht.Option { return dht.Datastore(ds) }
|
2020-03-06 14:56:03 -05:00
|
|
|
|
2020-03-10 02:30:48 -04:00
|
|
|
// 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)
|
|
|
|
}
|
2018-05-15 19:00:16 +01:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.Mode
|
|
|
|
func Mode(m dht.ModeOpt) dht.Option { return dht.Mode(m) }
|
2018-06-01 13:45:34 -07:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.Validator
|
|
|
|
func Validator(v record.Validator) dht.Option { return dht.Validator(v) }
|
2019-10-04 22:12:00 +09:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.NamespacedValidator
|
|
|
|
func NamespacedValidator(ns string, v record.Validator) dht.Option {
|
|
|
|
return dht.NamespacedValidator(ns, v)
|
2019-10-04 22:12:00 +09:00
|
|
|
}
|
2019-11-02 00:37:15 +08:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.BucketSize
|
|
|
|
func BucketSize(bucketSize int) dht.Option { return dht.BucketSize(bucketSize) }
|
2020-02-01 21:57:29 -05:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.MaxRecordAge
|
|
|
|
func MaxRecordAge(maxAge time.Duration) dht.Option { return dht.MaxRecordAge(maxAge) }
|
2019-11-15 10:54:09 +08:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.DisableAutoRefresh
|
|
|
|
func DisableAutoRefresh() dht.Option { return dht.DisableAutoRefresh() }
|
2019-10-30 17:36:30 -07:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.DisableProviders
|
|
|
|
func DisableProviders() dht.Option { return dht.DisableProviders() }
|
2019-10-30 17:36:30 -07:00
|
|
|
|
2020-03-09 13:23:00 -07:00
|
|
|
// Deprecated: use dht.DisableValues
|
|
|
|
func DisableValues() dht.Option { return dht.DisableValues() }
|