A dialable transport endpoint: a numeric IP + port. More...
#include "util/rats_export.h"#include "core/ip_address.h"#include <cstdint>#include <functional>#include <optional>#include <string>#include <string_view>Go to the source code of this file.
Classes | |
| struct | librats::Address |
| struct | std::hash< librats::Address > |
Namespaces | |
| namespace | librats |
| namespace | std |
| STL namespace. | |
A dialable transport endpoint: a numeric IP + port.
The single ip+port endpoint type used throughout the library — by the node layer (dialing, peer info, reconnection) and by the lower-level engines (DHT, BitTorrent trackers, STUN/TURN). It lives in core/ because it is a foundational transport primitive that every layer above depends on.
ip is an IpAddress: a strictly numeric, resolved address stored as raw bytes (see core/ip_address.h) — NOT a hostname and NOT a string. An unresolved "host:port" a user typed is a HostEndpoint (core/host_endpoint.h) and only becomes an Address once the resolver runs. This keeps Address a small, allocation-free, trivially-copyable value that hashes and compares by its bytes.
IPv4 endpoints serialise as host:port; IPv6 endpoints serialise in bracketed [ip]:port form so the colons in the address are never confused with the port separator. parse() accepts both forms and is the exact inverse of to_string().
Definition in file address.h.