llarp::exit::BaseSession
a persisting exit session with an exit router
#include <session.hpp>
Inherits from llarp::path::Builder, std::enable_shared_from_this< BaseSession >, llarp::path::PathSet
Inherited by llarp::exit::ExitSession, llarp::exit::SNodeSession
Public Functions
| Name | |
|---|---|
| BaseSession(const llarp::RouterID & exitRouter, std::function< bool(const llarp_buffer_t &)> writepkt, AbstractRouter * r, size_t numpaths, size_t hoplen, EndpointBase * parent) | |
| ~BaseSession() override | |
| virtual std::shared_ptr< path::PathSet > | GetSelf() override get a shared_ptr of ourself |
| virtual std::weak_ptr< path::PathSet > | GetWeak() override get a weak_ptr of ourself |
| virtual void | BlacklistSNode(const RouterID snode) override |
| virtual bool | ShouldBundleRC() const override should we bundle RCs in builds? |
| virtual void | ResetInternalState() override reset all cooldown timers |
| virtual bool | UrgentBuild(llarp_time_t ) const override |
| virtual void | HandlePathDied(llarp::path::Path_ptr path) override a path died now what? |
| bool | CheckPathDead(path::Path_ptr p, llarp_time_t dlt) |
| virtual std::optional< std::vector< RouterContact > > | GetHopsForBuild() override |
| virtual bool | ShouldBuildMore(llarp_time_t now) const override return true if we should build another path |
| virtual void | HandlePathBuilt(llarp::path::Path_ptr p) override |
| bool | QueueUpstreamTraffic(llarp::net::IPPacket pkt, const size_t packSize, service::ProtocolType t) |
| bool | FlushUpstream() flush upstream to exit via paths |
| void | FlushDownstream() flush downstream to user via tun |
| virtual path::PathRole | GetRoles() const override get roles for this path builder |
| virtual bool | Stop() override send close and stop session |
| bool | IsReady() const |
| const llarp::RouterID | Endpoint() const |
| std::optional< PathID_t > | CurrentPath() const |
| bool | IsExpired(llarp_time_t now) const |
| bool | LoadIdentityFromFile(const char * fname) |
| void | AddReadyHook(SessionReadyFunc func) |
Protected Functions
| Name | |
|---|---|
| virtual void | PopulateRequest(llarp::routing::ObtainExitMessage & msg) const =0 |
| bool | HandleTrafficDrop(llarp::path::Path_ptr p, const llarp::PathID_t & path, uint64_t s) |
| bool | HandleGotExit(llarp::path::Path_ptr p, llarp_time_t b) |
| bool | HandleTraffic(llarp::path::Path_ptr p, const llarp_buffer_t & buf, uint64_t seqno, service::ProtocolType t) |
Public Attributes
| Name | |
|---|---|
| constexpr size_t | MaxUpstreamQueueLength |
Protected Attributes
| Name | |
|---|---|
| llarp::RouterID | m_ExitRouter |
| llarp::SecretKey | m_ExitIdentity |
| std::function< bool(const llarp_buffer_t &)> | m_WritePacket |
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 |
| 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 | 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 |
| 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 | |
|---|---|
| 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() |
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 | HandlePathBuildTimeout(Path_ptr path) |
| virtual void | HandlePathBuildFailedAt(Path_ptr path, RouterID hop) |
| virtual void | PathBuildStarted(Path_ptr path) |
| 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 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 | 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 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 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 Functions Documentation
function BaseSession
BaseSession(
const llarp::RouterID & exitRouter,
std::function< bool(const llarp_buffer_t &)> writepkt,
AbstractRouter * r,
size_t numpaths,
size_t hoplen,
EndpointBase * parent
)
function ~BaseSession
~BaseSession() override
function GetSelf
inline virtual std::shared_ptr< path::PathSet > 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 BlacklistSNode
virtual void BlacklistSNode(
const RouterID snode
) override
Reimplements: llarp::path::PathSet::BlacklistSNode
function ShouldBundleRC
inline virtual bool ShouldBundleRC() const override
should we bundle RCs in builds?
Reimplements: llarp::path::Builder::ShouldBundleRC
function ResetInternalState
virtual void ResetInternalState() override
reset all cooldown timers
Reimplements: llarp::path::PathSet::ResetInternalState
function UrgentBuild
virtual bool UrgentBuild(
llarp_time_t
) const override
Reimplements: llarp::path::Builder::UrgentBuild
function HandlePathDied
virtual void HandlePathDied(
llarp::path::Path_ptr path
) override
a path died now what?
Reimplements: llarp::path::PathSet::HandlePathDied
function CheckPathDead
bool CheckPathDead(
path::Path_ptr p,
llarp_time_t dlt
)
function GetHopsForBuild
virtual std::optional< std::vector< RouterContact > > GetHopsForBuild() override
Reimplements: llarp::path::Builder::GetHopsForBuild
function ShouldBuildMore
virtual bool ShouldBuildMore(
llarp_time_t now
) const override
return true if we should build another path
Reimplements: llarp::path::PathSet::ShouldBuildMore
function HandlePathBuilt
virtual void HandlePathBuilt(
llarp::path::Path_ptr p
) override
Reimplements: llarp::path::Builder::HandlePathBuilt
function QueueUpstreamTraffic
bool QueueUpstreamTraffic(
llarp::net::IPPacket pkt,
const size_t packSize,
service::ProtocolType t
)
function FlushUpstream
bool FlushUpstream()
flush upstream to exit via paths
function FlushDownstream
void FlushDownstream()
flush downstream to user via tun
function GetRoles
inline virtual path::PathRole GetRoles() const override
get roles for this path builder
Reimplements: llarp::path::Builder::GetRoles
function Stop
virtual bool Stop() override
send close and stop session
Reimplements: llarp::path::PathSet::Stop
function IsReady
bool IsReady() const
function Endpoint
inline const llarp::RouterID Endpoint() const
function CurrentPath
inline std::optional< PathID_t > CurrentPath() const
function IsExpired
bool IsExpired(
llarp_time_t now
) const
function LoadIdentityFromFile
bool LoadIdentityFromFile(
const char * fname
)
function AddReadyHook
void AddReadyHook(
SessionReadyFunc func
)
Protected Functions Documentation
function PopulateRequest
virtual void PopulateRequest(
llarp::routing::ObtainExitMessage & msg
) const =0
Reimplemented by: llarp::exit::ExitSession::PopulateRequest, llarp::exit::SNodeSession::PopulateRequest
function HandleTrafficDrop
bool HandleTrafficDrop(
llarp::path::Path_ptr p,
const llarp::PathID_t & path,
uint64_t s
)
function HandleGotExit
bool HandleGotExit(
llarp::path::Path_ptr p,
llarp_time_t b
)
function HandleTraffic
bool HandleTraffic(
llarp::path::Path_ptr p,
const llarp_buffer_t & buf,
uint64_t seqno,
service::ProtocolType t
)
Public Attributes Documentation
variable MaxUpstreamQueueLength
static constexpr size_t MaxUpstreamQueueLength = 256;
Protected Attributes Documentation
variable m_ExitRouter
llarp::RouterID m_ExitRouter;
variable m_ExitIdentity
llarp::SecretKey m_ExitIdentity;
variable m_WritePacket
std::function< bool(const llarp_buffer_t &)> m_WritePacket;
Updated on 2026-01-10 at 22:49:45 +0000