61 mutable std::mutex mutex_;
62 std::unique_ptr<UpnpClient> upnp_;
63 std::unique_ptr<NatPmpClient> natpmp_;
64 std::string mapped_external_ip_;
65 uint16_t mapped_external_tcp_port_ = 0;
66 bool double_nat_warned_ =
false;
Maps the node's TCP listen port through the home router via UPnP and/or NAT-PMP.
void attach(NodeContext &ctx) override
void on_result(PortMapCallback cb)
Observe mapping results (established / refreshed / failed).
~PortMappingService() override
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) exte...
PortMappingService(PortMappingConfig config={})
A pluggable network subsystem.
std::function< void(const PortMapResult &)> PortMapCallback
Callback invoked whenever a mapping is established, refreshed, removed or fails.
The narrow contract a subsystem needs from the node — and nothing more.
Shared types for automatic NAT port forwarding (UPnP IGD + NAT-PMP)
Result of a port mapping attempt.
Configuration for automatic port forwarding (see PortMappingService).