-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Circuit relay #3112
chore: Circuit relay #3112
Changes from 19 commits
46721c1
034b9dc
7fe1057
2fc9637
f415a98
7c30a04
dfe23b4
b0b48bd
8d2fcd3
3e2a1d5
7112afc
748b083
da6bdc1
7e8511c
16bdcb0
28f317b
50905f0
49771f6
7af2425
3f784cc
d69b626
16cf26b
eae4e8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{.used.} | ||
|
||
import | ||
std/[sequtils, strutils], | ||
std/[sequtils, strutils, net], | ||
stew/byteutils, | ||
stew/shims/net as stewNet, | ||
testutils/unittests, | ||
|
@@ -169,7 +169,7 @@ suite "WakuNode": | |
nodeKey = generateSecp256k1Key() | ||
bindIp = parseIpAddress("0.0.0.0") | ||
bindPort = Port(61006) | ||
extIp = some(parseIpAddress("127.0.0.1")) | ||
extIp = some(parseIpAddress($getPrimaryIPAddr())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks so much! I've applied your suggestions and much more cleaner now:) |
||
extPort = some(Port(61008)) | ||
node = newTestWakuNode(nodeKey, bindIp, bindPort, extIp, extPort) | ||
|
||
|
@@ -205,7 +205,7 @@ suite "WakuNode": | |
nodeKey = generateSecp256k1Key() | ||
bindIp = parseIpAddress("0.0.0.0") | ||
bindPort = Port(61010) | ||
extIp = some(parseIpAddress("127.0.0.1")) | ||
extIp = some(parseIpAddress($getPrimaryIPAddr())) | ||
extPort = some(Port(61012)) | ||
domainName = "example.com" | ||
expectedDns4Addr = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import | ||
chronos, | ||
chronicles, | ||
bearssl/rand, | ||
libp2p/protocols/connectivity/autonat/client, | ||
libp2p/protocols/connectivity/autonat/service, | ||
libp2p/protocols/connectivity/autonat/core | ||
|
||
const AutonatCheckInterval = Opt.some(chronos.seconds(30)) | ||
|
||
proc getAutonatService*(rng: ref HmacDrbgContext): AutonatService = | ||
## AutonatService request other peers to dial us back | ||
## flagging us as Reachable or NotReachable. | ||
## minConfidence is used as threshold to determine the state. | ||
## If maxQueueSize > numPeersToAsk past samples are considered | ||
## in the calculation. | ||
let autonatService = AutonatService.new( | ||
autonatClient = AutonatClient.new(), | ||
rng = rng, | ||
scheduleInterval = AutonatCheckInterval, | ||
askNewConnectedPeers = false, | ||
numPeersToAsk = 3, | ||
maxQueueSize = 3, | ||
minConfidence = 0.7, | ||
) | ||
|
||
proc statusAndConfidenceHandler( | ||
networkReachability: NetworkReachability, confidence: Opt[float] | ||
): Future[void] {.async.} = | ||
if confidence.isSome(): | ||
info "Peer reachability status", | ||
networkReachability = networkReachability, confidence = confidence.get() | ||
|
||
autonatService.statusAndConfidenceHandler(statusAndConfidenceHandler) | ||
|
||
return autonatService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think getPrimaryIPAddr can be used here directly... no need to convert to string and than from string.