Maps the node's TCP listen port through the home router via UPnP and/or NAT-PMP. More...
#include <port_mapping_service.h>
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 |
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.
|
explicit |
|
override |
|
overridevirtual |
Implements librats::Subsystem.
| 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.
|
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.
|
overridevirtual |
Implements librats::Subsystem.
|
overridevirtual |
Implements librats::Subsystem.