mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 18:57:57 +08:00
Merge pull request #6355 from ipfs/fix/6354
commands/swarm(fix): handle empty multiaddrs
This commit is contained in:
commit
cf3b6c43d2
@ -357,14 +357,22 @@ var p2pCloseCmd = &cmds.Command{
|
|||||||
|
|
||||||
proto := protocol.ID(protoOpt)
|
proto := protocol.ID(protoOpt)
|
||||||
|
|
||||||
listen, err := ma.NewMultiaddr(listenOpt)
|
var (
|
||||||
if err != nil {
|
target, listen ma.Multiaddr
|
||||||
return err
|
)
|
||||||
|
|
||||||
|
if l {
|
||||||
|
listen, err = ma.NewMultiaddr(listenOpt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target, err := ma.NewMultiaddr(targetOpt)
|
if t {
|
||||||
if err != nil {
|
target, err = ma.NewMultiaddr(targetOpt)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !(closeAll || p || l || t) {
|
if !(closeAll || p || l || t) {
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -98,7 +98,7 @@ require (
|
|||||||
github.com/miekg/dns v1.1.10 // indirect
|
github.com/miekg/dns v1.1.10 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/mr-tron/base58 v1.1.2
|
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-dns v0.0.2
|
||||||
github.com/multiformats/go-multiaddr-net v0.0.1
|
github.com/multiformats/go-multiaddr-net v0.0.1
|
||||||
github.com/multiformats/go-multibase v0.0.1
|
github.com/multiformats/go-multibase v0.0.1
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -598,8 +598,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.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
|
||||||
github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s=
|
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.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
|
||||||
github.com/multiformats/go-multiaddr v0.0.3 h1:/m5AmBtzEOIb9aY6o5pVuSwZeeCWrFks1MlqYsmHlBs=
|
github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4=
|
||||||
github.com/multiformats/go-multiaddr v0.0.3/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
|
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.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 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8=
|
||||||
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
|
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user