Skip to content

Commit

Permalink
add ping
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrsantos committed Nov 3, 2023
1 parent b658722 commit 2364698
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hole-punch-interop/impl/nim/hole_punching.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import libp2p/[builders,
protocols/connectivity/autonat/service]
import libp2p/protocols/connectivity/relay/client as rclient
import tests/stubs/autonatclientstub
import libp2p/protocols/ping

proc createSwitch(r: Relay = nil, hpService: Service = nil): Switch =
let rng = newRng()
var builder = SwitchBuilder.new()
.withRng(newRng())
.withRng(rng)
.withAddresses(@[ MultiAddress.init("/ip4/0.0.0.0/tcp/0").tryGet() ])
.withObservedAddrManager(ObservedAddrManager.new(minCount = 1))
.withTcpTransport()
Expand All @@ -28,7 +30,9 @@ proc createSwitch(r: Relay = nil, hpService: Service = nil): Switch =
if r != nil:
builder = builder.withCircuitRelay(r)

return builder.build()
let s = builder.build()
s.mount(Ping.new(rng=rng))
return s

proc main() {.async.} =
let relayClient = RelayClient.new()
Expand Down

0 comments on commit 2364698

Please sign in to comment.