Back to Site
Loading...
Searching...
No Matches
librats::HolePunch Class Referencefinal

Published as HolePunchService, so a module that discovers a peer it cannot dial (PeerExchange) can hand the id over without depending on this class. More...

#include <hole_punch.h>

Inheritance diagram for librats::HolePunch:
[legend]
Collaboration diagram for librats::HolePunch:
[legend]

Classes

struct  Config
 

Public Member Functions

 HolePunch ()
 
 HolePunch (Config config)
 
 ~HolePunch () override
 
void attach (NodeContext &ctx) override
 
void start () override
 
void stop () override
 
bool punch (const PeerId &target) override
 Try to reach target by punching.
 
size_t active_sessions () const
 Sessions currently in flight (diagnostics and tests).
 
uint64_t punches_started () const noexcept
 Punch bursts this node has fired (diagnostics and tests).
 
uint64_t relayed () const noexcept
 Messages forwarded on behalf of other peers (diagnostics and tests).
 
- Public Member Functions inherited from librats::Subsystem
virtual ~Subsystem ()=default
 
- Public Member Functions inherited from librats::HolePunchService
virtual ~HolePunchService ()=default
 

Detailed Description

Published as HolePunchService, so a module that discovers a peer it cannot dial (PeerExchange) can hand the id over without depending on this class.

Definition at line 116 of file hole_punch.h.

Constructor & Destructor Documentation

◆ HolePunch() [1/2]

librats::HolePunch::HolePunch ( )

◆ HolePunch() [2/2]

librats::HolePunch::HolePunch ( Config  config)
explicit

◆ ~HolePunch()

librats::HolePunch::~HolePunch ( )
override

Member Function Documentation

◆ active_sessions()

size_t librats::HolePunch::active_sessions ( ) const

Sessions currently in flight (diagnostics and tests).

◆ attach()

void librats::HolePunch::attach ( NodeContext ctx)
overridevirtual

Implements librats::Subsystem.

◆ punch()

bool librats::HolePunch::punch ( const PeerId target)
overridevirtual

Try to reach target by punching.

Non-blocking: the rendezvous runs in the background and a successful punch surfaces as an ordinary peer-connected event. A no-op when already connected to the target, when a session for it is already running, when it is still in cooldown, or when this node has nothing punchable to advertise (see nat_status.h).

Returns
whether a session was actually started.

Implements librats::HolePunchService.

◆ punches_started()

uint64_t librats::HolePunch::punches_started ( ) const
inlinenoexcept

Punch bursts this node has fired (diagnostics and tests).

Definition at line 195 of file hole_punch.h.

◆ relayed()

uint64_t librats::HolePunch::relayed ( ) const
inlinenoexcept

Messages forwarded on behalf of other peers (diagnostics and tests).

Definition at line 197 of file hole_punch.h.

◆ start()

void librats::HolePunch::start ( )
overridevirtual

Implements librats::Subsystem.

◆ stop()

void librats::HolePunch::stop ( )
overridevirtual

Implements librats::Subsystem.


The documentation for this class was generated from the following file: