llarp::handlers::NullEndpoint

Inherits from llarp::service::Endpoint, std::enable_shared_from_this< NullEndpoint >, llarp::path::Builder, llarp::service::ILookupHolder, llarp::service::IDataHandler, llarp::EndpointBase, llarp::path::PathSet

Public Functions

Name
NullEndpoint(AbstractRouter * r, llarp::service::Context * parent)
virtual bool HandleInboundPacket(const service::ConvoTag tag, const llarp_buffer_t & pkt, service::ProtocolType t, uint64_t seqno) override
handle packet io from service node or hidden service to frontend
virtual std::string GetIfName() const override
virtual path::PathSet_ptr GetSelf() override
get a shared_ptr of ourself
virtual std::weak_ptr< path::PathSet > GetWeak() override
get a weak_ptr of ourself
virtual bool SupportsV6() const override
virtual void SendPacketToRemote(const llarp_buffer_t & , service::ProtocolType ) override
net::ipv6addr_t ObtainIPForAddr(std::variant< service::Address, RouterID > ) override
virtual std::optional< std::variant< service::Address, RouterID > > ObtainAddrForIP(net::ipv6addr_t ip) const override
get a key for ip address
virtual vpn::EgresPacketRouter * EgresPacketRouter() override

Additional inherited members

Public Types inherited from llarp::service::Endpoint

Name
using std::deque< PendingBuffer > PendingBufferQueue
using std::function< void(Address, OutboundContext *)> PathEnsureHook
using std::function< void(const RouterID, exit::BaseSession_ptr, ConvoTag)> SNodeEnsureHook

Protected Types inherited from llarp::service::Endpoint

Name
using std::unordered_map< ConvoTag, Session > ConvoMap

Public Functions inherited from llarp::service::Endpoint

Name
Endpoint(AbstractRouter * r, Context * parent)
~Endpoint() override
bool IsReady() const
return true if we are ready to recv packets from the void.
virtual void QueueRecvData(RecvDataEvent ev) override
bool IntrosetIsStale() const
return true if our introset has expired intros
virtual std::unordered_map< std::string, std::string > NotifyParams() const
construct parameters for notify hooks
void SetHandler(IDataHandler * h)
virtual bool Configure(const NetworkConfig & conf, const DnsConfig & dnsConf)
virtual void Tick(llarp_time_t now) override
tick owned paths
virtual bool HasIfAddr() const
return true if we have a resolvable ip address
std::optional< ConvoTag > GetBestConvoTagFor(std::variant< Address, RouterID > addr) const override
virtual net::ipv6addr_t GetIfAddr() const
get our ifaddr if it is set
virtual std::optional< net::TrafficPolicy > GetExitPolicy() const
get the exit policy for our exit if we have one override me
virtual std::set< IPRange > GetOwnedRanges() const
get the ip ranges we claim to own override me
virtual void Thaw()
virtual void ResetInternalState() override
reset all cooldown timers
virtual const EventLoop_ptr & Loop() override
loop (via router) use when sending any data on a path
AbstractRouter * Router()
virtual bool LoadKeyFile()
virtual bool Start()
virtual std::string Name() const override
get the "name" of this pathset
virtual AddressVariant_t LocalAddress() const override
get our local address
virtual std::optional< SendStat > GetStatFor(AddressVariant_t remote) const override
get statistics about how much traffic we sent and recv'd to a remote endpoint
virtual std::unordered_set< AddressVariant_t > AllRemoteEndpoints() const override
list all remote endpoint addresses we have that are mapped
virtual bool ShouldPublishDescriptors(llarp_time_t now) const override
return true if we should publish a new hidden service descriptor
virtual void SRVRecordsChanged() override
called when srv data changes in some way
virtual void HandlePathDied(path::Path_ptr path) override
a path died now what?
virtual vpn::NetworkInterface * GetVPNInterface()
virtual bool PublishIntroSet(const EncryptedIntroSet & i, AbstractRouter * r) override
bool PublishIntroSetVia(const EncryptedIntroSet & i, AbstractRouter * r, path::Path_ptr p, uint64_t relayOrder)
virtual bool HandleGotIntroMessage(std::shared_ptr< const dht::GotIntroMessage > ) override
override me in subtype
virtual bool HandleGotRouterMessage(std::shared_ptr< const dht::GotRouterMessage > ) override
override me in subtype
virtual bool HandleGotNameMessage(std::shared_ptr< const dht::GotNameMessage > ) override
override me in subtype
bool HandleHiddenServiceFrame(path::Path_ptr p, const service::ProtocolFrame & msg)
void SetEndpointAuth(std::shared_ptr< IAuthPolicy > policy)
void SetAuthInfoForEndpoint(Address remote, AuthInfo info)
sets how we authenticate with remote address
bool HasPendingPathToService(const Address & remote) const
return true if we have a pending job to build to a hidden service but it's not done yet
virtual bool HandleDataMessage(path::Path_ptr path, const PathID_t from, std::shared_ptr< ProtocolMessage > msg) override
bool ProcessDataMessage(std::shared_ptr< ProtocolMessage > msg)
void EnsureRouterIsKnown(const RouterID & router)
ensure that we know a router, looks up if it doesn't
bool LookupRouterAnon(RouterID router, RouterLookupHandler handler)
lookup a router via closest path
void LookupNameAsync(std::string name, std::function< void(std::optional< std::variant< Address, RouterID > >)> resultHandler) override
virtual void LookupServiceAsync(std::string name, std::string service, std::function< void(std::vector< dns::SRVData >)> resultHandler) override
lookup srv records async
virtual void Pump(llarp_time_t now)
called on event loop pump
virtual bool Stop() override
stop this endpoint
const Identity & GetIdentity() const
void MapExitRange(IPRange range, service::Address exit)
void UnmapExitRange(IPRange range)
void UnmapRangeByExit(IPRange range, std::string exit)
void map_exit(std::string name, std::string token, std::vector< IPRange > ranges, std::function< void(bool, std::string)> result)
virtual void PutLookup(IServiceLookup * lookup, uint64_t txid) override
virtual void HandlePathBuilt(path::Path_ptr path) override
bool HandleDataDrop(path::Path_ptr p, const PathID_t & dst, uint64_t s)
bool CheckPathIsDead(path::Path_ptr p, llarp_time_t latency)
size_t RemoveAllConvoTagsFor(service::Address remote)
virtual bool WantsOutboundSession(const Address & addr) const override
do we want a session outbound to addr
virtual void MarkAddressOutbound(AddressVariant_t ) override
this MUST be called if you want to call EnsurePathTo on the given address
virtual bool ShouldBundleRC() const override
should we bundle RCs in builds?
virtual void BlacklistSNode(const RouterID snode) override
virtual std::optional< std::variant< Address, RouterID > > GetEndpointWithConvoTag(ConvoTag t) const override
maybe get an endpoint variant given its convo tag
virtual bool HasConvoTag(const ConvoTag & t) const override
virtual bool ShouldBuildMore(llarp_time_t now) const override
return true if we should build another path
virtual llarp_time_t PathAlignmentTimeout() const
bool EnsurePathTo(std::variant< Address, RouterID > addr, std::function< void(std::optional< ConvoTag >)> hook, llarp_time_t timeout) override
bool EnsurePathToService(const Address remote, PathEnsureHook h, llarp_time_t timeoutMS =DefaultPathEnsureTimeout)
return false if we have already called this function before for this address
void InformPathToService(const Address remote, OutboundContext * ctx)
bool EnsurePathToSNode(const RouterID remote, SNodeEnsureHook h)
ensure a path to a service node by public key
bool HasPendingRouterLookup(const RouterID remote) const
return true if this endpoint is trying to lookup this router right now
bool HasPathToSNode(const RouterID remote) const
bool HasFlowToService(const Address remote) const
virtual void PutSenderFor(const ConvoTag & tag, const ServiceInfo & info, bool inbound) override
virtual bool HasInboundConvo(const Address & addr) const override
virtual bool HasOutboundConvo(const Address & addr) const override
virtual bool GetCachedSessionKeyFor(const ConvoTag & remote, SharedSecret & secret) const override
virtual void PutCachedSessionKeyFor(const ConvoTag & remote, const SharedSecret & secret) override
virtual bool GetSenderFor(const ConvoTag & remote, ServiceInfo & si) const override
virtual void PutIntroFor(const ConvoTag & remote, const Introduction & intro) override
virtual bool GetIntroFor(const ConvoTag & remote, Introduction & intro) const override
virtual void RemoveConvoTag(const ConvoTag & remote) override
virtual void ConvoTagTX(const ConvoTag & tag) override
called when we send data to remote on a convotag
virtual void ConvoTagRX(const ConvoTag & tag) override
called when we got data from remote on a convotag
virtual void PutReplyIntroFor(const ConvoTag & remote, const Introduction & intro) override
virtual bool GetReplyIntroFor(const ConvoTag & remote, Introduction & intro) const override
virtual bool GetConvoTagsForService(const Address & si, std::set< ConvoTag > & tag) const override
void PutNewOutboundContext(const IntroSet & introset, llarp_time_t timeLeftToAlign)
std::optional< uint64_t > GetSeqNoForConvo(const ConvoTag & tag)
size_t UniqueEndpoints() const
count unique endpoints we are talking to
bool HasExit() const
virtual std::optional< std::vector< RouterContact > > GetHopsForBuild() override
std::optional< std::vector< RouterContact > > GetHopsForBuildWithEndpoint(RouterID endpoint)
virtual void PathBuildStarted(path::Path_ptr path) override
virtual void IntroSetPublishFail()
virtual void IntroSetPublished()
void AsyncProcessAuthMessage(std::shared_ptr< ProtocolMessage > msg, std::function< void(AuthResult)> hook)
void SendAuthResult(path::Path_ptr path, PathID_t replyPath, ConvoTag tag, AuthResult st)
uint64_t GenTXID()
void ResetConvoTag(ConvoTag tag, path::Path_ptr path, PathID_t from)
const std::set< RouterID > & SnodeBlacklist() const
virtual bool SendToOrQueue(ConvoTag tag, const llarp_buffer_t & payload, ProtocolType t) override
bool SendToOrQueue(const std::variant< Address, RouterID > & addr, const llarp_buffer_t & payload, ProtocolType t)
bool SendToOrQueue(const Address & addr, const llarp_buffer_t & payload, ProtocolType t)
bool SendToOrQueue(const RouterID & addr, const llarp_buffer_t & payload, ProtocolType t)
std::optional< AuthInfo > MaybeGetAuthInfoForEndpoint(service::Address addr)

Protected Functions inherited from llarp::service::Endpoint

Name
void RegenAndPublishIntroSet()
IServiceLookup * GenerateLookupByTag(const Tag & tag)
void PrefetchServicesByTag(const Tag & tag)
bool ReadyToDoLookup(size_t num_paths) const
path::Path::UniqueEndpointSet_t GetUniqueEndpointsForLookup() const
void FlushRecvData()
const IntroSet & introSet() const
IntroSet & introSet()
const ConvoMap & Sessions() const
ConvoMap & Sessions()

Public Attributes inherited from llarp::service::Endpoint

Name
constexpr auto DefaultPathEnsureTimeout
SendMessageQueue_t m_SendQueue

Protected Attributes inherited from llarp::service::Endpoint

Name
Context *const context
parent context that owns this endpoint
IDataHandler * m_DataHandler
Identity m_Identity
net::IPRangeMap< service::Address > m_ExitMap
bool m_PublishIntroSet
std::unique_ptr< EndpointState > m_state
std::shared_ptr< IAuthPolicy > m_AuthPolicy
std::unordered_map< Address, AuthInfo > m_RemoteAuthInfos
std::unordered_map< std::string, std::pair< std::optional< IPRange >, std::optional< AuthInfo > > > m_StartupLNSMappings
(lns name, optional exit range, optional auth info) for looking up on startup
RecvPacketQueue_t m_InboundTrafficQueue
thread::Queue< RecvDataEvent > m_RecvQueue
util::DecayingHashSet< Address > m_IntrosetLookupFilter
for rate limiting introset lookups

Friends inherited from llarp::service::Endpoint

Name
struct EndpointUtil

Public Functions inherited from llarp::path::Builder

Name
Builder(AbstractRouter * p_router, size_t numDesiredPaths, size_t numHops)
construct
virtual ~Builder() =default
virtual bool ShouldBuildMore(llarp_time_t now) const override
return true if we should build another path
virtual bool ShouldBundleRC() const =0
should we bundle RCs in builds?
virtual void ResetInternalState() override
reset all cooldown timers
bool BuildCooldownHit(llarp_time_t now) const
return true if we hit our soft limit for building paths too fast
virtual PathRole GetRoles() const
get roles for this path builder
BuildStats CurrentBuildStats() const
virtual bool Stop() override
stop this pathset and mark it as to be removed
virtual bool IsStopped() const override
return true if we are stopped
virtual bool ShouldRemove() const override
return true if we can and should remove this pathset and underlying resources from its parent context
virtual llarp_time_t Now() const override
get time from event loop
virtual void Tick(llarp_time_t now) override
tick owned paths
virtual void BuildOne(PathRole roles =ePathRoleAny) override
virtual bool BuildOneAlignedTo(const RouterID endpoint) override
std::optional< std::vector< RouterContact > > GetHopsAlignedToForBuild(RouterID endpoint, const std::set< RouterID > & exclude ={})
virtual void Build(std::vector< RouterContact > hops, PathRole roles =ePathRoleAny) override
manual build on these hops
std::optional< RouterContact > SelectFirstHop(const std::set< RouterID > & exclude ={}) const
pick a first hop
virtual std::optional< std::vector< RouterContact > > GetHopsForBuild() override
void ManualRebuild(size_t N, PathRole roles =ePathRoleAny)
virtual const SecretKey & GetTunnelEncryptionSecretKey() const
virtual void HandlePathBuilt(Path_ptr p) override
virtual void HandlePathBuildTimeout(Path_ptr p) override
virtual void HandlePathBuildFailedAt(Path_ptr p, RouterID hop) override

Protected Functions inherited from llarp::path::Builder

Name
virtual bool UrgentBuild(llarp_time_t now) const
bool BuildCooldownHit(RouterID edge) const
return true if we hit our soft limit for building paths too fast on a first hop

Public Attributes inherited from llarp::path::Builder

Name
AbstractRouter *const m_router
SecretKey enckey
size_t numHops
llarp_time_t lastBuild
llarp_time_t buildIntervalLimit

Protected Attributes inherited from llarp::path::Builder

Name
std::atomic< bool > _run
flag for PathSet::Stop()

Public Functions inherited from llarp::service::ILookupHolder

Name
virtual void PutLookup(IServiceLookup * l, uint64_t txid) =0

Public Functions inherited from llarp::service::IDataHandler

Name
virtual bool HandleDataMessage(path::Path_ptr path, const PathID_t from, std::shared_ptr< ProtocolMessage > msg) =0
virtual bool GetCachedSessionKeyFor(const ConvoTag & remote, SharedSecret & secret) const =0
virtual void PutCachedSessionKeyFor(const ConvoTag & remote, const SharedSecret & secret) =0
virtual void ConvoTagTX(const ConvoTag & tag) =0
called when we send data to remote on a convotag
virtual void ConvoTagRX(const ConvoTag & tag) =0
called when we got data from remote on a convotag
virtual void RemoveConvoTag(const ConvoTag & remote) =0
virtual bool HasConvoTag(const ConvoTag & remote) const =0
virtual void PutSenderFor(const ConvoTag & remote, const ServiceInfo & si, bool inbound) =0
virtual bool GetSenderFor(const ConvoTag & remote, ServiceInfo & si) const =0
virtual void PutIntroFor(const ConvoTag & remote, const Introduction & intro) =0
virtual bool GetIntroFor(const ConvoTag & remote, Introduction & intro) const =0
virtual void PutReplyIntroFor(const ConvoTag & remote, const Introduction & intro) =0
virtual bool GetReplyIntroFor(const ConvoTag & remote, Introduction & intro) const =0
virtual bool GetConvoTagsForService(const Address & si, std::set< ConvoTag > & tag) const =0
virtual bool HasInboundConvo(const Address & addr) const =0
virtual bool HasOutboundConvo(const Address & addr) const =0
virtual bool WantsOutboundSession(const Address & addr) const =0
do we want a session outbound to addr
virtual void QueueRecvData(RecvDataEvent ev) =0

Public Classes inherited from llarp::EndpointBase

Name
struct SendStat

Public Types inherited from llarp::EndpointBase

Name
using std::variant< service::Address, RouterID > AddressVariant_t

Public Functions inherited from llarp::EndpointBase

Name
virtual ~EndpointBase() =default
void PutSRVRecord(dns::SRVData srv)
add an srv record to this endpoint's descriptor
virtual std::shared_ptr< dns::Server > DNS() const
get dns serverr if we have on on this endpoint
virtual void SRVRecordsChanged() =0
called when srv data changes in some way
bool DelSRVRecordIf(std::function< bool(const dns::SRVData &)> filter)
remove srv records from this endpoint that match a filter for each srv record call it with filter, remove if filter returns true return if we removed any srv records
std::set< dns::SRVData > SRVRecords() const
get copy of all srv records
virtual std::optional< SendStat > GetStatFor(AddressVariant_t remote) const =0
get statistics about how much traffic we sent and recv'd to a remote endpoint
virtual std::unordered_set< AddressVariant_t > AllRemoteEndpoints() const =0
list all remote endpoint addresses we have that are mapped
virtual AddressVariant_t LocalAddress() const =0
get our local address
virtual std::optional< AddressVariant_t > GetEndpointWithConvoTag(service::ConvoTag tag) const =0
virtual std::optional< service::ConvoTag > GetBestConvoTagFor(AddressVariant_t addr) const =0
virtual bool EnsurePathTo(AddressVariant_t addr, std::function< void(std::optional< service::ConvoTag >)> hook, llarp_time_t timeout) =0
virtual void LookupNameAsync(std::string name, std::function< void(std::optional< AddressVariant_t >)> resultHandler) =0
virtual const EventLoop_ptr & Loop() =0
virtual bool SendToOrQueue(service::ConvoTag tag, const llarp_buffer_t & payload, service::ProtocolType t) =0
virtual void LookupServiceAsync(std::string name, std::string service, std::function< void(std::vector< dns::SRVData >)> resultHandler) =0
lookup srv records async
virtual void MarkAddressOutbound(AddressVariant_t remote) =0

Protected Types inherited from llarp::path::PathSet

Name
using util::NullMutex Mtx_t
using util::NullLock Lock_t
using std::unordered_map< std::pair< RouterID, PathID_t >, Path_ptr > PathMap_t

Public Functions inherited from llarp::path::PathSet

Name
PathSet(size_t numDesiredPaths)
construct @params numDesiredPaths the number of paths to maintain
virtual void BuildOne(PathRole roles =ePathRoleAny) =0
virtual void Build(std::vector< RouterContact > hops, PathRole roles =ePathRoleAny) =0
manual build on these hops
virtual void Tick(llarp_time_t now)
tick owned paths
size_t NumPathsExistingAt(llarp_time_t futureTime) const
count the number of paths that will exist at this timestamp in future
virtual void HandlePathBuilt(Path_ptr path) =0
virtual void HandlePathBuildTimeout(Path_ptr path)
virtual void HandlePathBuildFailedAt(Path_ptr path, RouterID hop)
virtual void PathBuildStarted(Path_ptr path)
virtual void HandlePathDied(Path_ptr path)
a path died now what?
bool GetNewestIntro(service::Introduction & intro) const
void AddPath(Path_ptr path)
Path_ptr GetByUpstream(RouterID remote, PathID_t rxid) const
void ExpirePaths(llarp_time_t now, AbstractRouter * router)
size_t NumInStatus(PathStatus st) const
get the number of paths in this status
size_t AvailablePaths(PathRole role) const
get the number of paths that match the role that are available
virtual llarp_time_t Now() const =0
get time from event loop
virtual bool Stop() =0
stop this pathset and mark it as to be removed
virtual bool IsStopped() const =0
return true if we are stopped
virtual std::string Name() const =0
get the "name" of this pathset
virtual bool ShouldRemove() const =0
return true if we can and should remove this pathset and underlying resources from its parent context
virtual bool ShouldBuildMore(llarp_time_t now) const
return true if we should build another path
virtual bool ShouldBuildMoreForRoles(llarp_time_t now, PathRole roles) const
return true if we need another path with the given path roles
virtual size_t MinRequiredForRoles(PathRole roles) const
return the minimum number of paths we want for given roles
virtual bool ShouldPublishDescriptors(llarp_time_t now) const
return true if we should publish a new hidden service descriptor
virtual void BlacklistSNode(const RouterID ) =0
virtual bool HandleGotIntroMessage(std::shared_ptr< const dht::GotIntroMessage > )
override me in subtype
virtual bool HandleGotRouterMessage(std::shared_ptr< const dht::GotRouterMessage > )
override me in subtype
virtual bool HandleGotNameMessage(std::shared_ptr< const dht::GotNameMessage > )
override me in subtype
virtual routing::IMessageHandler * GetDHTHandler()
Path_ptr GetEstablishedPathClosestTo(RouterID router, std::unordered_set< RouterID > excluding ={}, PathRole roles =ePathRoleAny) const
Path_ptr PickEstablishedPath(PathRole roles =ePathRoleAny) const
Path_ptr PickRandomEstablishedPath(PathRole roles =ePathRoleAny) const
Path_ptr GetPathByRouter(RouterID router, PathRole roles =ePathRoleAny) const
Path_ptr GetNewestPathByRouter(RouterID router, PathRole roles =ePathRoleAny) const
Path_ptr GetRandomPathByRouter(RouterID router, PathRole roles =ePathRoleAny) const
Path_ptr GetPathByID(PathID_t id) const
Path_ptr GetByEndpointWithID(RouterID router, PathID_t id) const
std::optional< std::set< service::Introduction > > GetCurrentIntroductionsWithFilter(std::function< bool(const service::Introduction &)> filter) const
virtual bool PublishIntroSet(const service::EncryptedIntroSet & , AbstractRouter * )
virtual void ResetInternalState() =0
reset all cooldown timers
virtual bool BuildOneAlignedTo(const RouterID endpoint) =0
virtual std::optional< std::vector< RouterContact > > GetHopsForBuild() =0
void ForEachPath(std::function< void(const Path_ptr &)> visit) const
void UpstreamFlush(AbstractRouter * r)
void DownstreamFlush(AbstractRouter * r)

Protected Functions inherited from llarp::path::PathSet

Name
void TickPaths(AbstractRouter * r)

Public Attributes inherited from llarp::path::PathSet

Name
constexpr size_t max_paths
maximum number of paths a path set can maintain
size_t numDesiredPaths

Protected Attributes inherited from llarp::path::PathSet

Name
BuildStats m_BuildStats
Mtx_t m_PathsMutex
PathMap_t m_Paths

Public Functions Documentation

function NullEndpoint

inline NullEndpoint(
    AbstractRouter * r,
    llarp::service::Context * parent
)

function HandleInboundPacket

inline virtual bool HandleInboundPacket(
    const service::ConvoTag tag,
    const llarp_buffer_t & pkt,
    service::ProtocolType t,
    uint64_t seqno
) override

handle packet io from service node or hidden service to frontend

Reimplements: llarp::service::Endpoint::HandleInboundPacket

function GetIfName

inline virtual std::string GetIfName() const override

Reimplements: llarp::service::Endpoint::GetIfName

function GetSelf

inline virtual path::PathSet_ptr GetSelf() override

get a shared_ptr of ourself

Reimplements: llarp::path::PathSet::GetSelf

function GetWeak

inline virtual std::weak_ptr< path::PathSet > GetWeak() override

get a weak_ptr of ourself

Reimplements: llarp::path::PathSet::GetWeak

function SupportsV6

inline virtual bool SupportsV6() const override

Reimplements: llarp::service::Endpoint::SupportsV6

function SendPacketToRemote

inline virtual void SendPacketToRemote(
    const llarp_buffer_t & ,
    service::ProtocolType 
) override

Reimplements: llarp::path::PathSet::SendPacketToRemote

function ObtainIPForAddr

inline net::ipv6addr_t ObtainIPForAddr(
    std::variant< service::Address, RouterID > 
) override

function ObtainAddrForIP

inline virtual std::optional< std::variant< service::Address, RouterID > > ObtainAddrForIP(
    net::ipv6addr_t ip
) const override

get a key for ip address

Reimplements: llarp::service::Endpoint::ObtainAddrForIP

function EgresPacketRouter

inline virtual vpn::EgresPacketRouter * EgresPacketRouter() override

Reimplements: llarp::service::Endpoint::EgresPacketRouter


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