chore: fix staticcheck errors

This commit is contained in:
Steven Allen
2021-05-07 18:16:46 -07:00
parent 141f163d72
commit 9243a830cb
18 changed files with 82 additions and 1567 deletions

View File

@@ -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