mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-04-24 22:32:13 +00:00
make Protocols variadic, for usability
This commit is contained in:
parent
d94deae41d
commit
3b148d2b88
@ -13,7 +13,6 @@ import (
|
||||
|
||||
opts "github.com/libp2p/go-libp2p-kad-dht/opts"
|
||||
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
|
||||
"github.com/libp2p/go-libp2p-protocol"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
u "github.com/ipfs/go-ipfs-util"
|
||||
@ -1082,7 +1081,7 @@ func TestGetSetPluggedProtocol(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
os := []opts.Option{
|
||||
opts.Protocols([]protocol.ID{"/esh/dht"}),
|
||||
opts.Protocols("/esh/dht"),
|
||||
opts.Client(false),
|
||||
opts.NamespacedValidator("v", blankValidator{}),
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ func NamespacedValidator(ns string, v record.Validator) Option {
|
||||
// Protocols sets the protocols for the DHT
|
||||
//
|
||||
// Defaults to dht.DefaultProtocols
|
||||
func Protocols(protocols []protocol.ID) Option {
|
||||
func Protocols(protocols ...protocol.ID) Option {
|
||||
return func(o *Options) error {
|
||||
o.Protocols = protocols
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user