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
cc2dd220
Commit
cc2dd220
authored
Oct 24, 2018
by
vyzo
Browse files
make randezvous key a constant
parent
2993fd9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
p2p/host/relay/autorelay.go
View file @
cc2dd220
...
@@ -20,6 +20,10 @@ import (
...
@@ -20,6 +20,10 @@ import (
manet
"github.com/multiformats/go-multiaddr-net"
manet
"github.com/multiformats/go-multiaddr-net"
)
)
const
(
RelayRenezvous
=
"/libp2p/relay"
)
var
(
var
(
DesiredRelays
=
3
DesiredRelays
=
3
...
@@ -121,7 +125,7 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) {
...
@@ -121,7 +125,7 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) {
}
}
dctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
60
*
time
.
Second
)
dctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
60
*
time
.
Second
)
pis
,
err
:=
discovery
.
FindPeers
(
dctx
,
h
.
discover
,
"/libp2p/relay"
,
limit
)
pis
,
err
:=
discovery
.
FindPeers
(
dctx
,
h
.
discover
,
RelayRenezvous
,
limit
)
cancel
()
cancel
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Debugf
(
"error discovering relays: %s"
,
err
.
Error
())
log
.
Debugf
(
"error discovering relays: %s"
,
err
.
Error
())
...
...
p2p/host/relay/relay.go
View file @
cc2dd220
...
@@ -25,7 +25,7 @@ func NewRelayHost(ctx context.Context, bhost *basic.BasicHost, advertise discove
...
@@ -25,7 +25,7 @@ func NewRelayHost(ctx context.Context, bhost *basic.BasicHost, advertise discove
advertise
:
advertise
,
advertise
:
advertise
,
}
}
bhost
.
AddrsFactory
=
h
.
hostAddrs
bhost
.
AddrsFactory
=
h
.
hostAddrs
discovery
.
Advertise
(
ctx
,
advertise
,
"/libp2p/relay"
)
discovery
.
Advertise
(
ctx
,
advertise
,
RelayRenezvous
)
return
h
return
h
}
}
...
...
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