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

#include <relay.h>

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

Classes

struct  Config

Public Member Functions

 Relay ()
 Relay (Config config)
 ~Relay () override
void attach (NodeContext &ctx) override
void start () override
void stop () override
bool connect_via_relay (const PeerId &target) override
 Try to reach target through a node both ends are connected to.
bool serves (const PeerId &peer) const override
 Whether peer said it carries circuits for others — a node to try first for anything relayed, a punch's rendezvous included.
size_t circuits () const
 Circuits this node terminates (relayed peers, live or still being set up).
size_t carried_circuits () const
 Circuits this node is carrying on behalf of other peers.
size_t forwarded_circuits () const
 Of those, the ones whose datagrams it forwards rather than carrying a stream.
uint64_t carried_bytes () const
 Bytes forwarded on behalf of other peers.
size_t attempts () const
 Attempts to reach a peer through a relay that are currently running.
Public Member Functions inherited from librats::Subsystem
virtual ~Subsystem ()=default
Public Member Functions inherited from librats::RelayService
virtual ~RelayService ()=default

Detailed Description

Definition at line 105 of file relay.h.

Constructor & Destructor Documentation

◆ Relay() [1/2]

librats::Relay::Relay ( )

◆ Relay() [2/2]

librats::Relay::Relay ( Config config)
explicit

◆ ~Relay()

librats::Relay::~Relay ( )
override

Member Function Documentation

◆ attach()

void librats::Relay::attach ( NodeContext & ctx)
overridevirtual

Implements librats::Subsystem.

◆ attempts()

size_t librats::Relay::attempts ( ) const

Attempts to reach a peer through a relay that are currently running.

◆ carried_bytes()

uint64_t librats::Relay::carried_bytes ( ) const

Bytes forwarded on behalf of other peers.

◆ carried_circuits()

size_t librats::Relay::carried_circuits ( ) const

Circuits this node is carrying on behalf of other peers.

◆ circuits()

size_t librats::Relay::circuits ( ) const

Circuits this node terminates (relayed peers, live or still being set up).

◆ connect_via_relay()

bool librats::Relay::connect_via_relay ( const PeerId & target)
overridevirtual

Try to reach target through a node both ends are connected to.

Non-blocking; success surfaces as an ordinary peer-connected event, and the resulting peer is ordinary in every way except that its bytes take a detour (PeerInfo::transport is TransportKind::Relay).

Returns
whether an attempt actually started — false is routine (already connected, an attempt is already running, the target is in cooldown, or this node has no peer that could carry the circuit) and needs no handling by the caller.

Implements librats::RelayService.

◆ forwarded_circuits()

size_t librats::Relay::forwarded_circuits ( ) const

Of those, the ones whose datagrams it forwards rather than carrying a stream.

◆ serves()

bool librats::Relay::serves ( const PeerId & peer) const
overridevirtual

Whether peer said it carries circuits for others — a node to try first for anything relayed, a punch's rendezvous included.

Reimplemented from librats::RelayService.

◆ start()

void librats::Relay::start ( )
overridevirtual

Implements librats::Subsystem.

◆ stop()

void librats::Relay::stop ( )
overridevirtual

Implements librats::Subsystem.


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