diff --git a/helpers.go b/helpers.go new file mode 100644 index 0000000..17f97ea --- /dev/null +++ b/helpers.go @@ -0,0 +1,11 @@ +package host + +import pstore "github.com/libp2p/go-libp2p-peerstore" + +// PeerInfoFromHost returns a PeerInfo struct with the Host's ID and all of its Addrs. +func PeerInfoFromHost(h Host) *pstore.PeerInfo { + return &pstore.PeerInfo{ + ID: h.ID(), + Addrs: h.Addrs(), + } +}