diff --git a/core/commands/p2p.go b/core/commands/p2p.go index 78aa2cf3211..387b05c3707 100644 --- a/core/commands/p2p.go +++ b/core/commands/p2p.go @@ -357,14 +357,22 @@ var p2pCloseCmd = &cmds.Command{ proto := protocol.ID(protoOpt) - listen, err := ma.NewMultiaddr(listenOpt) - if err != nil { - return err + var ( + target, listen ma.Multiaddr + ) + + if l { + listen, err = ma.NewMultiaddr(listenOpt) + if err != nil { + return err + } } - target, err := ma.NewMultiaddr(targetOpt) - if err != nil { - return err + if t { + target, err = ma.NewMultiaddr(targetOpt) + if err != nil { + return err + } } if !(closeAll || p || l || t) { diff --git a/go.mod b/go.mod index 3ac7a83ea6a..e7e0894a8ef 100644 --- a/go.mod +++ b/go.mod @@ -97,7 +97,7 @@ require ( github.com/miekg/dns v1.1.8 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/mr-tron/base58 v1.1.2 - github.com/multiformats/go-multiaddr v0.0.3 + github.com/multiformats/go-multiaddr v0.0.4 github.com/multiformats/go-multiaddr-dns v0.0.2 github.com/multiformats/go-multiaddr-net v0.0.1 github.com/multiformats/go-multibase v0.0.1 diff --git a/go.sum b/go.sum index a9fe47fd0e9..1f1131b30ca 100644 --- a/go.sum +++ b/go.sum @@ -559,8 +559,8 @@ github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9u github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s= github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.3 h1:/m5AmBtzEOIb9aY6o5pVuSwZeeCWrFks1MlqYsmHlBs= -github.com/multiformats/go-multiaddr v0.0.3/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= +github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=