Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
1d3554e6
Commit
1d3554e6
authored
Dec 31, 2014
by
Juan Batiz-Benet
Browse files
peerstore: AddPeerInfo
parent
57b79033
Changes
1
Hide whitespace changes
Inline
Side-by-side
peer/peerstore.go
View file @
1d3554e6
...
@@ -26,6 +26,9 @@ type Peerstore interface {
...
@@ -26,6 +26,9 @@ type Peerstore interface {
// that peer, useful to other services.
// that peer, useful to other services.
PeerInfo
(
ID
)
PeerInfo
PeerInfo
(
ID
)
PeerInfo
// AddPeerInfo absorbs the information listed in given PeerInfo.
AddPeerInfo
(
PeerInfo
)
// Get/Put is a simple registry for other peer-related key/value pairs.
// Get/Put is a simple registry for other peer-related key/value pairs.
// if we find something we use often, it should become its own set of
// if we find something we use often, it should become its own set of
// methods. this is a last resort.
// methods. this is a last resort.
...
@@ -235,6 +238,10 @@ func (ps *peerstore) PeerInfo(p ID) PeerInfo {
...
@@ -235,6 +238,10 @@ func (ps *peerstore) PeerInfo(p ID) PeerInfo {
}
}
}
}
func
(
ps
*
peerstore
)
AddPeerInfo
(
pi
PeerInfo
)
{
ps
.
AddAddresses
(
pi
.
ID
,
pi
.
Addrs
)
}
func
PeerInfos
(
ps
Peerstore
,
peers
[]
ID
)
[]
PeerInfo
{
func
PeerInfos
(
ps
Peerstore
,
peers
[]
ID
)
[]
PeerInfo
{
pi
:=
make
([]
PeerInfo
,
len
(
peers
))
pi
:=
make
([]
PeerInfo
,
len
(
peers
))
for
i
,
p
:=
range
peers
{
for
i
,
p
:=
range
peers
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment