37#include "librats/util/rats_export.h"
43#include <unordered_map>
82 static constexpr size_t kMaxObservers = 32;
109 bool is_own_address =
false;
113 mutable std::mutex mutex_;
114 std::unordered_map<PeerId, Observation, PeerId::Hash> seen_;
115 uint64_t next_seq_ = 1;
A dialable transport endpoint: a numeric IP + port.
The read side, published in the node's ServiceRegistry so a NAT-traversal module can consult it witho...
virtual std::vector< Address > external_udp_endpoints() const =0
Endpoints peers have reported observing our shared datagram socket at, most recently confirmed first.
virtual NatMapping udp_mapping() const =0
What the observations so far say about the mapping.
virtual ~ExternalAddressService()=default
NatMapping udp_mapping() const override
What the observations so far say about the mapping.
void forget(const PeerId &reporter)
Forget a reporter's observation — its link is gone and what it saw may have been a mapping that died ...
size_t observation_count() const
How many distinct peers have reported an endpoint.
void record_udp_observation(const PeerId &reporter, const Address &external, bool is_own_address)
Record that reporter observed our datagram socket at external.
void reset()
Drop everything.
std::vector< Address > external_udp_endpoints() const override
Endpoints peers have reported observing our shared datagram socket at, most recently confirmed first.
const char * to_string(NatMapping) noexcept
NatMapping
How the NAT in front of our shared datagram socket maps it, as far as the mesh has been able to show.
@ EndpointIndependent
one external port for every destination — punchable
@ Unknown
not enough independent observations yet
@ Open
no NAT: peers see us at an address we hold ourselves
@ EndpointDependent
a fresh mapping per destination (symmetric) — not punchable
Self-certifying peer identity.