mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
0f21eeccb0
* rework net code for ip ranges to be cleaner * clean up endpoint auth code * refactor config to validate network configs before setting up endpoints * remove buildone from path/pathbuilder.cpp so we don't spam connection attempts
28 lines
469 B
C++
28 lines
469 B
C++
#pragma once
|
|
#include <net/net_int.hpp>
|
|
#include <cstdint>
|
|
|
|
namespace llarp::net
|
|
{
|
|
huint128_t
|
|
In6ToHUInt(in6_addr addr);
|
|
|
|
in6_addr
|
|
HUIntToIn6(huint128_t x);
|
|
|
|
constexpr huint128_t
|
|
ExpandV4(huint32_t x)
|
|
{
|
|
return huint128_t{0x0000'ffff'0000'0000UL} | huint128_t{x.h};
|
|
}
|
|
|
|
constexpr huint32_t
|
|
TruncateV6(huint128_t x)
|
|
{
|
|
huint32_t ret = {0};
|
|
ret.h = (uint32_t)(x.h & 0x0000'0000'ffff'ffffUL);
|
|
return ret;
|
|
}
|
|
|
|
} // namespace llarp::net
|