In all public aquadoggo configuration APIs peers can be addressed by IP address or domain name, in the case of the later, before making a connection attempt we need to do a DNS lookup to get the correct socket address. When the node is offline then we want to silently ignore failed lookups, just log the attempt and continue. Currently we only perform lookup when a node starts and we parse the configuration file, but later we want to introduce redials of relays and direct nodes, this will require us to perform the DNS lookup later (it may have failed on startup).
This PR just introduces a new struct PeerAddress with two methods socket and quic_multiaddr which help us handle still unresolved peer addresses. When socket is called and successfully resolves the peer address string to a SocketAddr the result is cached and directly used on later calls in order to avoid unnecessary DNS lookups.
closes: #613
📋 Checklist
[x] Add tests that cover your changes
[x] Add this PR to the Unreleased section in CHANGELOG.md
In all public aquadoggo configuration APIs peers can be addressed by IP address or domain name, in the case of the later, before making a connection attempt we need to do a DNS lookup to get the correct socket address. When the node is offline then we want to silently ignore failed lookups, just log the attempt and continue. Currently we only perform lookup when a node starts and we parse the configuration file, but later we want to introduce redials of relays and direct nodes, this will require us to perform the DNS lookup later (it may have failed on startup).
This PR just introduces a new struct
PeerAddress
with two methodssocket
andquic_multiaddr
which help us handle still unresolved peer addresses. Whensocket
is called and successfully resolves the peer address string to aSocketAddr
the result is cached and directly used on later calls in order to avoid unnecessary DNS lookups.closes: #613
📋 Checklist
CHANGELOG.md