diff --git a/api/api_common.go b/api/api_common.go index 0c20d0ad9..69b2df17a 100644 --- a/api/api_common.go +++ b/api/api_common.go @@ -4,11 +4,9 @@ import ( "context" "fmt" + "github.com/filecoin-project/go-jsonrpc/auth" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" - - "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/lotus/build" ) @@ -70,5 +68,5 @@ func (v Version) String() string { type NatInfo struct { Reachability network.Reachability - PublicAddr ma.Multiaddr + PublicAddr string } diff --git a/cli/net.go b/cli/net.go index 7a2474bf4..fb902e39c 100644 --- a/cli/net.go +++ b/cli/net.go @@ -222,8 +222,8 @@ var NetReachability = &cli.Command{ } fmt.Println("AutoNAT status: ", i.Reachability.String()) - if i.PublicAddr != nil { - fmt.Println("Public address: ", i.PublicAddr.String()) + if i.PublicAddr != "" { + fmt.Println("Public address: ", i.PublicAddr) } return nil }, diff --git a/node/impl/common/common.go b/node/impl/common/common.go index 73abea8fb..d149486b1 100644 --- a/node/impl/common/common.go +++ b/node/impl/common/common.go @@ -118,12 +118,13 @@ func (a *CommonAPI) NetFindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, func (a *CommonAPI) NetAutoNatStatus(ctx context.Context) (i api.NatInfo, err error) { autonat := a.RawHost.(*basichost.BasicHost).AutoNat - var maddr ma.Multiaddr + var maddr string if autonat.Status() == network.ReachabilityPublic { - maddr, err = autonat.PublicAddr() + pa, err := autonat.PublicAddr() if err != nil { return api.NatInfo{}, err } + maddr = pa.String() } return api.NatInfo{