helpers.go 259 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
package host

import "github.com/libp2p/go-libp2p-core/peer"

// InfoFromHost returns a peer.AddrInfo struct with the Host's ID and all of its Addrs.
func InfoFromHost(h Host) *peer.AddrInfo {
	return &peer.AddrInfo{
		ID:    h.ID(),
		Addrs: h.Addrs(),
	}
}