27#include "librats/util/rats_export.h"
77 mutable std::mutex mutex_;
78 std::unique_ptr<UpnpClient> upnp_;
79 std::unique_ptr<NatPmpClient> natpmp_;
80 std::string mapped_external_ip_;
81 uint16_t mapped_external_tcp_port_ = 0;
82 uint16_t mapped_external_udp_port_ = 0;
83 bool double_nat_warned_ =
false;
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(PortMapProtocol protocol=PortMapProtocol::TCP) const
The public endpoint peers should reach us on over protocol, once a backend reports a usable (genuinel...
PortMappingService(PortMappingConfig config={})
A pluggable network subsystem.
PortMapProtocol
Transport protocol of a port mapping.
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).