#include <nat_status.h>
Public Member Functions | |
| void | record_udp_observation (const PeerId &reporter, const Address &external, bool is_own_address) |
Record that reporter observed our datagram socket at external. | |
| 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 with it. | |
| void | reset () |
| Drop everything. | |
| size_t | observation_count () const |
| How many distinct peers have reported an endpoint. | |
| std::vector< Address > | external_udp_endpoints () const override |
| Endpoints peers have reported observing our shared datagram socket at, most recently confirmed first. | |
| NatMapping | udp_mapping () const override |
| What the observations so far say about the mapping. | |
Public Member Functions inherited from librats::ExternalAddressService | |
| virtual | ~ExternalAddressService ()=default |
Static Public Attributes | |
| static constexpr size_t | kMaxObservers = 32 |
| Observations kept. | |
Definition at line 77 of file nat_status.h.
|
overridevirtual |
Endpoints peers have reported observing our shared datagram socket at, most recently confirmed first.
Empty until at least one peer has said so over a datagram link. These are what a hole punch advertises to its target.
Implements librats::ExternalAddressService.
| void librats::NatStatus::forget | ( | const PeerId & | reporter | ) |
Forget a reporter's observation — its link is gone and what it saw may have been a mapping that died with it.
| size_t librats::NatStatus::observation_count | ( | ) | const |
How many distinct peers have reported an endpoint.
| void librats::NatStatus::record_udp_observation | ( | const PeerId & | reporter, |
| const Address & | external, | ||
| bool | is_own_address | ||
| ) |
Record that reporter observed our datagram socket at external.
| is_own_address | whether that endpoint is one this node holds locally (the caller knows its interfaces; this class does not) — the signal that there is no NAT in the path. |
| void librats::NatStatus::reset | ( | ) |
Drop everything.
The node is restarting, or the host's network changed and every mapping learned under the old one is now a guess.
|
overridevirtual |
What the observations so far say about the mapping.
Implements librats::ExternalAddressService.
|
staticconstexpr |
Observations kept.
One per reporting peer, so a node with many peers does not grow this without bound and a single peer cannot flood it either — a second report from the same peer replaces its first rather than adding to it.
Definition at line 82 of file nat_status.h.