mirror of https://github.com/waku-org/nwaku.git
chore(wakucanary): resolve dns (#1271)
This commit is contained in:
parent
5046a4b3da
commit
d5acb6aab2
|
@ -36,4 +36,11 @@ A node that can't be reached.
|
||||||
$ ./build/wakucanary --address=/ip4/8.210.222.231/tcp/1000/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD --protocol=store --protocol=filter
|
$ ./build/wakucanary --address=/ip4/8.210.222.231/tcp/1000/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD --protocol=store --protocol=filter
|
||||||
$ echo $?
|
$ echo $?
|
||||||
1
|
1
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that a domain name can also be used.
|
||||||
|
```console
|
||||||
|
$ ./build/wakucanary --address=/dns4/node-01.do-ams3.status.test.statusim.net/tcp/30303/p2p/16Uiu2HAkukebeXjTQ9QDBeNDWuGfbaSg79wkkhK4vPocLgR6QFDf --protocol=store --protocol=filter
|
||||||
|
$ echo $?
|
||||||
|
0
|
||||||
```
|
```
|
|
@ -6,7 +6,9 @@ import
|
||||||
chronicles/topics_registry
|
chronicles/topics_registry
|
||||||
import
|
import
|
||||||
libp2p/protocols/ping,
|
libp2p/protocols/ping,
|
||||||
libp2p/crypto/[crypto, secp]
|
libp2p/crypto/[crypto, secp],
|
||||||
|
libp2p/nameresolving/nameresolver,
|
||||||
|
libp2p/nameresolving/dnsresolver
|
||||||
import
|
import
|
||||||
../../waku/v2/node/peer_manager/peer_manager,
|
../../waku/v2/node/peer_manager/peer_manager,
|
||||||
../../waku/v2/utils/peers,
|
../../waku/v2/utils/peers,
|
||||||
|
@ -81,6 +83,13 @@ proc areProtocolsSupported(
|
||||||
proc main(): Future[int] {.async.} =
|
proc main(): Future[int] {.async.} =
|
||||||
let conf: WakuCanaryConf = WakuCanaryConf.load()
|
let conf: WakuCanaryConf = WakuCanaryConf.load()
|
||||||
|
|
||||||
|
# create dns resolver
|
||||||
|
let
|
||||||
|
nameServers = @[
|
||||||
|
initTAddress(ValidIpAddress.init("1.1.1.1"), Port(53)),
|
||||||
|
initTAddress(ValidIpAddress.init("1.0.0.1"), Port(53))]
|
||||||
|
resolver: DnsResolver = DnsResolver.new(nameServers)
|
||||||
|
|
||||||
if conf.logLevel != LogLevel.NONE:
|
if conf.logLevel != LogLevel.NONE:
|
||||||
setLogLevel(conf.logLevel)
|
setLogLevel(conf.logLevel)
|
||||||
|
|
||||||
|
@ -103,7 +112,8 @@ proc main(): Future[int] {.async.} =
|
||||||
node = WakuNode.new(
|
node = WakuNode.new(
|
||||||
nodeKey,
|
nodeKey,
|
||||||
ValidIpAddress.init("0.0.0.0"),
|
ValidIpAddress.init("0.0.0.0"),
|
||||||
Port(60000))
|
Port(60000),
|
||||||
|
nameResolver = resolver)
|
||||||
|
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue