#include <address.h>
|
| | Address ()=default |
| |
| | Address (IpAddress ip, uint16_t port) |
| |
| | Address (std::string_view numeric_ip, uint16_t port) |
| | Build from a numeric IP literal + port.
|
| |
| std::string | to_string () const |
| | IPv6 endpoints serialise bracketed; everything else plain. "" ip → ":port".
|
| |
| bool | is_valid () const noexcept |
| | A usable dial target: a specified ip and a non-zero port.
|
| |
| bool | operator== (const Address &o) const noexcept |
| |
| bool | operator!= (const Address &o) const noexcept |
| |
| bool | operator< (const Address &o) const noexcept |
| |
|
| static std::optional< Address > | parse (std::string_view text) |
| | Parse "host:port" or "[ipv6]:port".
|
| |
|
| IpAddress | ip |
| |
| uint16_t | port = 0 |
| |
Definition at line 34 of file address.h.
◆ Address() [1/3]
| librats::Address::Address |
( |
| ) |
|
|
default |
◆ Address() [2/3]
| librats::Address::Address |
( |
IpAddress |
ip, |
|
|
uint16_t |
port |
|
) |
| |
|
inline |
◆ Address() [3/3]
| librats::Address::Address |
( |
std::string_view |
numeric_ip, |
|
|
uint16_t |
port |
|
) |
| |
Build from a numeric IP literal + port.
The literal MUST be a valid IPv4/IPv6 address (hostnames belong in a HostEndpoint); an invalid literal yields an unspecified ip (asserts in debug builds). Kept for the many call sites of the form Address{"1.2.3.4", 80}.
◆ is_valid()
| bool librats::Address::is_valid |
( |
| ) |
const |
|
inlinenoexcept |
A usable dial target: a specified ip and a non-zero port.
Definition at line 57 of file address.h.
◆ operator!=()
| bool librats::Address::operator!= |
( |
const Address & |
o | ) |
const |
|
inlinenoexcept |
◆ operator<()
| bool librats::Address::operator< |
( |
const Address & |
o | ) |
const |
|
inlinenoexcept |
◆ operator==()
| bool librats::Address::operator== |
( |
const Address & |
o | ) |
const |
|
inlinenoexcept |
◆ parse()
| static std::optional< Address > librats::Address::parse |
( |
std::string_view |
text | ) |
|
|
static |
Parse "host:port" or "[ipv6]:port".
Returns nullopt if the port is missing/invalid, if the host is not a numeric IP literal, or for a bare (unbracketed) IPv6 literal whose own colons make the port ambiguous. Exact inverse of to_string().
◆ to_string()
| std::string librats::Address::to_string |
( |
| ) |
const |
IPv6 endpoints serialise bracketed; everything else plain. "" ip → ":port".
◆ ip
| IpAddress librats::Address::ip |
◆ port
| uint16_t librats::Address::port = 0 |
The documentation for this struct was generated from the following file: