10#include <sys/socket.h>
12#include <netinet/in.h>
83 const std::variant<sockaddr_in, sockaddr_in6>&
Addr()
const;
94 std::pair<const sockaddr*, int>
RawAddr()
const;
135 std::variant<sockaddr_in, sockaddr_in6> Addr_ = {};
std::pair< const sockaddr *, int > RawAddr() const
Returns a pointer to the raw sockaddr structure and its size in bytes.
TAddress(sockaddr_in addr)
Constructs an address from an IPv4 sockaddr_in structure.
int Domain() const
Gets the domain (address family) of the stored address.
TAddress()=default
Default constructor. Creates an empty address.
const std::variant< sockaddr_in, sockaddr_in6 > & Addr() const
Retrieves the internal variant storing the address.
TAddress(const std::string &addr, int port)
Constructs an address from a string representation and port.
TAddress(sockaddr *addr, socklen_t len)
Constructs an address from a generic sockaddr pointer.
std::string ToString() const
Converts the address to a human-readable string format.
TAddress WithPort(int port) const
Returns a new TAddress with the same IP but a different port.
TAddress(sockaddr_in6 addr)
Constructs an address from an IPv6 sockaddr_in6 structure.
bool operator==(const TAddress &other) const
Equality operator for TAddress.