Skip to content

Commit

Permalink
make Protocols variadic, for usability
Browse files Browse the repository at this point in the history
  • Loading branch information
laser committed Jun 1, 2018
1 parent d94deae commit 3b148d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dht_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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{}),
}
Expand Down
2 changes: 1 addition & 1 deletion opts/options.go
Expand Up @@ -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
Expand Down

0 comments on commit 3b148d2

Please sign in to comment.