Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Helper to get PeerInfo from Host #20

Merged
merged 1 commit into from
Oct 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -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(),
}
}