mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-10-05 08:07:18 +08:00
chore: fix staticcheck errors
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peerstore"
|
||||
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
manet "github.com/multiformats/go-multiaddr-net"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
)
|
||||
|
||||
// Protocol defines the libp2p protocol that we will use for the libp2p proxy
|
||||
@@ -65,7 +65,7 @@ func NewProxyService(h host.Host, proxyAddr ma.Multiaddr, dest peer.ID) *ProxySe
|
||||
fmt.Println("Proxy server is ready")
|
||||
fmt.Println("libp2p-peer addresses:")
|
||||
for _, a := range h.Addrs() {
|
||||
fmt.Printf("%s/ipfs/%s\n", a, peer.IDB58Encode(h.ID()))
|
||||
fmt.Printf("%s/ipfs/%s\n", a, peer.Encode(h.ID()))
|
||||
}
|
||||
|
||||
return &ProxyService{
|
||||
@@ -206,7 +206,7 @@ func addAddrToPeerstore(h host.Host, addr string) peer.ID {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
peerid, err := peer.IDB58Decode(pid)
|
||||
peerid, err := peer.Decode(pid)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
@@ -214,7 +214,7 @@ func addAddrToPeerstore(h host.Host, addr string) peer.ID {
|
||||
// Decapsulate the /ipfs/<peerID> part from the target
|
||||
// /ip4/<a.b.c.d>/ipfs/<peer> becomes /ip4/<a.b.c.d>
|
||||
targetPeerAddr, _ := ma.NewMultiaddr(
|
||||
fmt.Sprintf("/ipfs/%s", peer.IDB58Encode(peerid)))
|
||||
fmt.Sprintf("/ipfs/%s", peer.Encode(peerid)))
|
||||
targetAddr := ipfsaddr.Decapsulate(targetPeerAddr)
|
||||
|
||||
// We have a peer ID and a targetAddr so we add
|
||||
|
Reference in New Issue
Block a user