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

Commit

Permalink
Merge pull request #20 from raulk/feat/helper
Browse files Browse the repository at this point in the history
Helper to get PeerInfo from Host
  • Loading branch information
raulk authored Oct 24, 2018
2 parents 5e19768 + 16daa76 commit e758e0c
Showing 1 changed file with 11 additions and 0 deletions.
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(),
}
}

0 comments on commit e758e0c

Please sign in to comment.