-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* undo apt install libpcre (not circuit-relay related.) * nat.nim: protect against possible exceptions when calling getExternalIP * new external CLI argument, isRelayClient * waku factory change to mount circuit hop proto by default * waku_node: move autonat_service to a separate module
- Loading branch information
1 parent
268e7e6
commit cfde7ee
Showing
22 changed files
with
304 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.