llarp::service::Endpoint

Inherits from llarp::path::Builder, llarp::service::ILookupHolder, llarp::service::IDataHandler, llarp::EndpointBase, llarp::path::PathSet

Inherited by llarp::handlers::NullEndpoint, llarp::handlers::TunEndpoint

Public Types

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

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

Public Functions

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
virtual std::string GetIfName() const =0
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::EgresPacketRouter * EgresPacketRouter()
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
virtual net::ipv6addr_t ObtainIPForAddr(std::variant< Address, RouterID > ) =0
virtual std::optional< std::variant< service::Address, RouterID > > ObtainAddrForIP(net::ipv6addr_t ip) const =0
get a key for ip 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
virtual bool HandleInboundPacket(const ConvoTag tag, const llarp_buffer_t & pkt, ProtocolType t, uint64_t seqno) =0
handle packet io from service node or hidden service to frontend
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

Name
virtual bool SupportsV6() const =0
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

Name
constexpr auto DefaultPathEnsureTimeout
SendMessageQueue_t m_SendQueue

Protected Attributes

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

Name
struct EndpointUtil

Additional inherited members

Public Functions inherited from llarp::path::Builder

Name
Builder(AbstractRouter * p_router, size_t numDesiredPaths, size_t numHops)
construct
virtual ~Builder() =default
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 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 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
void ManualRebuild(size_t N, PathRole roles =ePathRoleAny)
virtual const SecretKey & GetTunnelEncryptionSecretKey() const
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 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
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

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 PathSet_ptr GetSelf() =0
get a shared_ptr of ourself
virtual std::weak_ptr< PathSet > GetWeak() =0
get a weak_ptr of ourself
virtual void BuildOne(PathRole roles =ePathRoleAny) =0
virtual void Build(std::vector< RouterContact > hops, PathRole roles =ePathRoleAny) =0
manual build on these hops
size_t NumPathsExistingAt(llarp_time_t futureTime) const
count the number of paths that will exist at this timestamp in future
virtual void HandlePathBuildTimeout(Path_ptr path)
virtual void HandlePathBuildFailedAt(Path_ptr path, RouterID hop)
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 IsStopped() const =0
return true if we are stopped
virtual bool ShouldRemove() const =0
return true if we can and should remove this pathset and underlying resources from its parent context
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 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 BuildOneAlignedTo(const RouterID endpoint) =0
virtual void SendPacketToRemote(const llarp_buffer_t & pkt, service::ProtocolType t) =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 Types Documentation

using PendingBufferQueue

using llarp::service::Endpoint::PendingBufferQueue =  std::deque<PendingBuffer>;

using PathEnsureHook

using llarp::service::Endpoint::PathEnsureHook =  std::function<void(Address, OutboundContext*)>;

using SNodeEnsureHook

using llarp::service::Endpoint::SNodeEnsureHook =  std::function<void(const RouterID, exit::BaseSession_ptr, ConvoTag)>;

Protected Types Documentation

using ConvoMap

using llarp::service::Endpoint::ConvoMap =  std::unordered_map<ConvoTag, Session>;

Public Functions Documentation

function Endpoint

Endpoint(
    AbstractRouter * r,
    Context * parent
)

function ~Endpoint

~Endpoint() override

function IsReady

bool IsReady() const

return true if we are ready to recv packets from the void.

really should be ReadyForInboundTraffic() but the diff is HUGE and we need to rewrite this component anyways.

function QueueRecvData

virtual void QueueRecvData(
    RecvDataEvent ev
) override

Reimplements: llarp::service::IDataHandler::QueueRecvData

function IntrosetIsStale

bool IntrosetIsStale() const

return true if our introset has expired intros

function NotifyParams

virtual std::unordered_map< std::string, std::string > NotifyParams() const

construct parameters for notify hooks

Reimplemented by: llarp::handlers::TunEndpoint::NotifyParams

function SetHandler

void SetHandler(
    IDataHandler * h
)

function Configure

virtual bool Configure(
    const NetworkConfig & conf,
    const DnsConfig & dnsConf
)

Reimplemented by: llarp::handlers::TunEndpoint::Configure

function Tick

virtual void Tick(
    llarp_time_t now
) override

tick owned paths

Reimplements: llarp::path::Builder::Tick

Reimplemented by: llarp::handlers::TunEndpoint::Tick

function HasIfAddr

inline virtual bool HasIfAddr() const

return true if we have a resolvable ip address

Reimplemented by: llarp::handlers::TunEndpoint::HasIfAddr

function GetIfName

virtual std::string GetIfName() const =0

Reimplemented by: llarp::handlers::NullEndpoint::GetIfName, llarp::handlers::TunEndpoint::GetIfName

function GetBestConvoTagFor

std::optional< ConvoTag > GetBestConvoTagFor(
    std::variant< Address, RouterID > addr
) const override

function GetIfAddr

inline virtual net::ipv6addr_t GetIfAddr() const

get our ifaddr if it is set

Reimplemented by: llarp::handlers::TunEndpoint::GetIfAddr

function GetExitPolicy

inline virtual std::optional< net::TrafficPolicy > GetExitPolicy() const

get the exit policy for our exit if we have one override me

Reimplemented by: llarp::handlers::TunEndpoint::GetExitPolicy

function GetOwnedRanges

inline virtual std::set< IPRange > GetOwnedRanges() const

get the ip ranges we claim to own override me

Reimplemented by: llarp::handlers::TunEndpoint::GetOwnedRanges

function Thaw

inline virtual void Thaw()

Reimplemented by: llarp::handlers::TunEndpoint::Thaw

function ResetInternalState

virtual void ResetInternalState() override

reset all cooldown timers

Reimplements: llarp::path::Builder::ResetInternalState

Reimplemented by: llarp::handlers::TunEndpoint::ResetInternalState

function Loop

virtual const EventLoop_ptr & Loop() override

loop (via router) use when sending any data on a path

Reimplements: llarp::EndpointBase::Loop

function Router

AbstractRouter * Router()

function LoadKeyFile

virtual bool LoadKeyFile()

function Start

virtual bool Start()

Reimplemented by: llarp::handlers::TunEndpoint::Start

function Name

virtual std::string Name() const override

get the "name" of this pathset

Reimplements: llarp::path::PathSet::Name

function LocalAddress

virtual AddressVariant_t LocalAddress() const override

get our local address

Reimplements: llarp::EndpointBase::LocalAddress

function GetStatFor

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

Reimplements: llarp::EndpointBase::GetStatFor

function AllRemoteEndpoints

virtual std::unordered_set< AddressVariant_t > AllRemoteEndpoints() const override

list all remote endpoint addresses we have that are mapped

Reimplements: llarp::EndpointBase::AllRemoteEndpoints

function ShouldPublishDescriptors

virtual bool ShouldPublishDescriptors(
    llarp_time_t now
) const override

return true if we should publish a new hidden service descriptor

Reimplements: llarp::path::PathSet::ShouldPublishDescriptors

function SRVRecordsChanged

virtual void SRVRecordsChanged() override

called when srv data changes in some way

Reimplements: llarp::EndpointBase::SRVRecordsChanged

function HandlePathDied

virtual void HandlePathDied(
    path::Path_ptr path
) override

a path died now what?

Reimplements: llarp::path::PathSet::HandlePathDied

function EgresPacketRouter

inline virtual vpn::EgresPacketRouter * EgresPacketRouter()

Reimplemented by: llarp::handlers::NullEndpoint::EgresPacketRouter

function GetVPNInterface

inline virtual vpn::NetworkInterface * GetVPNInterface()

Reimplemented by: llarp::handlers::TunEndpoint::GetVPNInterface

function PublishIntroSet

virtual bool PublishIntroSet(
    const EncryptedIntroSet & i,
    AbstractRouter * r
) override

Reimplements: llarp::path::PathSet::PublishIntroSet

function PublishIntroSetVia

bool PublishIntroSetVia(
    const EncryptedIntroSet & i,
    AbstractRouter * r,
    path::Path_ptr p,
    uint64_t relayOrder
)

function HandleGotIntroMessage

virtual bool HandleGotIntroMessage(
    std::shared_ptr< const dht::GotIntroMessage > 
) override

override me in subtype

Reimplements: llarp::path::PathSet::HandleGotIntroMessage

function HandleGotRouterMessage

virtual bool HandleGotRouterMessage(
    std::shared_ptr< const dht::GotRouterMessage > 
) override

override me in subtype

Reimplements: llarp::path::PathSet::HandleGotRouterMessage

function HandleGotNameMessage

virtual bool HandleGotNameMessage(
    std::shared_ptr< const dht::GotNameMessage > 
) override

override me in subtype

Reimplements: llarp::path::PathSet::HandleGotNameMessage

function HandleHiddenServiceFrame

bool HandleHiddenServiceFrame(
    path::Path_ptr p,
    const service::ProtocolFrame & msg
)

function SetEndpointAuth

void SetEndpointAuth(
    std::shared_ptr< IAuthPolicy > policy
)

function SetAuthInfoForEndpoint

void SetAuthInfoForEndpoint(
    Address remote,
    AuthInfo info
)

sets how we authenticate with remote address

function ObtainIPForAddr

virtual net::ipv6addr_t ObtainIPForAddr(
    std::variant< Address, RouterID > 
) =0

function ObtainAddrForIP

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

get a key for ip address

Reimplemented by: llarp::handlers::TunEndpoint::ObtainAddrForIP, llarp::handlers::NullEndpoint::ObtainAddrForIP

function HasPendingPathToService

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

function HandleDataMessage

virtual bool HandleDataMessage(
    path::Path_ptr path,
    const PathID_t from,
    std::shared_ptr< ProtocolMessage > msg
) override

Reimplements: llarp::service::IDataHandler::HandleDataMessage

function HandleInboundPacket

virtual bool HandleInboundPacket(
    const ConvoTag tag,
    const llarp_buffer_t & pkt,
    ProtocolType t,
    uint64_t seqno
) =0

handle packet io from service node or hidden service to frontend

Reimplemented by: llarp::handlers::NullEndpoint::HandleInboundPacket, llarp::handlers::TunEndpoint::HandleInboundPacket

function ProcessDataMessage

bool ProcessDataMessage(
    std::shared_ptr< ProtocolMessage > msg
)

function EnsureRouterIsKnown

void EnsureRouterIsKnown(
    const RouterID & router
)

ensure that we know a router, looks up if it doesn't

function LookupRouterAnon

bool LookupRouterAnon(
    RouterID router,
    RouterLookupHandler handler
)

lookup a router via closest path

function LookupNameAsync

void LookupNameAsync(
    std::string name,
    std::function< void(std::optional< std::variant< Address, RouterID > >)> resultHandler
) override

function LookupServiceAsync

virtual void LookupServiceAsync(
    std::string name,
    std::string service,
    std::function< void(std::vector< dns::SRVData >)> resultHandler
) override

lookup srv records async

Reimplements: llarp::EndpointBase::LookupServiceAsync

function Pump

virtual void Pump(
    llarp_time_t now
)

called on event loop pump

Reimplemented by: llarp::handlers::TunEndpoint::Pump

function Stop

virtual bool Stop() override

stop this endpoint

Reimplements: llarp::path::Builder::Stop

Reimplemented by: llarp::handlers::TunEndpoint::Stop

function GetIdentity

inline const Identity & GetIdentity() const

function MapExitRange

void MapExitRange(
    IPRange range,
    service::Address exit
)

function UnmapExitRange

void UnmapExitRange(
    IPRange range
)

function UnmapRangeByExit

void UnmapRangeByExit(
    IPRange range,
    std::string exit
)

function map_exit

void map_exit(
    std::string name,
    std::string token,
    std::vector< IPRange > ranges,
    std::function< void(bool, std::string)> result
)

function PutLookup

virtual void PutLookup(
    IServiceLookup * lookup,
    uint64_t txid
) override

Reimplements: llarp::service::ILookupHolder::PutLookup

function HandlePathBuilt

virtual void HandlePathBuilt(
    path::Path_ptr path
) override

Reimplements: llarp::path::Builder::HandlePathBuilt

function HandleDataDrop

bool HandleDataDrop(
    path::Path_ptr p,
    const PathID_t & dst,
    uint64_t s
)

function CheckPathIsDead

bool CheckPathIsDead(
    path::Path_ptr p,
    llarp_time_t latency
)

function RemoveAllConvoTagsFor

size_t RemoveAllConvoTagsFor(
    service::Address remote
)

function WantsOutboundSession

virtual bool WantsOutboundSession(
    const Address & addr
) const override

do we want a session outbound to addr

Reimplements: llarp::service::IDataHandler::WantsOutboundSession

function MarkAddressOutbound

virtual void MarkAddressOutbound(
    AddressVariant_t 
) override

this MUST be called if you want to call EnsurePathTo on the given address

Reimplements: llarp::EndpointBase::MarkAddressOutbound

function ShouldBundleRC

inline virtual bool ShouldBundleRC() const override

should we bundle RCs in builds?

Reimplements: llarp::path::Builder::ShouldBundleRC

function BlacklistSNode

virtual void BlacklistSNode(
    const RouterID snode
) override

Reimplements: llarp::path::PathSet::BlacklistSNode

function GetEndpointWithConvoTag

virtual std::optional< std::variant< Address, RouterID > > GetEndpointWithConvoTag(
    ConvoTag t
) const override

maybe get an endpoint variant given its convo tag

Reimplements: llarp::EndpointBase::GetEndpointWithConvoTag

function HasConvoTag

virtual bool HasConvoTag(
    const ConvoTag & t
) const override

Reimplements: llarp::service::IDataHandler::HasConvoTag

function ShouldBuildMore

virtual bool ShouldBuildMore(
    llarp_time_t now
) const override

return true if we should build another path

Reimplements: llarp::path::Builder::ShouldBuildMore

function PathAlignmentTimeout

inline virtual llarp_time_t PathAlignmentTimeout() const

Reimplemented by: llarp::handlers::TunEndpoint::PathAlignmentTimeout

function EnsurePathTo

bool EnsurePathTo(
    std::variant< Address, RouterID > addr,
    std::function< void(std::optional< ConvoTag >)> hook,
    llarp_time_t timeout
) override

function EnsurePathToService

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

function InformPathToService

void InformPathToService(
    const Address remote,
    OutboundContext * ctx
)

function EnsurePathToSNode

bool EnsurePathToSNode(
    const RouterID remote,
    SNodeEnsureHook h
)

ensure a path to a service node by public key

function HasPendingRouterLookup

bool HasPendingRouterLookup(
    const RouterID remote
) const

return true if this endpoint is trying to lookup this router right now

function HasPathToSNode

bool HasPathToSNode(
    const RouterID remote
) const

function HasFlowToService

bool HasFlowToService(
    const Address remote
) const

function PutSenderFor

virtual void PutSenderFor(
    const ConvoTag & tag,
    const ServiceInfo & info,
    bool inbound
) override

Reimplements: llarp::service::IDataHandler::PutSenderFor

function HasInboundConvo

virtual bool HasInboundConvo(
    const Address & addr
) const override

Reimplements: llarp::service::IDataHandler::HasInboundConvo

function HasOutboundConvo

virtual bool HasOutboundConvo(
    const Address & addr
) const override

Reimplements: llarp::service::IDataHandler::HasOutboundConvo

function GetCachedSessionKeyFor

virtual bool GetCachedSessionKeyFor(
    const ConvoTag & remote,
    SharedSecret & secret
) const override

Reimplements: llarp::service::IDataHandler::GetCachedSessionKeyFor

function PutCachedSessionKeyFor

virtual void PutCachedSessionKeyFor(
    const ConvoTag & remote,
    const SharedSecret & secret
) override

Reimplements: llarp::service::IDataHandler::PutCachedSessionKeyFor

function GetSenderFor

virtual bool GetSenderFor(
    const ConvoTag & remote,
    ServiceInfo & si
) const override

Reimplements: llarp::service::IDataHandler::GetSenderFor

function PutIntroFor

virtual void PutIntroFor(
    const ConvoTag & remote,
    const Introduction & intro
) override

Reimplements: llarp::service::IDataHandler::PutIntroFor

function GetIntroFor

virtual bool GetIntroFor(
    const ConvoTag & remote,
    Introduction & intro
) const override

Reimplements: llarp::service::IDataHandler::GetIntroFor

function RemoveConvoTag

virtual void RemoveConvoTag(
    const ConvoTag & remote
) override

Reimplements: llarp::service::IDataHandler::RemoveConvoTag

function ConvoTagTX

virtual void ConvoTagTX(
    const ConvoTag & tag
) override

called when we send data to remote on a convotag

Reimplements: llarp::service::IDataHandler::ConvoTagTX

function ConvoTagRX

virtual void ConvoTagRX(
    const ConvoTag & tag
) override

called when we got data from remote on a convotag

Reimplements: llarp::service::IDataHandler::ConvoTagRX

function PutReplyIntroFor

virtual void PutReplyIntroFor(
    const ConvoTag & remote,
    const Introduction & intro
) override

Reimplements: llarp::service::IDataHandler::PutReplyIntroFor

function GetReplyIntroFor

virtual bool GetReplyIntroFor(
    const ConvoTag & remote,
    Introduction & intro
) const override

Reimplements: llarp::service::IDataHandler::GetReplyIntroFor

function GetConvoTagsForService

virtual bool GetConvoTagsForService(
    const Address & si,
    std::set< ConvoTag > & tag
) const override

Reimplements: llarp::service::IDataHandler::GetConvoTagsForService

function PutNewOutboundContext

void PutNewOutboundContext(
    const IntroSet & introset,
    llarp_time_t timeLeftToAlign
)

function GetSeqNoForConvo

std::optional< uint64_t > GetSeqNoForConvo(
    const ConvoTag & tag
)

function UniqueEndpoints

size_t UniqueEndpoints() const

count unique endpoints we are talking to

function HasExit

bool HasExit() const

function GetHopsForBuild

virtual std::optional< std::vector< RouterContact > > GetHopsForBuild() override

Reimplements: llarp::path::Builder::GetHopsForBuild

function GetHopsForBuildWithEndpoint

std::optional< std::vector< RouterContact > > GetHopsForBuildWithEndpoint(
    RouterID endpoint
)

function PathBuildStarted

virtual void PathBuildStarted(
    path::Path_ptr path
) override

Reimplements: llarp::path::PathSet::PathBuildStarted

function IntroSetPublishFail

virtual void IntroSetPublishFail()

function IntroSetPublished

virtual void IntroSetPublished()

function AsyncProcessAuthMessage

void AsyncProcessAuthMessage(
    std::shared_ptr< ProtocolMessage > msg,
    std::function< void(AuthResult)> hook
)

function SendAuthResult

void SendAuthResult(
    path::Path_ptr path,
    PathID_t replyPath,
    ConvoTag tag,
    AuthResult st
)

function GenTXID

uint64_t GenTXID()

function ResetConvoTag

void ResetConvoTag(
    ConvoTag tag,
    path::Path_ptr path,
    PathID_t from
)

function SnodeBlacklist

const std::set< RouterID > & SnodeBlacklist() const

function SendToOrQueue

virtual bool SendToOrQueue(
    ConvoTag tag,
    const llarp_buffer_t & payload,
    ProtocolType t
) override

Reimplements: llarp::EndpointBase::SendToOrQueue

function SendToOrQueue

bool SendToOrQueue(
    const std::variant< Address, RouterID > & addr,
    const llarp_buffer_t & payload,
    ProtocolType t
)

function SendToOrQueue

bool SendToOrQueue(
    const Address & addr,
    const llarp_buffer_t & payload,
    ProtocolType t
)

function SendToOrQueue

bool SendToOrQueue(
    const RouterID & addr,
    const llarp_buffer_t & payload,
    ProtocolType t
)

function MaybeGetAuthInfoForEndpoint

std::optional< AuthInfo > MaybeGetAuthInfoForEndpoint(
    service::Address addr
)

Protected Functions Documentation

function SupportsV6

virtual bool SupportsV6() const =0

Reimplemented by: llarp::handlers::NullEndpoint::SupportsV6, llarp::handlers::TunEndpoint::SupportsV6

function RegenAndPublishIntroSet

void RegenAndPublishIntroSet()

function GenerateLookupByTag

IServiceLookup * GenerateLookupByTag(
    const Tag & tag
)

function PrefetchServicesByTag

void PrefetchServicesByTag(
    const Tag & tag
)

function ReadyToDoLookup

bool ReadyToDoLookup(
    size_t num_paths
) const

function GetUniqueEndpointsForLookup

path::Path::UniqueEndpointSet_t GetUniqueEndpointsForLookup() const

function FlushRecvData

void FlushRecvData()

function introSet

const IntroSet & introSet() const

function introSet

IntroSet & introSet()

function Sessions

const ConvoMap & Sessions() const

function Sessions

ConvoMap & Sessions()

Public Attributes Documentation

variable DefaultPathEnsureTimeout

static constexpr auto DefaultPathEnsureTimeout = 2s;

variable m_SendQueue

SendMessageQueue_t m_SendQueue;

Protected Attributes Documentation

variable context

Context *const context;

parent context that owns this endpoint

variable m_DataHandler

IDataHandler * m_DataHandler = nullptr;

variable m_Identity

Identity m_Identity;

variable m_ExitMap

net::IPRangeMap< service::Address > m_ExitMap;

variable m_PublishIntroSet

bool m_PublishIntroSet = true;

variable m_state

std::unique_ptr< EndpointState > m_state;

variable m_AuthPolicy

std::shared_ptr< IAuthPolicy > m_AuthPolicy;

variable m_RemoteAuthInfos

std::unordered_map< Address, AuthInfo > m_RemoteAuthInfos;

variable m_StartupLNSMappings

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

variable m_InboundTrafficQueue

RecvPacketQueue_t m_InboundTrafficQueue;

variable m_RecvQueue

thread::Queue< RecvDataEvent > m_RecvQueue;

variable m_IntrosetLookupFilter

util::DecayingHashSet< Address > m_IntrosetLookupFilter;

for rate limiting introset lookups

Friends

friend EndpointUtil

friend struct EndpointUtil(
    EndpointUtil 
);

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