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 () const
 The public endpoint peers should reach us on, once a backend reports a usable (genuinely public) external IP + TCP port.
 
- 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 37 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 ( ) const

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

nullopt until then.

◆ 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 48 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: