Use p2p protocol name over ipfs for multiaddr

This commit is contained in:
Kishan Mohanbhai Sagathiya 2019-08-11 19:06:45 +05:30
parent 00e78a6b6d
commit c6192cebf4
4 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ func apiMAddr(a *rest.API) ma.Multiaddr {
}
func peerMAddr(a *rest.API) ma.Multiaddr {
ipfsAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/ipfs/%s", peer.IDB58Encode(a.Host().ID())))
ipfsAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s", peer.IDB58Encode(a.Host().ID())))
for _, a := range a.Host().Addrs() {
if _, err := a.ValueForProtocol(ma.P_IP4); err == nil {
return a.Encapsulate(ipfsAddr)

View File

@ -35,7 +35,7 @@ func StringsToPeers(strs []string) []peer.ID {
// peer ID is bad.
func MustLibp2pMultiaddrJoin(addr Multiaddr, p peer.ID) Multiaddr {
v := addr.Value()
pidAddr, err := ma.NewMultiaddr("/ipfs/" + peer.IDB58Encode(p))
pidAddr, err := ma.NewMultiaddr("/p2p/" + peer.IDB58Encode(p))
// let this break badly
if err != nil {
panic("called MustLibp2pMultiaddrJoin with bad peer!")

View File

@ -58,7 +58,7 @@ responses in a user-readable format. The location of the IPFS
Cluster server is assumed to be %s, but can be
configured with the --host option. To use the secure libp2p-http
API endpoint, use "--host" with the full cluster libp2p listener
address (including the "/ipfs/<peerID>" part), and --secret (the
address (including the "/p2p/<peerID>" part), and --secret (the
32-byte cluster secret as it appears in the cluster configuration).
For feedback, bug reports or any additional information, visit

View File

@ -28,7 +28,7 @@ func clean(pm *Manager) {
}
func testAddr(loc string, pid peer.ID) ma.Multiaddr {
m, _ := ma.NewMultiaddr(loc + "/ipfs/" + peer.IDB58Encode(pid))
m, _ := ma.NewMultiaddr(loc + "/p2p/" + peer.IDB58Encode(pid))
return m
}