mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-20 17:29:32 +00:00
dns resolution
This commit is contained in:
parent
51b12ea648
commit
cae051ba6f
@ -13,7 +13,6 @@ import
|
||||
chronicles,
|
||||
chronos,
|
||||
eth/keys,
|
||||
|
||||
stew/byteutils,
|
||||
results,
|
||||
metrics,
|
||||
@ -28,6 +27,7 @@ import
|
||||
peerid,
|
||||
protobuf/minprotobuf,
|
||||
extended_peer_record,
|
||||
nameresolving/dnsresolver,
|
||||
]
|
||||
import
|
||||
waku/[
|
||||
@ -319,17 +319,21 @@ proc processInput(rfd: AsyncFD, rng: crypto.Rng) {.async.} =
|
||||
builder.withNodeKey(nodeKey)
|
||||
builder.withRecord(record)
|
||||
|
||||
builder
|
||||
.withNetworkConfigurationDetails(
|
||||
conf.listenAddress,
|
||||
Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||
extIp,
|
||||
extTcpPort,
|
||||
wsBindPort = Port(uint16(conf.websocketPort) + conf.portsShift),
|
||||
wsEnabled = conf.websocketSupport,
|
||||
wssEnabled = conf.websocketSecureSupport,
|
||||
)
|
||||
.tryGet()
|
||||
let netConf = NetConfig.init(
|
||||
bindIp = conf.listenAddress,
|
||||
bindPort = Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||
extIp = extIp,
|
||||
extPort = extTcpPort,
|
||||
dnsNameServers = @[parseIpAddress("1.1.1.1"), parseIpAddress("1.0.0.1")],
|
||||
).valueOR:
|
||||
error "invalid network configuration", error
|
||||
quit(QuitFailure)
|
||||
|
||||
let nameResolver =
|
||||
DnsResolver.new(conf.dnsAddrsNameServers.mapIt(initTAddress(it, Port(53))))
|
||||
|
||||
builder.withNetworkConfiguration(netConf)
|
||||
builder.withSwitchConfiguration(nameResolver = nameResolver)
|
||||
builder.build().tryGet()
|
||||
|
||||
if conf.relay:
|
||||
|
||||
@ -116,6 +116,17 @@ type Chat2DiscoConf* = object ## General node config
|
||||
name: "websocket-secure-support"
|
||||
.}: bool
|
||||
|
||||
## DNS Resolution config
|
||||
dnsAddrsNameServers* {.
|
||||
desc:
|
||||
"DNS name server IPs to query for DNS multiaddrs resolution. Argument may be repeated.",
|
||||
defaultValue: @[
|
||||
IpAddress(family: IpAddressFamily.IPv4, address_v4: [1'u8, 1, 1, 1]),
|
||||
IpAddress(family: IpAddressFamily.IPv4, address_v4: [1'u8, 0, 0, 1]),
|
||||
],
|
||||
name: "dns-addrs-name-server"
|
||||
.}: seq[IpAddress]
|
||||
|
||||
## Kademlia Discovery config
|
||||
kadBootstrapNodes* {.
|
||||
desc:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user