4#include <aegis2d/net/export.hpp>
32 std::uint16_t port) noexcept;
39 std::uint16_t port) noexcept;
44 [[nodiscard]] static
Endpoint loopback(
std::uint16_t port) noexcept;
55 [[nodiscard]]
bool is_v6() const noexcept;
59 [[nodiscard]]
std::span<const
std::uint8_t> address_bytes() const noexcept;
63 [[nodiscard]]
std::uint16_t port() const noexcept;
67 [[nodiscard]]
std::
string address() const;
71 [[nodiscard]]
std::
string to_string() const;
75 bool operator==(const
Endpoint&) const = default;
78 std::array<
std::uint8_t, 16> bytes_{};
79 std::uint16_t port_ = 0;
89struct hash<
aegis2d::net::Endpoint> {
94 std::uint64_t hash = 0xCBF29CE484222325ULL;
95 const auto mix = [&hash](std::uint64_t byte) { hash = (hash ^ byte) * 0x100000001B3ULL; };
96 mix(endpoint.
is_v6() ? 6U : 4U);
100 mix(endpoint.
port() & 0xFFU);
101 mix(endpoint.
port() >> 8U);
102 return static_cast<std::size_t
>(hash);
IPv4 or IPv6 address and port of a peer.
Definition endpoint.hpp:22
bool is_v6() const noexcept
Tells whether the address is IPv6.
std::span< const std::uint8_t > address_bytes() const noexcept
Bytes of the address, most significant first.
Endpoint() noexcept=default
The unspecified IPv4 endpoint, 0.0.0.0:0.
std::uint16_t port() const noexcept
Port number.
Binary serialization, UDP/TCP sockets and the network thread.
Definition binary.hpp:14
Root namespace of the engine.
Definition audio.hpp:17
Definition endpoint.hpp:85