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

Maps the node's TCP listen port through the home router via UPnP and/or NAT-PMP. More...

#include <port_mapping_service.h>

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

Public Member Functions

 PortMappingService (PortMappingConfig config={})
 ~PortMappingService () override
void attach (NodeContext &ctx) override
void start () override
void stop () override
void on_result (PortMapCallback cb)
 Observe mapping results (established / refreshed / failed).
std::optional< std::pair< std::string, uint16_t > > mapped_public_address (PortMapProtocol protocol=PortMapProtocol::TCP) const
 The public endpoint peers should reach us on over protocol, once a backend reports a usable (genuinely public) external IP + port for it.
Public Member Functions inherited from librats::Subsystem
virtual ~Subsystem ()=default

Detailed Description

Maps the node's TCP listen port through the home router via UPnP and/or NAT-PMP.

Owns its backends' worker threads; reaches the node only for its listen port (it neither sends nor receives peer traffic).

Definition at line 47 of file port_mapping_service.h.

Constructor & Destructor Documentation

◆ PortMappingService()

librats::PortMappingService::PortMappingService ( PortMappingConfig config = {})
explicit

◆ ~PortMappingService()

librats::PortMappingService::~PortMappingService ( )
override

Member Function Documentation

◆ attach()

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

Implements librats::Subsystem.

◆ mapped_public_address()

std::optional< std::pair< std::string, uint16_t > > librats::PortMappingService::mapped_public_address ( PortMapProtocol protocol = PortMapProtocol::TCP) const

The public endpoint peers should reach us on over protocol, once a backend reports a usable (genuinely public) external IP + port for it.

nullopt until then. The two protocols are mapped independently and a router may accept one and refuse the other, so ask for the one you intend to dial.

References librats::TCP.

◆ on_result()

void librats::PortMappingService::on_result ( PortMapCallback cb)
inline

Observe mapping results (established / refreshed / failed).

Optional; invoked from a backend worker thread. Register before start().

Definition at line 58 of file port_mapping_service.h.

◆ start()

void librats::PortMappingService::start ( )
overridevirtual

Implements librats::Subsystem.

◆ stop()

void librats::PortMappingService::stop ( )
overridevirtual

Implements librats::Subsystem.


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