llarp::dns::Server

Inherits from std::enable_shared_from_this< Server >

Public Functions

Name
virtual ~Server() =default
Server(EventLoop_ptr loop, llarp::DnsConfig conf, unsigned int netif_index)
std::vector< SockAddr > BoundPacketSourceAddrs() const
returns all sockaddr we have from all of our PacketSources
std::optional< SockAddr > FirstBoundPacketSourceAddr() const
returns the first sockaddr we have on our packet sources if we have one
void AddResolver(std::weak_ptr< Resolver_Base > resolver)
add a resolver to this packet handler, does not share ownership
void AddPacketSource(std::weak_ptr< PacketSource_Base > resolver)
add a packet source to this server, does not share ownership
virtual std::shared_ptr< PacketSource_Base > MakePacketSourceOn(const SockAddr & bindaddr, const llarp::DnsConfig & conf)
create a packet source bound on bindaddr but does not add it
virtual void Start()
sets up all internal binds and such and begins operation
virtual void Stop()
stops all operation
virtual void Reset()
reset the internal state
virtual std::shared_ptr< Resolver_Base > MakeDefaultResolver()
create the default resolver for out config
std::vector< std::weak_ptr< Resolver_Base > > GetAllResolvers() const
bool MaybeHandlePacket(std::shared_ptr< PacketSource_Base > pktsource, const SockAddr & resolver, const SockAddr & from, llarp::OwnedBuffer buf)
feed a packet buffer from a packet source.
void SetDNSMode(bool all_queries)
set which dns mode we are in.

Protected Functions

Name
void AddPacketSource(std::shared_ptr< PacketSource_Base > resolver)
add a packet source to this server, does share ownership
void AddResolver(std::shared_ptr< Resolver_Base > resolver)
add a resolver to this packet handler, does share ownership
virtual std::shared_ptr< I_Platform > CreatePlatform() const
create the platform dependant dns stuff

Protected Attributes

Name
EventLoop_ptr m_Loop
llarp::DnsConfig m_Config
std::shared_ptr< I_Platform > m_Platform

Public Functions Documentation

function ~Server

virtual ~Server() =default

function Server

explicit Server(
    EventLoop_ptr loop,
    llarp::DnsConfig conf,
    unsigned int netif_index
)

function BoundPacketSourceAddrs

std::vector< SockAddr > BoundPacketSourceAddrs() const

returns all sockaddr we have from all of our PacketSources

function FirstBoundPacketSourceAddr

std::optional< SockAddr > FirstBoundPacketSourceAddr() const

returns the first sockaddr we have on our packet sources if we have one

function AddResolver

void AddResolver(
    std::weak_ptr< Resolver_Base > resolver
)

add a resolver to this packet handler, does not share ownership

function AddPacketSource

void AddPacketSource(
    std::weak_ptr< PacketSource_Base > resolver
)

add a packet source to this server, does not share ownership

function MakePacketSourceOn

virtual std::shared_ptr< PacketSource_Base > MakePacketSourceOn(
    const SockAddr & bindaddr,
    const llarp::DnsConfig & conf
)

create a packet source bound on bindaddr but does not add it

function Start

virtual void Start()

sets up all internal binds and such and begins operation

function Stop

virtual void Stop()

stops all operation

function Reset

virtual void Reset()

reset the internal state

function MakeDefaultResolver

virtual std::shared_ptr< Resolver_Base > MakeDefaultResolver()

create the default resolver for out config

function GetAllResolvers

std::vector< std::weak_ptr< Resolver_Base > > GetAllResolvers() const

function MaybeHandlePacket

bool MaybeHandlePacket(
    std::shared_ptr< PacketSource_Base > pktsource,
    const SockAddr & resolver,
    const SockAddr & from,
    llarp::OwnedBuffer buf
)

feed a packet buffer from a packet source.

returns true if we decided to process the packet and consumed it returns false if we dont want to process the packet

function SetDNSMode

void SetDNSMode(
    bool all_queries
)

set which dns mode we are in.

true for intercepting all queries. false for just .loki and .snode

Protected Functions Documentation

function AddPacketSource

void AddPacketSource(
    std::shared_ptr< PacketSource_Base > resolver
)

add a packet source to this server, does share ownership

function AddResolver

void AddResolver(
    std::shared_ptr< Resolver_Base > resolver
)

add a resolver to this packet handler, does share ownership

function CreatePlatform

virtual std::shared_ptr< I_Platform > CreatePlatform() const

create the platform dependant dns stuff

Protected Attributes Documentation

variable m_Loop

EventLoop_ptr m_Loop;

variable m_Config

llarp::DnsConfig m_Config;

variable m_Platform

std::shared_ptr< I_Platform > m_Platform;

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