This package was introduced at a time when multiaddr didn't support "ipfs" (or libp2p) addresses. Please use SplitAddr
and AddrInfoFromP2pAddrs
from github.com/libp2p/go-libp2p-peer
.
A parsing utility for ipfs multiaddrs.
make install
import "github.com/ipfs/go-ipfs-addr"
addrstr := "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
a, _ := ipfsaddr.ParseString(addr)
fmt.Println("peer id: ", a.ID())
fmt.Println("transport multiaddr: ", a.Transport())
PRs are welcome!
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Whyrusleeping