llarp::dns::Resolver_Base

handler of dns query hooking intercepts dns for internal processing

#include <server.hpp>

Inherited by llarp::handlers::ExitEndpoint, llarp::handlers::TunEndpoint

Public Functions

Name
virtual ~Resolver_Base() =default
bool operator<(const Resolver_Base & other) const
less than via rank
bool operator>(const Resolver_Base & other) const
greater than via rank
virtual std::optional< SockAddr > GetLocalAddr() const
get local socket address that queries are sent from
virtual std::string_view ResolverName() const =0
get printable name
virtual void ResetResolver(std::optional< std::vector< SockAddr > > replace_upstream =std::nullopt)
reset the resolver state, optionally replace upstream info with new info.
virtual void Down()
cancel all pending requests and cease further operation. Default operation is a no-op.
virtual bool MaybeHookDNS(std::shared_ptr< PacketSource_Base > source, const Message & query, const SockAddr & to, const SockAddr & from) =0
attempt to handle a dns message returns true if we consumed this query and it should not be processed again

Protected Functions

Name
virtual int Rank() const =0
return the sorting order for this resolver lower means it will be tried first

Public Functions Documentation

function ~Resolver_Base

virtual ~Resolver_Base() =default

function operator<

inline bool operator<(
    const Resolver_Base & other
) const

less than via rank

function operator>

inline bool operator>(
    const Resolver_Base & other
) const

greater than via rank

function GetLocalAddr

inline virtual std::optional< SockAddr > GetLocalAddr() const

get local socket address that queries are sent from

function ResolverName

virtual std::string_view ResolverName() const =0

get printable name

Reimplemented by: llarp::handlers::ExitEndpoint::ResolverName, llarp::handlers::TunEndpoint::ResolverName

function ResetResolver

inline virtual void ResetResolver(
    std::optional< std::vector< SockAddr > > replace_upstream =std::nullopt
)

reset the resolver state, optionally replace upstream info with new info.

The default base implementation does nothing.

function Down

inline virtual void Down()

cancel all pending requests and cease further operation. Default operation is a no-op.

function MaybeHookDNS

virtual bool MaybeHookDNS(
    std::shared_ptr< PacketSource_Base > source,
    const Message & query,
    const SockAddr & to,
    const SockAddr & from
) =0

attempt to handle a dns message returns true if we consumed this query and it should not be processed again

Reimplemented by: llarp::handlers::ExitEndpoint::MaybeHookDNS, llarp::handlers::TunEndpoint::MaybeHookDNS

Protected Functions Documentation

function Rank

virtual int Rank() const =0

return the sorting order for this resolver lower means it will be tried first

Reimplemented by: llarp::handlers::ExitEndpoint::Rank, llarp::handlers::TunEndpoint::Rank


Updated on 2026-01-10 at 22:49:45 +0000