1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

LookupServer: Support multiple nameservers

The configuration key [DNS] Nameserver has been renamed to Nameservers
and accepts a comma-separated list of nameserver addresses, which will
be queried in the given order until a response has been received.

The new default value is still Cloudflare's 1.1.1.1 as well as their
secondary DNS server 1.0.0.1.
This commit is contained in:
Linus Groh 2020-10-25 15:30:44 +00:00 committed by Andreas Kling
parent 2440112d53
commit 7eee39b850
3 changed files with 30 additions and 19 deletions

View file

@ -42,7 +42,7 @@ public:
private:
void load_etc_hosts();
void service_client(RefPtr<Core::LocalSocket>);
Vector<String> lookup(const String& hostname, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes);
Vector<String> lookup(const String& hostname, const String& nameserver, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes);
struct CachedLookup {
DNSQuestion question;
@ -50,7 +50,7 @@ private:
};
RefPtr<Core::LocalServer> m_local_server;
String m_nameserver;
Vector<String> m_nameservers;
HashMap<String, String> m_etc_hosts;
HashMap<String, CachedLookup> m_lookup_cache;
};