示例#1
0
文件: main.go 项目: rdterner/go-ipfs
func toPeerInfo(bootstrap config.BootstrapPeer) (p peer.PeerInfo, err error) {
	p = peer.PeerInfo{
		ID:    bootstrap.ID(),
		Addrs: []ma.Multiaddr{bootstrap.Multiaddr()},
	}
	return p, nil
}
示例#2
0
func toPeerInfo(bp config.BootstrapPeer) peer.PeerInfo {
	// for now, we drop the "ipfs addr" part of the multiaddr. the rest
	// of the codebase currently uses addresses without the peerid part.
	m := bp.Multiaddr()
	s := ma.Split(m)
	m = ma.Join(s[:len(s)-1]...)

	return peer.PeerInfo{
		ID:    bp.ID(),
		Addrs: []ma.Multiaddr{m},
	}
}