llarp::handlers::TunEndpoint
Inherits from llarp::service::Endpoint, llarp::dns::Resolver_Base, std::enable_shared_from_this< TunEndpoint >, llarp::path::Builder, llarp::service::ILookupHolder, llarp::service::IDataHandler, llarp::EndpointBase, llarp::path::PathSet
Protected Classes
| Name | |
|---|---|
| struct | WritePacket |
Public Functions
| Name | |
|---|---|
| TunEndpoint(AbstractRouter * r, llarp::service::Context * parent) | |
| ~TunEndpoint() override | |
| virtual vpn::NetworkInterface * | GetVPNInterface() override |
| virtual int | Rank() const override return the sorting order for this resolver lower means it will be tried first |
| virtual std::string_view | ResolverName() const override get printable name |
| virtual bool | MaybeHookDNS(std::shared_ptr< dns::PacketSource_Base > source, const dns::Message & query, const SockAddr & to, const SockAddr & from) override attempt to handle a dns message returns true if we consumed this query and it should not be processed again |
| 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 void | Thaw() override |
| void | ReconfigureDNS(std::vector< SockAddr > servers) |
| virtual bool | Configure(const NetworkConfig & conf, const DnsConfig & dnsConf) override |
| virtual void | SendPacketToRemote(const llarp_buffer_t & , service::ProtocolType ) override |
| virtual std::string | GetIfName() const override |
| virtual void | Tick(llarp_time_t now) override tick owned paths |
| virtual std::unordered_map< std::string, std::string > | NotifyParams() const override construct parameters for notify hooks |
| virtual bool | SupportsV6() const override |
| bool | ShouldHookDNSMessage(const dns::Message & msg) const |
| bool | HandleHookedDNSMessage(dns::Message query, std::function< void(dns::Message)> sendreply) |
| void | TickTun(llarp_time_t now) |
| bool | MapAddress(const service::Address & remote, net::ipv6addr_t ip, bool SNode) |
| virtual bool | Start() override |
| virtual bool | Stop() override stop this endpoint |
| bool | IsSNode() const |
| bool | SetupTun() set up tun interface, blocking |
| void | SetupDNS() |
| virtual std::shared_ptr< dns::Server > | DNS() const override overrides Endpoint |
| virtual bool | SetupNetworking() override overrides Endpoint |
| virtual bool | HandleInboundPacket(const service::ConvoTag tag, const llarp_buffer_t & pkt, service::ProtocolType t, uint64_t seqno) override overrides Endpoint |
| bool | HandleWriteIPPacket(const llarp_buffer_t & buf, net::ipv6addr_t src, net::ipv6addr_t dst, uint64_t seqno) handle inbound traffic |
| void | HandleGotUserPacket(llarp::net::IPPacket pkt) we got a packet from the user |
| virtual net::ipv6addr_t | GetIfAddr() const override get the local interface's address |
| virtual bool | HasIfAddr() const override we have an interface addr |
| bool | HasLocalIP(const net::ipv6addr_t & ip) const |
| virtual std::optional< net::TrafficPolicy > | GetExitPolicy() const override get the exit policy for our exit if we have one override me |
| virtual std::set< IPRange > | GetOwnedRanges() const override get the ip ranges we claim to own override me |
| virtual llarp_time_t | PathAlignmentTimeout() const override |
| bool | ShouldAllowTraffic(const net::IPPacket & pkt) const ip packet against any exit policies we have returns false if this traffic is disallowed by any of those policies returns true otherwise |
| virtual std::optional< std::variant< service::Address, RouterID > > | ObtainAddrForIP(net::ipv6addr_t ip) const override get a key for ip address |
| bool | HasAddress(const AlignedBuffer< 32 > & addr) const |
| net::ipv6addr_t | ObtainIPForAddr(std::variant< service::Address, RouterID > addr) override get ip address for key unconditionally |
| virtual void | ResetInternalState() override reset all cooldown timers |
Protected Functions
| Name | |
|---|---|
| virtual void | Pump(llarp_time_t now) override called on event loop pump |
| bool | HasRemoteForIP(net::ipv6addr_t ipv4) const return true if we have a remote loki address for this ip address |
| void | MarkIPActive(net::ipv6addr_t ip) mark this address as active |
| void | MarkIPActiveForever(net::ipv6addr_t ip) mark this address as active forever |
| void | FlushWrite() flush writing ip packets to interface |
Protected Attributes
| Name | |
|---|---|
| std::priority_queue< WritePacket > | m_NetworkToUserPktQueue queue for sending packets to user from network |
| std::unordered_map< net::ipv6addr_t, AlignedBuffer< 32 > > | m_IPToAddr maps ip to key |
| std::unordered_map< AlignedBuffer< 32 >, net::ipv6addr_t > | m_AddrToIP maps key to ip |
| std::unordered_map< AlignedBuffer< 32 >, bool > | m_SNodes maps key to true if key is a service node, maps key to false if key is a hidden service |
| std::unordered_map< net::ipv6addr_t, service::Address > | m_ExitIPToExitAddress maps ip address to an exit endpoint, useful when we have multiple exits on a range |
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 |
| void | SetHandler(IDataHandler * h) |
| std::optional< ConvoTag > | GetBestConvoTagFor(std::variant< Address, RouterID > addr) const override |
| virtual const EventLoop_ptr & | Loop() override loop (via router) use when sending any data on a path |
| AbstractRouter * | Router() |
| virtual bool | LoadKeyFile() |
| 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 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 |
| 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 |
| 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::dns::Resolver_Base
| 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 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. |
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? |
| 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 |
| 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 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 |
| 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 | 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 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 TunEndpoint
TunEndpoint(
AbstractRouter * r,
llarp::service::Context * parent
)
function ~TunEndpoint
~TunEndpoint() override
function GetVPNInterface
inline virtual vpn::NetworkInterface * GetVPNInterface() override
Reimplements: llarp::service::Endpoint::GetVPNInterface
function Rank
inline virtual int Rank() const override
return the sorting order for this resolver lower means it will be tried first
Reimplements: llarp::dns::Resolver_Base::Rank
function ResolverName
inline virtual std::string_view ResolverName() const override
get printable name
Reimplements: llarp::dns::Resolver_Base::ResolverName
function MaybeHookDNS
virtual bool MaybeHookDNS(
std::shared_ptr< dns::PacketSource_Base > source,
const dns::Message & query,
const SockAddr & to,
const SockAddr & from
) override
attempt to handle a dns message returns true if we consumed this query and it should not be processed again
Reimplements: llarp::dns::Resolver_Base::MaybeHookDNS
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 Thaw
virtual void Thaw() override
Reimplements: llarp::service::Endpoint::Thaw
function ReconfigureDNS
void ReconfigureDNS(
std::vector< SockAddr > servers
)
function Configure
virtual bool Configure(
const NetworkConfig & conf,
const DnsConfig & dnsConf
) override
Reimplements: llarp::service::Endpoint::Configure
function SendPacketToRemote
inline virtual void SendPacketToRemote(
const llarp_buffer_t & ,
service::ProtocolType
) override
Reimplements: llarp::path::PathSet::SendPacketToRemote
function GetIfName
virtual std::string GetIfName() const override
Reimplements: llarp::service::Endpoint::GetIfName
function Tick
virtual void Tick(
llarp_time_t now
) override
tick owned paths
Reimplements: llarp::service::Endpoint::Tick
function NotifyParams
virtual std::unordered_map< std::string, std::string > NotifyParams() const override
construct parameters for notify hooks
Reimplements: llarp::service::Endpoint::NotifyParams
function SupportsV6
virtual bool SupportsV6() const override
Reimplements: llarp::service::Endpoint::SupportsV6
function ShouldHookDNSMessage
bool ShouldHookDNSMessage(
const dns::Message & msg
) const
function HandleHookedDNSMessage
bool HandleHookedDNSMessage(
dns::Message query,
std::function< void(dns::Message)> sendreply
)
function TickTun
void TickTun(
llarp_time_t now
)
function MapAddress
bool MapAddress(
const service::Address & remote,
net::ipv6addr_t ip,
bool SNode
)
function Start
virtual bool Start() override
Reimplements: llarp::service::Endpoint::Start
function Stop
virtual bool Stop() override
stop this endpoint
Reimplements: llarp::service::Endpoint::Stop
function IsSNode
bool IsSNode() const
function SetupTun
bool SetupTun()
set up tun interface, blocking
function SetupDNS
void SetupDNS()
function DNS
inline virtual std::shared_ptr< dns::Server > DNS() const override
overrides Endpoint
Reimplements: llarp::EndpointBase::DNS
function SetupNetworking
virtual bool SetupNetworking() override
overrides Endpoint
Reimplements: llarp::service::Endpoint::SetupNetworking
function HandleInboundPacket
virtual bool HandleInboundPacket(
const service::ConvoTag tag,
const llarp_buffer_t & pkt,
service::ProtocolType t,
uint64_t seqno
) override
overrides Endpoint
Reimplements: llarp::service::Endpoint::HandleInboundPacket
function HandleWriteIPPacket
bool HandleWriteIPPacket(
const llarp_buffer_t & buf,
net::ipv6addr_t src,
net::ipv6addr_t dst,
uint64_t seqno
)
handle inbound traffic
function HandleGotUserPacket
void HandleGotUserPacket(
llarp::net::IPPacket pkt
)
we got a packet from the user
function GetIfAddr
virtual net::ipv6addr_t GetIfAddr() const override
get the local interface's address
Reimplements: llarp::service::Endpoint::GetIfAddr
function HasIfAddr
inline virtual bool HasIfAddr() const override
we have an interface addr
Reimplements: llarp::service::Endpoint::HasIfAddr
function HasLocalIP
bool HasLocalIP(
const net::ipv6addr_t & ip
) const
function GetExitPolicy
inline virtual std::optional< net::TrafficPolicy > GetExitPolicy() const override
get the exit policy for our exit if we have one override me
Reimplements: llarp::service::Endpoint::GetExitPolicy
function GetOwnedRanges
inline virtual std::set< IPRange > GetOwnedRanges() const override
get the ip ranges we claim to own override me
Reimplements: llarp::service::Endpoint::GetOwnedRanges
function PathAlignmentTimeout
inline virtual llarp_time_t PathAlignmentTimeout() const override
Reimplements: llarp::service::Endpoint::PathAlignmentTimeout
function ShouldAllowTraffic
bool ShouldAllowTraffic(
const net::IPPacket & pkt
) const
ip packet against any exit policies we have returns false if this traffic is disallowed by any of those policies returns true otherwise
function ObtainAddrForIP
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 HasAddress
inline bool HasAddress(
const AlignedBuffer< 32 > & addr
) const
function ObtainIPForAddr
net::ipv6addr_t ObtainIPForAddr(
std::variant< service::Address, RouterID > addr
) override
get ip address for key unconditionally
function ResetInternalState
virtual void ResetInternalState() override
reset all cooldown timers
Reimplements: llarp::service::Endpoint::ResetInternalState
Protected Functions Documentation
function Pump
virtual void Pump(
llarp_time_t now
) override
called on event loop pump
Reimplements: llarp::service::Endpoint::Pump
function HasRemoteForIP
bool HasRemoteForIP(
net::ipv6addr_t ipv4
) const
return true if we have a remote loki address for this ip address
function MarkIPActive
void MarkIPActive(
net::ipv6addr_t ip
)
mark this address as active
function MarkIPActiveForever
void MarkIPActiveForever(
net::ipv6addr_t ip
)
mark this address as active forever
function FlushWrite
void FlushWrite()
flush writing ip packets to interface
Protected Attributes Documentation
variable m_NetworkToUserPktQueue
std::priority_queue< WritePacket > m_NetworkToUserPktQueue;
queue for sending packets to user from network
variable m_IPToAddr
std::unordered_map< net::ipv6addr_t, AlignedBuffer< 32 > > m_IPToAddr;
maps ip to key
variable m_AddrToIP
std::unordered_map< AlignedBuffer< 32 >, net::ipv6addr_t > m_AddrToIP;
maps key to ip
variable m_SNodes
std::unordered_map< AlignedBuffer< 32 >, bool > m_SNodes;
maps key to true if key is a service node, maps key to false if key is a hidden service
variable m_ExitIPToExitAddress
std::unordered_map< net::ipv6addr_t, service::Address > m_ExitIPToExitAddress;
maps ip address to an exit endpoint, useful when we have multiple exits on a range
Updated on 2026-01-10 at 22:49:45 +0000