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
d7a5d2ec
Commit
d7a5d2ec
authored
Jan 26, 2015
by
Juan Batiz-Benet
Browse files
p2p: own addresses gotten from host
parent
8a2f08f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
net/mock/mock_net.go
View file @
d7a5d2ec
...
@@ -67,11 +67,6 @@ func (mn *mocknet) AddPeer(k ic.PrivKey, a ma.Multiaddr) (host.Host, error) {
...
@@ -67,11 +67,6 @@ func (mn *mocknet) AddPeer(k ic.PrivKey, a ma.Multiaddr) (host.Host, error) {
}
}
h
:=
bhost
.
New
(
n
)
h
:=
bhost
.
New
(
n
)
// make sure to add listening address!
// this makes debugging things simpler as remembering to register
// an address may cause unexpected failure.
n
.
Peerstore
()
.
AddAddress
(
n
.
LocalPeer
(),
a
)
log
.
Debugf
(
"mocknet added listen addr for peer: %s -- %s"
,
n
.
LocalPeer
(),
a
)
log
.
Debugf
(
"mocknet added listen addr for peer: %s -- %s"
,
n
.
LocalPeer
(),
a
)
mn
.
cg
.
AddChildGroup
(
n
.
cg
)
mn
.
cg
.
AddChildGroup
(
n
.
cg
)
...
...
protocol/identify/id.go
View file @
d7a5d2ec
...
@@ -141,17 +141,13 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) {
...
@@ -141,17 +141,13 @@ func (ids *IDService) populateMessage(mes *pb.Identify, c inet.Conn) {
// "public" address, at least in relation to us.
// "public" address, at least in relation to us.
mes
.
ObservedAddr
=
c
.
RemoteMultiaddr
()
.
Bytes
()
mes
.
ObservedAddr
=
c
.
RemoteMultiaddr
()
.
Bytes
()
// set listen addrs
// set listen addrs, get our latest addrs from Host.
laddrs
,
err
:=
ids
.
Host
.
Network
()
.
InterfaceListenAddresses
()
laddrs
:=
ids
.
Host
.
Addrs
()
if
err
!=
nil
{
mes
.
ListenAddrs
=
make
([][]
byte
,
len
(
laddrs
))
log
.
Error
(
err
)
for
i
,
addr
:=
range
laddrs
{
}
else
{
mes
.
ListenAddrs
[
i
]
=
addr
.
Bytes
()
mes
.
ListenAddrs
=
make
([][]
byte
,
len
(
laddrs
))
for
i
,
addr
:=
range
laddrs
{
mes
.
ListenAddrs
[
i
]
=
addr
.
Bytes
()
}
log
.
Debugf
(
"%s sent listen addrs to %s: %s"
,
c
.
LocalPeer
(),
c
.
RemotePeer
(),
laddrs
)
}
}
log
.
Debugf
(
"%s sent listen addrs to %s: %s"
,
c
.
LocalPeer
(),
c
.
RemotePeer
(),
laddrs
)
// set protocol versions
// set protocol versions
s
:=
IpfsVersion
.
String
()
s
:=
IpfsVersion
.
String
()
...
...
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