review fixes

pull/2221/head
dr7ana 7 months ago
parent 39c70b575d
commit 2ee70921bc

@ -14,28 +14,42 @@ option(WITH_WINDOWS_32 "build 32 bit windows" OFF)
# to .r[o]data section one after the other! # to .r[o]data section one after the other!
add_compile_options(-fno-ident -Wa,-mbig-obj) add_compile_options(-fno-ident -Wa,-mbig-obj)
function(expand_urls output source_file)
set(expanded)
foreach(mirror ${ARGN})
list(APPEND expanded "${mirror}/${source_file}")
endforeach()
set(${output} "${expanded}" PARENT_SCOPE)
endfunction()
function(add_static_target target ext_target libname)
add_library(${target} STATIC IMPORTED GLOBAL)
add_dependencies(${target} ${ext_target})
set_target_properties(${target} PROPERTIES
IMPORTED_LOCATION ${DEPS_DESTDIR}/lib/${libname}
)
endfunction()
if(EMBEDDED_CFG) if(EMBEDDED_CFG)
link_libatomic() link_libatomic()
endif() endif()
set(WINTUN_VERSION 0.14.1 CACHE STRING "wintun version") set(WINTUN_VERSION 0.14.1 CACHE STRING "wintun version")
set(WINTUN_MIRROR https://www.wintun.net/builds set(WINTUN_MIRROR ${LOCAL_MIRROR} https://www.wintun.net/builds
CACHE STRING "wintun mirror(s)") CACHE STRING "wintun mirror(s)")
set(WINTUN_SOURCE wintun-${WINTUN_VERSION}.zip) set(WINTUN_SOURCE wintun-${WINTUN_VERSION}.zip)
set(WINTUN_HASH SHA256=07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51 set(WINTUN_HASH SHA256=07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51
CACHE STRING "wintun source hash") CACHE STRING "wintun source hash")
set(WINDIVERT_VERSION 2.2.2-A CACHE STRING "windivert version") set(WINDIVERT_VERSION 2.2.2-A CACHE STRING "windivert version")
set(WINDIVERT_MIRROR https://reqrypt.org/download set(WINDIVERT_MIRROR ${LOCAL_MIRROR} https://reqrypt.org/download
CACHE STRING "windivert mirror(s)") CACHE STRING "windivert mirror(s)")
set(WINDIVERT_SOURCE WinDivert-${WINDIVERT_VERSION}.zip) set(WINDIVERT_SOURCE WinDivert-${WINDIVERT_VERSION}.zip)
set(WINDIVERT_HASH SHA512=92eb2ef98ced175d44de1cdb7c52f2ebc534b6a997926baeb83bfe94cba9287b438f796aff11f6163918bcdbc25bcd4e3383715f139f690d207ce219f846a345 set(WINDIVERT_HASH SHA512=92eb2ef98ced175d44de1cdb7c52f2ebc534b6a997926baeb83bfe94cba9287b438f796aff11f6163918bcdbc25bcd4e3383715f139f690d207ce219f846a345
CACHE STRING "windivert source hash") CACHE STRING "windivert source hash")
set(WINTUN_URL ${WINTUN_MIRROR}/${WINTUN_SOURCE} expand_urls(WINTUN_URL ${WINTUN_SOURCE} ${WINTUN_MIRROR})
CACHE STRING "wintun download url") expand_urls(WINDIVERT_URL ${WINDIVERT_SOURCE} ${WINDIVERT_MIRROR})
set(WINDIVERT_URL ${WINDIVERT_MIRROR}/${WINDIVERT_SOURCE}
CACHE STRING "windivert download url")
message(STATUS "Downloading wintun from ${WINTUN_URL}") message(STATUS "Downloading wintun from ${WINTUN_URL}")
file(DOWNLOAD ${WINTUN_URL} ${CMAKE_BINARY_DIR}/wintun.zip EXPECTED_HASH ${WINTUN_HASH}) file(DOWNLOAD ${WINTUN_URL} ${CMAKE_BINARY_DIR}/wintun.zip EXPECTED_HASH ${WINTUN_HASH})

@ -52,12 +52,12 @@ llarp_apple_init(llarp_apple_config* appleconf)
auto config = std::make_shared<llarp::Config>(config_dir); auto config = std::make_shared<llarp::Config>(config_dir);
fs::path config_path = config_dir / "lokinet.ini"; fs::path config_path = config_dir / "lokinet.ini";
if (!fs::exists(config_path)) if (!fs::exists(config_path))
llarp::ensureConfig(config_dir, config_path, /*overwrite=*/false, /*asRouter=*/false); llarp::ensure_config(config_dir, config_path, /*overwrite=*/false, /*asRouter=*/false);
config->Load(config_path); config->load(config_path);
// If no range is specified then go look for a free one, set that in the config, and then return // If no range is specified then go look for a free one, set that in the config, and then return
// it to the caller via the char* parameters. // it to the caller via the char* parameters.
auto& range = config->network.m_ifaddr; auto& range = config->network.if_addr;
if (!range.addr.h) if (!range.addr.h)
{ {
if (auto maybe = llarp::net::Platform::Default_ptr()->FindFreeRange()) if (auto maybe = llarp::net::Platform::Default_ptr()->FindFreeRange())
@ -84,7 +84,7 @@ llarp_apple_init(llarp_apple_config* appleconf)
appleconf->tunnel_ipv6_prefix = 48; appleconf->tunnel_ipv6_prefix = 48;
appleconf->upstream_dns[0] = '\0'; appleconf->upstream_dns[0] = '\0';
for (auto& upstream : config->dns.m_upstreamDNS) for (auto& upstream : config->dns.upstream_dns)
{ {
if (upstream.isIPv4()) if (upstream.isIPv4())
{ {

@ -35,7 +35,7 @@ namespace llarp::apple
if (enable) if (enable)
tun->ReconfigureDNS({SockAddr{127, 0, 0, 1, {dns_trampoline_port}}}); tun->ReconfigureDNS({SockAddr{127, 0, 0, 1, {dns_trampoline_port}}});
else else
tun->ReconfigureDNS(router->config()->dns.m_upstreamDNS); tun->ReconfigureDNS(router->config()->dns.upstream_dns);
trampoline_active = enable; trampoline_active = enable;
} }

@ -8,6 +8,7 @@
#include <llarp/constants/version.hpp> #include <llarp/constants/version.hpp>
#include <llarp/net/ip.hpp> #include <llarp/net/ip.hpp>
#include <llarp/net/net.hpp> #include <llarp/net/net.hpp>
#include <llarp/net/sock_addr.hpp>
#include <llarp/router_contact.hpp> #include <llarp/router_contact.hpp>
#include <llarp/service/name.hpp> #include <llarp/service/name.hpp>
#include <llarp/util/file.hpp> #include <llarp/util/file.hpp>
@ -33,7 +34,7 @@ namespace llarp
struct ConfigGenParameters_impl : public ConfigGenParameters struct ConfigGenParameters_impl : public ConfigGenParameters
{ {
const llarp::net::Platform* const llarp::net::Platform*
Net_ptr() const Net_ptr() const override
{ {
return llarp::net::Platform::Default_ptr(); return llarp::net::Platform::Default_ptr();
} }
@ -933,7 +934,6 @@ namespace llarp
}, },
[this](uint16_t arg) { public_port = net::port_t::from_host(arg); }); [this](uint16_t arg) { public_port = net::port_t::from_host(arg); });
// DISCUSS: does this need to be an optional?
auto parse_addr_for_link = [net_ptr](const std::string& arg) { auto parse_addr_for_link = [net_ptr](const std::string& arg) {
std::optional<oxen::quic::Address> maybe = std::nullopt; std::optional<oxen::quic::Address> maybe = std::nullopt;
std::string_view arg_v; std::string_view arg_v;
@ -946,14 +946,18 @@ namespace llarp
if (arg_v[0] == ':') if (arg_v[0] == ':')
{ {
uint16_t res = std::atoi(arg_v.substr(1).data()); uint16_t res;
if (auto rv = llarp::parse_int<uint16_t>(arg_v.substr(1), res); not rv)
res = DEFAULT_LISTEN_PORT;
maybe = oxen::quic::Address{""s, res ? res : DEFAULT_LISTEN_PORT}; maybe = oxen::quic::Address{""s, res};
} }
else if (auto pos = arg_v.find(':'); pos != arg_v.npos) else if (auto pos = arg_v.find(':'); pos != arg_v.npos)
{ {
auto h = arg_v.substr(0, pos); auto h = arg_v.substr(0, pos);
uint16_t p = std::atoi(arg_v.substr(pos + 1).data()); uint16_t p;
if (auto rv = llarp::parse_int<uint16_t>(arg_v.substr(pos + 1), p); not rv)
p = DEFAULT_LISTEN_PORT;
maybe = oxen::quic::Address{std::string{h}, p}; maybe = oxen::quic::Address{std::string{h}, p};
@ -968,7 +972,7 @@ namespace llarp
maybe = oxen::quic::Address{*maybe_ifname}; maybe = oxen::quic::Address{*maybe_ifname};
} }
if (maybe->port() == 0) if (maybe && maybe->port() == 0)
maybe = oxen::quic::Address{maybe->host(), DEFAULT_LISTEN_PORT}; maybe = oxen::quic::Address{maybe->host(), DEFAULT_LISTEN_PORT};
return maybe; return maybe;
@ -987,9 +991,9 @@ namespace llarp
"public IP address and use that IP (and will exit with an error if no such IP is found", "public IP address and use that IP (and will exit with an error if no such IP is found",
"on the system). If port is omitted then lokinet defaults to 1090.", "on the system). If port is omitted then lokinet defaults to 1090.",
"", "",
"Note: only one address will be accepted. If this option is not specified, it will " "Note: only one address will be accepted. If this option is not specified, it will ",
"default", "default",
"to the inbound or outbound value. Conversely, specifying this option will supercede " "to the inbound or outbound value. Conversely, specifying this option will supercede ",
"the", "the",
"deprecated inbound/outbound opts.", "deprecated inbound/outbound opts.",
"", "",
@ -1016,6 +1020,7 @@ namespace llarp
"inbound", "inbound",
RelayOnly, RelayOnly,
MultiValue, MultiValue,
Hidden,
Comment{ Comment{
"********** DEPRECATED **********", "********** DEPRECATED **********",
"Note: the new API dictates the lokinet bind address through the 'listen' config", "Note: the new API dictates the lokinet bind address through the 'listen' config",
@ -1097,50 +1102,47 @@ namespace llarp
addr = oxen::quic::Address{""s, DEFAULT_LISTEN_PORT}; addr = oxen::quic::Address{""s, DEFAULT_LISTEN_PORT};
}); });
// DISCUSS: drop this shit? conf.add_undeclared_handler(
// conf.add_undeclared_handler( "bind", [this, net_ptr](std::string_view, std::string_view key, std::string_view val) {
// "bind", [this, net_ptr](std::string_view, std::string_view key, std::string_view val) { if (using_new_api)
// LogWarn( throw std::runtime_error{"USE THE NEW API -- SPECIFY LOCAL ADDRESS UNDER [LISTEN]"};
// "using the [bind] section with *=/IP=/INTERFACE= is deprecated; use the inbound= "
// "and/or outbound= settings instead"); log::warning(
// std::optional<SockAddr> addr; logcat, "Using the [bind] section is beyond deprecated; use [listen] instead");
// // special case: wildcard for outbound
// if (key == "*") // special case: wildcard for outbound
// { if (key == "*")
// addr = net_ptr->Wildcard(); {
// // set port, zero is acceptable here. uint16_t port{0};
// if (auto port = std::stoi(std::string{val});
// port < std::numeric_limits<uint16_t>::max()) if (auto rv = llarp::parse_int<uint16_t>(val, port); not rv)
// { log::warning(
// addr->setPort(port); logcat, "Could not parse port; stop using this deprecated handler you nonce");
// }
// else addr = oxen::quic::Address{"", port}; // TODO: drop the "" after bumping libquic
// throw std::invalid_argument{fmt::format("invalid port value: '{}'", val)}; return;
// outbound_links.emplace_back(std::move(*addr)); }
// return;
// } oxen::quic::Address temp;
// // try as interface name first // try as interface name first
// addr = net_ptr->GetInterfaceAddr(key, AF_INET); auto saddr = net_ptr->GetInterfaceAddr(key, AF_INET);
// if (addr and net_ptr->IsLoopbackAddress(addr->getIP()))
// throw std::invalid_argument{fmt::format("{} is a loopback interface", key)}; if (saddr and net_ptr->IsLoopbackAddress(saddr->getIP()))
// // try as ip address next, throws if unable to parse throw std::invalid_argument{fmt::format("{} is a loopback interface", key)};
// if (not addr)
// { temp = oxen::quic::Address{saddr->in()};
// addr = SockAddr{key, huint16_t{0}};
// if (net_ptr->IsLoopbackAddress(addr->getIP())) if (temp.is_addressable())
// throw std::invalid_argument{fmt::format("{} is a loopback address", key)}; {
// } addr = std::move(temp);
// // parse port and set if acceptable non zero value return;
// if (auto port = std::stoi(std::string{val}); }
// port and port < std::numeric_limits<uint16_t>::max())
// { log::warning(
// addr->setPort(port); logcat,
// } "Could not parse address values; stop using this deprecated handler you nonce");
// else addr = oxen::quic::Address{""s, DEFAULT_LISTEN_PORT};
// throw std::invalid_argument{fmt::format("invalid port value: '{}'", val)}; });
// inbound_listen_addrs.emplace_back(std::move(*addr));
// });
} }
void void

@ -18,16 +18,16 @@ namespace llarp
void void
SockAddr::init() SockAddr::init()
{ {
llarp::Zero(&m_addr, sizeof(m_addr)); llarp::Zero(&addr6, sizeof(addr6));
m_addr.sin6_family = AF_INET6; addr6.sin6_family = AF_INET6;
llarp::Zero(&m_addr4, sizeof(m_addr4)); llarp::Zero(&addr4, sizeof(addr4));
m_addr4.sin_family = AF_INET; addr4.sin_family = AF_INET;
} }
void void
SockAddr::applyIPv4MapBytes() SockAddr::applyIPv4MapBytes()
{ {
std::memcpy(m_addr.sin6_addr.s6_addr, ipv4_map_prefix.data(), ipv4_map_prefix.size()); std::memcpy(addr6.sin6_addr.s6_addr, ipv4_map_prefix.data(), ipv4_map_prefix.size());
} }
SockAddr::SockAddr() SockAddr::SockAddr()
@ -86,7 +86,7 @@ namespace llarp
SockAddr& SockAddr&
SockAddr::operator=(const SockAddr& other) SockAddr::operator=(const SockAddr& other)
{ {
*this = other.m_addr; *this = other.addr6;
return *this; return *this;
} }
@ -121,10 +121,10 @@ namespace llarp
applyIPv4MapBytes(); applyIPv4MapBytes();
// avoid byte order conversion (this is NBO -> NBO) // avoid byte order conversion (this is NBO -> NBO)
memcpy(m_addr.sin6_addr.s6_addr + 12, &other.sin_addr.s_addr, sizeof(in_addr)); memcpy(addr6.sin6_addr.s6_addr + 12, &other.sin_addr.s_addr, sizeof(in_addr));
m_addr.sin6_port = other.sin_port; addr6.sin6_port = other.sin_port;
m_addr4.sin_addr.s_addr = other.sin_addr.s_addr; addr4.sin_addr.s_addr = other.sin_addr.s_addr;
m_addr4.sin_port = other.sin_port; addr4.sin_port = other.sin_port;
m_empty = false; m_empty = false;
return *this; return *this;
@ -140,7 +140,7 @@ namespace llarp
{ {
init(); init();
memcpy(&m_addr, &other, sizeof(sockaddr_in6)); memcpy(&addr6, &other, sizeof(sockaddr_in6));
if (IPRange::V4MappedRange().Contains(asIPv6())) if (IPRange::V4MappedRange().Contains(asIPv6()))
{ {
setIPv4( setIPv4(
@ -148,7 +148,7 @@ namespace llarp
other.sin6_addr.s6_addr[13], other.sin6_addr.s6_addr[13],
other.sin6_addr.s6_addr[14], other.sin6_addr.s6_addr[14],
other.sin6_addr.s6_addr[15]); other.sin6_addr.s6_addr[15]);
m_addr4.sin_port = m_addr.sin6_port; addr4.sin_port = addr6.sin6_port;
} }
m_empty = false; m_empty = false;
@ -164,11 +164,11 @@ namespace llarp
SockAddr::operator=(const in6_addr& other) SockAddr::operator=(const in6_addr& other)
{ {
init(); init();
memcpy(&m_addr.sin6_addr.s6_addr, &other.s6_addr, sizeof(m_addr.sin6_addr.s6_addr)); memcpy(&addr6.sin6_addr.s6_addr, &other.s6_addr, sizeof(addr6.sin6_addr.s6_addr));
if (IPRange::V4MappedRange().Contains(asIPv6())) if (IPRange::V4MappedRange().Contains(asIPv6()))
{ {
setIPv4(other.s6_addr[12], other.s6_addr[13], other.s6_addr[14], other.s6_addr[15]); setIPv4(other.s6_addr[12], other.s6_addr[13], other.s6_addr[14], other.s6_addr[15]);
m_addr4.sin_port = m_addr.sin6_port; addr4.sin_port = addr6.sin6_port;
} }
m_empty = false; m_empty = false;
@ -177,48 +177,48 @@ namespace llarp
SockAddr::operator const sockaddr*() const SockAddr::operator const sockaddr*() const
{ {
return isIPv4() ? reinterpret_cast<const sockaddr*>(&m_addr4) return isIPv4() ? reinterpret_cast<const sockaddr*>(&addr4)
: reinterpret_cast<const sockaddr*>(&m_addr); : reinterpret_cast<const sockaddr*>(&addr6);
} }
SockAddr::operator const sockaddr_in*() const SockAddr::operator const sockaddr_in*() const
{ {
return &m_addr4; return &addr4;
} }
SockAddr::operator const sockaddr_in6*() const SockAddr::operator const sockaddr_in6*() const
{ {
return &m_addr; return &addr6;
} }
size_t size_t
SockAddr::sockaddr_len() const SockAddr::sockaddr_len() const
{ {
return isIPv6() ? sizeof(m_addr) : sizeof(m_addr4); return isIPv6() ? sizeof(addr6) : sizeof(addr4);
} }
bool bool
SockAddr::operator<(const SockAddr& other) const SockAddr::operator<(const SockAddr& other) const
{ {
return m_addr < other.m_addr; return addr6 < other.addr6;
} }
bool bool
SockAddr::operator==(const SockAddr& other) const SockAddr::operator==(const SockAddr& other) const
{ {
return m_addr == other.m_addr; return addr6 == other.addr6;
} }
huint128_t huint128_t
SockAddr::asIPv6() const SockAddr::asIPv6() const
{ {
return net::In6ToHUInt(m_addr.sin6_addr); return net::In6ToHUInt(addr6.sin6_addr);
} }
huint32_t huint32_t
SockAddr::asIPv4() const SockAddr::asIPv4() const
{ {
const nuint32_t n{m_addr4.sin_addr.s_addr}; const nuint32_t n{addr4.sin_addr.s_addr};
return ToHost(n); return ToHost(n);
} }
@ -241,7 +241,7 @@ namespace llarp
if (splits.size() > 2) if (splits.size() > 2)
{ {
std::string data{str}; std::string data{str};
if (inet_pton(AF_INET6, data.c_str(), m_addr.sin6_addr.s6_addr) == -1) if (inet_pton(AF_INET6, data.c_str(), addr6.sin6_addr.s6_addr) == -1)
throw std::runtime_error{"invalid ip6 address: " + data}; throw std::runtime_error{"invalid ip6 address: " + data};
return; return;
} }
@ -290,11 +290,11 @@ namespace llarp
if (isIPv4()) if (isIPv4())
{ {
// IPv4 mapped addrs // IPv4 mapped addrs
inet_ntop(AF_INET, &m_addr4.sin_addr.s_addr, buf.data(), buf.size()); inet_ntop(AF_INET, &addr4.sin_addr.s_addr, buf.data(), buf.size());
return buf.data(); return buf.data();
} }
inet_ntop(AF_INET6, &m_addr.sin6_addr.s6_addr, buf.data(), buf.size()); inet_ntop(AF_INET6, &addr6.sin6_addr.s6_addr, buf.data(), buf.size());
if (not ipv6_brackets) if (not ipv6_brackets)
return buf.data(); return buf.data();
@ -321,7 +321,7 @@ namespace llarp
nuint32_t nuint32_t
SockAddr::getIPv4() const SockAddr::getIPv4() const
{ {
return {m_addr4.sin_addr.s_addr}; return {addr4.sin_addr.s_addr};
} }
nuint128_t nuint128_t
@ -331,7 +331,7 @@ namespace llarp
// Explicit cast to void* here to avoid non-trivial type copying warnings (technically this // Explicit cast to void* here to avoid non-trivial type copying warnings (technically this
// isn't trivial because of the zeroing default constructor, but it's trivial enough that this // isn't trivial because of the zeroing default constructor, but it's trivial enough that this
// copy is safe). // copy is safe).
std::memcpy(static_cast<void*>(&a), &m_addr.sin6_addr, 16); std::memcpy(static_cast<void*>(&a), &addr6.sin6_addr, 16);
return a; return a;
} }
@ -346,13 +346,13 @@ namespace llarp
void void
SockAddr::setIPv4(nuint32_t ip) SockAddr::setIPv4(nuint32_t ip)
{ {
uint8_t* ip6 = m_addr.sin6_addr.s6_addr; uint8_t* ip6 = addr6.sin6_addr.s6_addr;
llarp::Zero(ip6, sizeof(m_addr.sin6_addr.s6_addr)); llarp::Zero(ip6, sizeof(addr6.sin6_addr.s6_addr));
applyIPv4MapBytes(); applyIPv4MapBytes();
std::memcpy(ip6 + 12, &ip, 4); std::memcpy(ip6 + 12, &ip, 4);
m_addr4.sin_addr.s_addr = ip.n; addr4.sin_addr.s_addr = ip.n;
m_empty = false; m_empty = false;
} }
@ -365,8 +365,8 @@ namespace llarp
void void
SockAddr::setIPv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d) SockAddr::setIPv4(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
{ {
uint8_t* ip6 = m_addr.sin6_addr.s6_addr; uint8_t* ip6 = addr6.sin6_addr.s6_addr;
llarp::Zero(ip6, sizeof(m_addr.sin6_addr.s6_addr)); llarp::Zero(ip6, sizeof(addr6.sin6_addr.s6_addr));
applyIPv4MapBytes(); applyIPv4MapBytes();
@ -375,7 +375,7 @@ namespace llarp
ip6[14] = c; ip6[14] = c;
ip6[15] = d; ip6[15] = d;
const auto ip = ipaddr_ipv4_bits(a, b, c, d); const auto ip = ipaddr_ipv4_bits(a, b, c, d);
m_addr4.sin_addr.s_addr = htonl(ip.h); addr4.sin_addr.s_addr = htonl(ip.h);
m_empty = false; m_empty = false;
} }
@ -388,23 +388,23 @@ namespace llarp
void void
SockAddr::setIPv6(nuint128_t ip) SockAddr::setIPv6(nuint128_t ip)
{ {
std::memcpy(&m_addr.sin6_addr, &ip, sizeof(m_addr.sin6_addr)); std::memcpy(&addr6.sin6_addr, &ip, sizeof(addr6.sin6_addr));
if (isIPv4()) if (isIPv4())
{ {
setIPv4( setIPv4(
m_addr.sin6_addr.s6_addr[12], addr6.sin6_addr.s6_addr[12],
m_addr.sin6_addr.s6_addr[13], addr6.sin6_addr.s6_addr[13],
m_addr.sin6_addr.s6_addr[14], addr6.sin6_addr.s6_addr[14],
m_addr.sin6_addr.s6_addr[15]); addr6.sin6_addr.s6_addr[15]);
m_addr4.sin_port = m_addr.sin6_port; addr4.sin_port = addr6.sin6_port;
} }
} }
void void
SockAddr::setPort(nuint16_t port) SockAddr::setPort(nuint16_t port)
{ {
m_addr.sin6_port = port.n; addr6.sin6_port = port.n;
m_addr4.sin_port = port.n; addr4.sin_port = port.n;
} }
void void
@ -416,7 +416,7 @@ namespace llarp
net::port_t net::port_t
SockAddr::port() const SockAddr::port() const
{ {
return net::port_t{m_addr.sin6_port}; return net::port_t{addr6.sin6_port};
} }
} // namespace llarp } // namespace llarp

@ -177,10 +177,21 @@ namespace llarp
huint32_t huint32_t
asIPv4() const; asIPv4() const;
const sockaddr_in*
in()
{
return &addr4;
}
const sockaddr_in6*
in6()
{
return &addr6;
}
private: private:
bool m_empty = true; bool m_empty = true;
sockaddr_in6 m_addr; sockaddr_in6 addr6;
sockaddr_in m_addr4; sockaddr_in addr4;
void void
init(); init();

Loading…
Cancel
Save