/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "ClientConnection.h" #include "DNSName.h" #include "DNSPacket.h" #include "DNSServer.h" #include "MulticastDNS.h" #include #include #include namespace LookupServer { class DNSAnswer; class LookupServer final : public Core::Object { C_OBJECT(LookupServer); public: static LookupServer& the(); Vector lookup(const DNSName& name, DNSRecordType record_type); private: LookupServer(); void load_etc_hosts(); void put_in_cache(const DNSAnswer&); Vector lookup(const DNSName& hostname, const String& nameserver, bool& did_get_response, DNSRecordType record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); OwnPtr> m_server; RefPtr m_dns_server; RefPtr m_mdns; Vector m_nameservers; RefPtr m_file_watcher; HashMap, DNSName::Traits> m_etc_hosts; HashMap, DNSName::Traits> m_lookup_cache; }; }