Clang format include sorting + CMake

- includes are now sorted in consistent, logical order; first step in an attempt to fix the tomfoolery (no relation to Tom) brought in by include-what-you-use
- shuffled around some cmake linking to simplify dependency graph
- superfluous files removed
pull/2213/head
dr7ana 7 months ago
parent bda8b211dd
commit 46ad8d4058

@ -33,10 +33,12 @@ BraceWrapping:
SplitEmptyNamespace: false
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializersBeforeComma: 'true'
ColumnLimit: 100
Cpp11BracedListStyle: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
NamespaceIndentation: All
PenaltyBreakString: '3'
SortIncludes: CaseInsensitive
SpaceBeforeParens: ControlStatements
SpacesInAngles: 'false'
SpacesInContainerLiterals: 'false'
@ -44,8 +46,6 @@ SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
UseTab: Never
SortIncludes: false
ColumnLimit: 100
# treat pointers and reference declarations as if part of the type
DerivePointerAlignment: false
@ -55,7 +55,21 @@ PointerAlignment: Left
BinPackParameters: 'false'
BinPackArguments: 'false'
# TODO: uncomment me when we are reading to rearrange the header includes
# IncludeBlocks: Regroup
# IncludeCategories: 'llarp/'
# Include block sorting in the following order:
# - Main header for source file (clang-format default prioritizes this first)
# - Relative path includes in quotation marks
# - Absolute path includes in angle brackets
# - External dependencies
# - System dependencies
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '".+\.h'
Priority: 2
- Regex: '^<llarp'
Priority: 3
- Regex: '<winsock2\.h>'
Priority: 4
- Regex: '^<.*\.h(pp)?>$'
Priority: 5
- Regex: '(<)(.)+(>)'
Priority: 6

@ -262,7 +262,7 @@ add_subdirectory(external)
# interface library for setting common includes, linkage and flags
add_library(lokinet-base INTERFACE)
target_include_directories(lokinet-base INTERFACE . include)
target_link_libraries(lokinet-base INTERFACE quic)
target_link_libraries(lokinet-base INTERFACE quic nlohmann_json::nlohmann_json)
if(WITH_SYSTEMD AND (NOT ANDROID))
if(NOT SD_FOUND)

@ -1,6 +1,4 @@
set(GRAPHVIZ_GRAPH_NAME "graph.dot" CACHE STRING "")
# set(GRAPHVIZ_MODULE_LIBS OFF CACHE BOOL "")
# set(GRAPHVIZ_EXTERNAL_LIBS OFF CACHE BOOL "")
set(GRAPHVIZ_GENERATE_PER_TARGET FALSE CACHE BOOL "")
set(GRAPHVIZ_GENERATE_DEPENDERS FALSE CACHE BOOL "")
set(GRAPHVIZ_OBJECT_LIBS OFF CACHE BOOL "")

@ -1,6 +1,5 @@
#include <libntrup/ntru.h>
#include "libntrup/ntru_api.h"
#include <libntrup/ntru_api.h>
#ifdef __x86_64__
#include <cpuid.h>

@ -1,9 +1,9 @@
#include <cpr/cpr.h>
#include <llarp/constants/files.hpp>
#include <llarp/constants/version.hpp>
#include <llarp/util/fs.hpp>
#include <cpr/cpr.h>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
@ -93,9 +93,9 @@ main(int argc, char* argv[])
{
return fail("failed to fetch '" + bootstrap_url + "' HTTP " + std::to_string(resp.status_code));
}
std::stringstream ss;
ss << resp.text;
std::string data{ss.str()};
const auto& data = resp.text;
if (data[0] == 'l' or data[0] == 'd')
{
try

@ -1,18 +1,19 @@
#include <future>
#include <vector>
#include <string_view>
#include <fmt/core.h>
#include <CLI/CLI.hpp>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <oxenmq/oxenmq.h>
#include <future>
#include <string_view>
#include <vector>
#ifdef _WIN32
// add the unholy windows headers for iphlpapi
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <strsafe.h>
#include <ws2tcpip.h>
#else
#endif

@ -1,49 +1,35 @@
#include <llarp.hpp>
#include <llarp/config/config.hpp> // for ensure_config
#include <llarp/constants/files.hpp>
#include <llarp/constants/platform.hpp>
#include <llarp/constants/version.hpp>
#include <llarp.hpp>
#include <llarp/util/lokinet_init.h>
#include <llarp/ev/ev.hpp>
#include <llarp/util/exceptions.hpp>
#include <bits/chrono.h>
#ifdef _WIN32
#include <llarp/win32/service_manager.hpp>
#include <dbghelp.h>
#else
#include <llarp/util/service_manager.hpp>
#endif
#include <llarp/util/logging.hpp>
#include <llarp/util/lokinet_init.h>
#include <llarp/util/thread/threading.hpp>
#include <CLI/CLI.hpp>
#include <fmt/core.h>
#include <oxen/log.hpp>
#include <csignal>
#include <string>
#include <iostream>
#include <thread>
#include <future>
#include <cstdlib>
#include <exception>
#include <filesystem>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <thread>
#include <utility>
#include "CLI/Error.hpp"
#include "CLI/Option.hpp"
#include "CLI/impl/App_inl.hpp"
#include "CLI/impl/Option_inl.hpp"
#include "fmt/core.h"
#include "llarp/constants/files.hpp"
#include "llarp/constants/platform.hpp"
#include "llarp/ev/ev.hpp"
#include "llarp/util/logging.hpp"
#include "llarp/util/thread/threading.hpp"
#include "oxen/log.hpp"
#include "oxen/log/catlogger.hpp"
#include "oxen/log/level.hpp"
#include "oxen/log/ring_buffer_sink.hpp"
#include "oxen/log/type.hpp"
#include "spdlog/common.h"
#ifdef _WIN32
#include <llarp/win32/service_manager.hpp>
#include <dbghelp.h>
#else
#include <llarp/util/service_manager.hpp>
#endif
namespace
{
@ -290,9 +276,8 @@ namespace
const auto flags =
(MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithFullMemoryInfo | MiniDumpWithHandleData | MiniDumpWithUnloadedModules | MiniDumpWithThreadInfo);
std::stringstream ss;
ss << "C:\\ProgramData\\lokinet\\crash-" << llarp::time_now_ms().count() << ".dmp";
const std::string fname = ss.str();
const std::string fname =
"C:\\ProgramData\\lokinet\\crash-{}.dump"_format(llarp::time_now_ms().count());
HANDLE hDumpFile;
SYSTEMTIME stLocalTime;
GetLocalTime(&stLocalTime);
@ -525,30 +510,8 @@ namespace
if (ctx and ctx->IsUp() and not ctx->LooksAlive())
{
auto deadlock_cat = llarp::log::Cat("deadlock");
for (const auto& wtf :
{"you have been visited by the mascot of the deadlocked router.",
"⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠄⠄⠄⠄",
"⠄⠄⠄⠄⠄⢀⣀⣀⡀⠄⠄⠄⡠⢲⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠄⠄",
"⠄⠄⠄⠔⣈⣀⠄⢔⡒⠳⡴⠊⠄⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⣿⣿⣧⠄⠄",
"⠄⢜⡴⢑⠖⠊⢐⣤⠞⣩⡇⠄⠄⠄⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠄⠝⠛⠋⠐",
"⢸⠏⣷⠈⠄⣱⠃⠄⢠⠃⠐⡀⠄⠄⠄⠄⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠸⠄⠄⠄⠄",
"⠈⣅⠞⢁⣿⢸⠘⡄⡆⠄⠄⠈⠢⡀⠄⠄⠄⠄⠄⠄⠉⠙⠛⠛⠛⠉⠉⡀⠄⠡⢀⠄⣀",
"⠄⠙⡎⣹⢸⠄⠆⢘⠁⠄⠄⠄⢸⠈⠢⢄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠃⠄⠄⠄⠄⠄",
"⠄⠄⠑⢿⠈⢆⠘⢼⠄⠄⠄⠄⠸⢐⢾⠄⡘⡏⠲⠆⠠⣤⢤⢤⡤⠄⣖⡇⠄⠄⠄⠄⠄",
"⣴⣶⣿⣿⣣⣈⣢⣸⠄⠄⠄⠄⡾⣷⣾⣮⣤⡏⠁⠘⠊⢠⣷⣾⡛⡟⠈⠄⠄⠄⠄⠄⠄",
"⣿⣿⣿⣿⣿⠉⠒⢽⠄⠄⠄⠄⡇⣿⣟⣿⡇⠄⠄⠄⠄⢸⣻⡿⡇⡇⠄⠄⠄⠄⠄⠄⠄",
"⠻⣿⣿⣿⣿⣄⠰⢼⠄⠄⠄⡄⠁⢻⣍⣯⠃⠄⠄⠄⠄⠈⢿⣻⠃⠈⡆⡄⠄⠄⠄⠄⠄",
"⠄⠙⠿⠿⠛⣿⣶⣤⡇⠄⠄⢣⠄⠄⠈⠄⢠⠂⠄⠁⠄⡀⠄⠄⣀⠔⢁⠃⠄⠄⠄⠄⠄",
"⠄⠄⠄⠄⠄⣿⣿⣿⣿⣾⠢⣖⣶⣦⣤⣤⣬⣤⣤⣤⣴⣶⣶⡏⠠⢃⠌⠄⠄⠄⠄⠄⠄",
"⠄⠄⠄⠄⠄⠿⠿⠟⠛⡹⠉⠛⠛⠿⠿⣿⣿⣿⣿⣿⡿⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄",
"⠠⠤⠤⠄⠄⣀⠄⠄⠄⠑⠠⣤⣀⣀⣀⡘⣿⠿⠙⠻⡍⢀⡈⠂⠄⠄⠄⠄⠄⠄⠄⠄⠄",
"⠄⠄⠄⠄⠄⠄⠑⠠⣠⣴⣾⣿⣿⣿⣿⣿⣿⣇⠉⠄⠻⣿⣷⣄⡀⠄⠄⠄⠄⠄⠄⠄⠄",
"file a bug report now or be cursed with this "
"annoying image in your syslog for all time."})
{
llarp::log::critical(deadlock_cat, wtf);
llarp::log::flush();
}
llarp::log::critical(deadlock_cat, "Router is deadlocked!");
llarp::log::flush();
llarp::sys::service_manager->failed();
std::abort();
}
@ -669,6 +632,17 @@ main(int argc, char* argv[])
#ifndef _WIN32
return lokinet_main(argc, argv);
#else
if (auto hntdll = GetModuleHandle("ntdll.dll"))
{
if (GetProcAddress(hntdll, "wine_get_version"))
{
static const char* text = "Don't run lokinet in wine, aborting startup";
static const char* title = "Lokinet Wine Error";
MessageBoxA(NULL, text, title, MB_ICONHAND);
abort();
}
}
SERVICE_TABLE_ENTRY DispatchTable[] = {
{strdup("lokinet"), (LPSERVICE_MAIN_FUNCTION)win32_daemon_entry}, {NULL, NULL}};

@ -1,8 +1,8 @@
#pragma once
#include "lokinet/lokinet_addr.h"
#include "lokinet/lokinet_context.h"
#include "lokinet/lokinet_srv.h"
#include "lokinet/lokinet_misc.h"
#include "lokinet/lokinet_addr.h"
#include "lokinet/lokinet_srv.h"
#include "lokinet/lokinet_stream.h"
#include "lokinet/lokinet_udp.h"

@ -1,7 +1,8 @@
#include "lokinet_jni_common.hpp"
#include "network_loki_lokinet_LokinetConfig.h"
#include <llarp.hpp>
#include <llarp/config/config.hpp>
#include "lokinet_jni_common.hpp"
extern "C"
{

@ -1,5 +1,6 @@
#include "network_loki_lokinet_LokinetDaemon.h"
#include "lokinet_jni_common.hpp"
#include "network_loki_lokinet_LokinetDaemon.h"
#include <llarp.hpp>
#include <llarp/config/config.hpp>
#include <llarp/router/router.hpp>

@ -1,8 +1,9 @@
#pragma once
#include <jni.h>
#include <string_view>
#include <functional>
#include <string_view>
/// visit string as native bytes
/// jvm uses some unholy encoding internally so we convert it to utf-8

@ -1,6 +1,5 @@
include(Version)
# Add an internal lokinet static library target, enables LTO (if enabled) on the target,
# and links it to the common lokinet-base interface.
# Invoke with the target/library name (e.g. "lokinet-foo") and list of source files, e.g.
@ -11,7 +10,6 @@ function(lokinet_add_library libname)
enable_lto(${libname})
endfunction()
lokinet_add_library(lokinet-cryptography
crypto/crypto.cpp
crypto/encrypted_frame.cpp
@ -57,12 +55,12 @@ lokinet_add_library(lokinet-core
)
lokinet_add_library(lokinet-rpc
rpc/endpoint_rpc.cpp
rpc/json_binary_proxy.cpp
rpc/json_conversions.cpp
rpc/lokid_rpc_client.cpp
rpc/rpc_request_parser.cpp
rpc/rpc_server.cpp
rpc/endpoint_rpc.cpp
)
lokinet_add_library(lokinet-wire
@ -78,12 +76,12 @@ lokinet_add_library(lokinet-utils
util/bencode.cpp
util/buffer.cpp
util/file.cpp
util/logging/buffer.cpp
util/mem.cpp
util/str.cpp
util/thread/threading.cpp
util/thread/queue_manager.cpp
util/time.cpp
util/logging/buffer.cpp
)
add_dependencies(lokinet-utils genversion)
@ -91,10 +89,6 @@ add_dependencies(lokinet-utils genversion)
# Addressing and event loop files used by lokinet-core and other libraries
# needed by rpc/ link/ service/ config/ path/ dht/
lokinet_add_library(lokinet-time-place
pow.cpp # only intro_set
router_contact.cpp
router_id.cpp
router_version.cpp # to be deleted shortly
ev/ev.cpp
ev/libuv.cpp
net/exit_info.cpp # only router_contact
@ -104,6 +98,10 @@ lokinet_add_library(lokinet-time-place
net/ip_range.cpp
net/net_int.cpp
net/sock_addr.cpp
pow.cpp # only intro_set
router_contact.cpp
router_id.cpp
router_version.cpp # to be deleted shortly
service/address.cpp
service/convotag.cpp
service/intro_set.cpp
@ -111,8 +109,8 @@ lokinet_add_library(lokinet-time-place
# lokinet-platform holds all platform specific code
lokinet_add_library(lokinet-platform
router/rc_lookup_handler.cpp
net/interface_info.cpp
router/rc_lookup_handler.cpp
vpn/packet_router.cpp
vpn/platform.cpp
)
@ -153,18 +151,13 @@ endif()
# lokinet-dns is the dns parsing and hooking library that we use to
# parse modify and reconstitute dns wire proto, dns queries and RR
# should have no concept of dns caching, this is left as an implementation
# detail of dns resolvers (LATER: make separate lib for dns resolvers)
add_library(lokinet-dns-internal
lokinet_add_library(lokinet-dns
dns/message.cpp # dns/server
dns/name.cpp # srv_data, question, rr
dns/platform.cpp
dns/question.cpp # message
dns/rr.cpp
dns/serialize.cpp
)
lokinet_add_library(lokinet-dns
dns/message.cpp # dns/server
dns/server.cpp # handlers/exit+tun and service/endpoint
dns/srv_data.cpp
)
@ -180,9 +173,9 @@ endif()
# nodedb data published to the network and versions of it stored locally
lokinet_add_library(lokinet-nodedb
bootstrap.cpp # config, router.hpp
net/traffic_policy.cpp # config, intro_set
nodedb.cpp
profiling.cpp # path, router, service::endpoint
net/traffic_policy.cpp # config, intro_set
)
set(BOOTSTRAP_FALLBACKS)
@ -214,21 +207,19 @@ lokinet_add_library(lokinet-config
# All path objects; link directly to lokinet-core
lokinet_add_library(lokinet-path
messages/relay.cpp
path/abstracthophandler.cpp
path/path_context.cpp
path/path.cpp
path/path_context.cpp
path/pathbuilder.cpp
path/pathset.cpp
path/transit_hop.cpp
messages/relay.cpp
)
# Link libraries to their internals
target_link_libraries(lokinet-core-utils PUBLIC lokinet-dns)
target_link_libraries(lokinet-core PUBLIC lokinet-core-utils)
target_link_libraries(lokinet-dns PRIVATE lokinet-dns-internal)
# Link lokinet-dns to alternate libraries
target_link_libraries(lokinet-dns PUBLIC lokinet-dns-platform)
if (TARGET lokinet-dns-systemd)
@ -236,9 +227,8 @@ if (TARGET lokinet-dns-systemd)
endif()
target_link_libraries(lokinet-wire PUBLIC lokinet-time-place)
target_link_libraries(lokinet-dns-internal PUBLIC lokinet-utils)
target_link_libraries(lokinet-dns PUBLIC lokinet-cryptography lokinet-config)
target_link_libraries(lokinet-nodedb PUBLIC lokinet-cryptography)
target_link_libraries(lokinet-dns PUBLIC lokinet-utils lokinet-cryptography lokinet-config)
target_link_libraries(lokinet-nodedb PUBLIC lokinet-time-place lokinet-cryptography)
target_link_libraries(lokinet-platform PUBLIC lokinet-cryptography)
target_link_libraries(lokinet-rpc PUBLIC lokinet-wire)
target_link_libraries(lokinet-time-place PUBLIC lokinet-utils lokinet-cryptography)
@ -277,11 +267,11 @@ target_link_libraries(lokinet-utils
# cross linkage
target_link_libraries(lokinet-core
PUBLIC
lokinet-rpc
lokinet-wire
lokinet-cryptography
lokinet-nodedb
lokinet-path
lokinet-cryptography
lokinet-rpc
lokinet-wire
)
target_link_libraries(lokinet-base INTERFACE oxenc::oxenc oxen::logging)
@ -292,7 +282,6 @@ target_link_libraries(lokinet-config PUBLIC oxenmq::oxenmq)
target_link_libraries(lokinet-nodedb PUBLIC oxenmq::oxenmq)
target_link_libraries(lokinet-path PUBLIC oxenmq::oxenmq)
target_link_libraries(lokinet-time-place PUBLIC uvw)
# target_link_libraries(lokinet-platform PUBLIC oxenmq::oxenmq Threads::Threads base_libs uvw)
target_link_libraries(lokinet-platform PUBLIC oxenmq::oxenmq Threads::Threads uvw)
target_link_libraries(lokinet-cryptography PUBLIC sodium)
target_link_libraries(lokinet-dns PUBLIC libunbound)

@ -24,17 +24,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ifaddrs.h"
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
typedef struct NetlinkList
{

@ -23,8 +23,7 @@
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
*/
#ifndef _IFADDRS_H_
#define _IFADDRS_H_
#pragma once
struct ifaddrs
{
@ -53,5 +52,3 @@ getifaddrs(struct ifaddrs** ifap);
extern void
freeifaddrs(struct ifaddrs* ifa);
__END_DECLS
#endif

@ -1,6 +1,6 @@
#pragma once
#include <uv.h>
#include <NetworkExtension/NetworkExtension.h>
#include <uv.h>
extern NSString* error_domain;

@ -1,4 +1,5 @@
#include "DNSTrampoline.h"
#include <uv.h>
NSString* error_domain = @"org.lokinet";

@ -1,8 +1,9 @@
#include <Foundation/Foundation.h>
#include <NetworkExtension/NetworkExtension.h>
#include "context_wrapper.h"
#include "DNSTrampoline.h"
#include <Foundation/Foundation.h>
#include <NetworkExtension/NetworkExtension.h>
#define LLARP_APPLE_PACKET_BUF_SIZE 64
@interface LLARPPacketTunnel : NEPacketTunnelProvider

@ -1,8 +1,9 @@
#pragma once
#include <llarp.hpp>
#include "vpn_platform.hpp"
#include "route_manager.hpp"
#include "vpn_platform.hpp"
#include <llarp.hpp>
namespace llarp::apple
{

@ -1,17 +1,22 @@
#include <cstdint>
#include <cstring>
#include <cassert>
#include <llarp/net/ip_packet.hpp>
#include "context_wrapper.h"
#include "context.hpp"
#include "vpn_interface.hpp"
#include <llarp/config/config.hpp>
#include <llarp/constants/apple.hpp>
#include <llarp/ev/libuv.hpp>
#include <llarp/net/ip_packet.hpp>
#include <llarp/util/fs.hpp>
#include <uvw/loop.h>
#include <llarp/util/logging.hpp>
#include <llarp/util/logging/buffer.hpp>
#include <llarp/util/logging/callback_sink.hpp>
#include "vpn_interface.hpp"
#include "context_wrapper.h"
#include "context.hpp"
// #include <uvw/loop.h>
#include <cassert>
#include <cstdint>
#include <cstring>
namespace
{

@ -8,8 +8,8 @@ extern "C"
{
#endif
#include <unistd.h>
#include <sys/socket.h>
#include <unistd.h>
#include <uv.h>
// Port (on localhost) for our DNS trampoline for bouncing DNS requests through the exit route

@ -1,7 +1,9 @@
#include "route_manager.hpp"
#include <llarp.hpp>
#include <llarp/handlers/tun.hpp>
#include <llarp/service/context.hpp>
#include <llarp.hpp>
#include <memory>
namespace llarp::apple

@ -1,8 +1,9 @@
#pragma once
#include "context_wrapper.h"
#include <llarp/router/router.hpp>
#include <llarp/vpn/platform.hpp>
#include "context_wrapper.h"
namespace llarp::apple
{

@ -1,6 +1,8 @@
#include "vpn_interface.hpp"
#include "context.hpp"
#include <llarp/router/router.hpp>
namespace llarp::apple

@ -1,8 +1,9 @@
#pragma once
#include <llarp.hpp>
#include <llarp/vpn/platform.hpp>
#include <llarp/util/thread/queue.hpp>
#include <llarp/vpn/platform.hpp>
#include <memory>
namespace llarp::apple

@ -1,4 +1,5 @@
#include "vpn_platform.hpp"
#include "context.hpp"
namespace llarp::apple

@ -1,8 +1,9 @@
#pragma once
#include <llarp/vpn/platform.hpp>
#include "vpn_interface.hpp"
#include "route_manager.hpp"
#include "vpn_interface.hpp"
#include <llarp/vpn/platform.hpp>
namespace llarp::apple
{

@ -1,5 +1,5 @@
#include <initializer_list>
#include "llarp/bootstrap.hpp"
#include <llarp/bootstrap.hpp>
namespace llarp
{

@ -1,11 +1,12 @@
#pragma once
#include "router_contact.hpp"
#include <llarp/util/fs.hpp>
#include <set>
#include <unordered_map>
#include "router_contact.hpp"
#include "llarp/util/fs.hpp"
namespace llarp
{
struct BootstrapList final : public std::set<RouterContact>

@ -1,5 +1,6 @@
#include <llarp/bootstrap.hpp>
#include <initializer_list>
#include "llarp/bootstrap.hpp"
namespace llarp
{

@ -1,19 +1,20 @@
#include "config.hpp"
#include "definition.hpp"
#include "ini.hpp"
#include <llarp/constants/files.hpp>
#include <llarp/constants/platform.hpp>
#include <llarp/constants/version.hpp>
#include <llarp/net/net.hpp>
#include <llarp/net/ip.hpp>
#include <llarp/net/net.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/service/name.hpp>
#include <llarp/util/file.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/util/str.hpp>
#include <llarp/service/name.hpp>
#include <stdexcept>
#include "definition.hpp"
#include "ini.hpp"
#include <stdexcept>
namespace llarp
{

@ -1,32 +1,33 @@
#pragma once
#include <llarp/net/traffic_policy.hpp>
#include <llarp/net/net.hpp>
#include "definition.hpp"
#include "ini.hpp"
#include <llarp/bootstrap.hpp>
#include <llarp/crypto/types.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/util/fs.hpp>
#include <llarp/util/str.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/constants/files.hpp>
#include <llarp/crypto/types.hpp>
#include <llarp/dns/srv_data.hpp>
#include <llarp/net/ip_address.hpp>
#include <llarp/net/net_int.hpp>
#include <llarp/net/ip_range_map.hpp>
#include <llarp/net/net.hpp>
#include <llarp/net/net_int.hpp>
#include <llarp/net/traffic_policy.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/service/address.hpp>
#include <llarp/service/auth.hpp>
#include <llarp/dns/srv_data.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/util/fs.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/util/str.hpp>
#include <oxenmq/address.h>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <optional>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include <unordered_set>
#include "ini.hpp"
#include "definition.hpp"
namespace llarp
{

@ -1,9 +1,10 @@
#include "definition.hpp"
#include <llarp/util/logging.hpp>
#include <cassert>
#include <iterator>
#include <stdexcept>
#include <cassert>
namespace llarp
{

@ -1,20 +1,22 @@
#pragma once
#include <fmt/core.h>
#include <llarp/util/str.hpp>
#include <llarp/util/fs.hpp>
#include <llarp/util/str.hpp>
#include <fmt/core.h>
#include <cassert>
#include <functional>
#include <initializer_list>
#include <type_traits>
#include <iostream>
#include <memory>
#include <optional>
#include <set>
#include <sstream>
#include <stdexcept>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <functional>
#include <optional>
#include <cassert>
namespace llarp
{

@ -1,7 +1,7 @@
#include "ini.hpp"
#include <llarp/util/logging.hpp>
#include <llarp/util/formattable.hpp>
#include <llarp/util/logging.hpp>
#include <cctype>
#include <fstream>

@ -1,10 +1,11 @@
#pragma once
#include <llarp/util/file.hpp>
#include <string_view>
#include <string>
#include <functional>
#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>

@ -1,10 +1,12 @@
#include "key_manager.hpp"
#include <system_error>
#include <llarp/util/logging.hpp>
#include "config.hpp"
#include <llarp/crypto/crypto.hpp>
#include <llarp/crypto/types.hpp>
#include <llarp/util/logging.hpp>
#include <system_error>
namespace llarp
{

@ -1,10 +1,11 @@
#pragma once
#include "config.hpp"
#include <llarp/crypto/types.hpp>
#include <llarp/router_contact.hpp>
#include <atomic>
#include "config.hpp"
#include <atomic>
namespace llarp
{

@ -1,9 +1,9 @@
#include "reachability_testing.hpp"
#include <llarp/crypto/crypto.hpp>
#include <llarp/router/router.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/crypto/crypto.hpp>
using std::chrono::steady_clock;

@ -1,7 +1,8 @@
#pragma once
#include <llarp/util/time.hpp>
#include <llarp/router_id.hpp>
#include <llarp/util/time.hpp>
#include <chrono>
#include <queue>
#include <random>

@ -1,7 +0,0 @@
#pragma once
namespace llarp
{
/// default queue length for logic jobs
constexpr std::size_t event_loop_queue_size = 1024;
} // namespace llarp

@ -6,8 +6,8 @@
#include <stdlib.h>
#ifndef _WIN32
#include <unistd.h>
#include <pwd.h>
#include <unistd.h>
#endif
namespace llarp

@ -1,6 +1,6 @@
#pragma once
#include <llarp/util/types.hpp>
#include <llarp/util/time.hpp>
#include <llarp/util/types.hpp>
#include <cstdlib>

@ -1,11 +1,11 @@
#pragma once
#include <llarp/util/time.hpp>
#include <llarp/util/types.hpp>
#include <chrono>
#include <cstddef>
#include <llarp/util/types.hpp>
#include <llarp/util/time.hpp>
namespace llarp::path
{
/// maximum path length

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <array>
#include <cstdint>
namespace llarp
{

@ -1,18 +1,18 @@
#include "nodedb.hpp"
#include <llarp.hpp>
#include <llarp/constants/version.hpp>
#include <llarp/constants/evloop.hpp>
#include <llarp/config/config.hpp>
#include <llarp/constants/version.hpp>
#include <llarp/crypto/crypto.hpp>
#include <llarp/ev/ev.hpp>
#include <llarp/router/router.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/util/service_manager.hpp>
#include <memory>
#include <csignal>
#include <memory>
#include <stdexcept>
#include "nodedb.hpp"
#if (__FreeBSD__) || (__OpenBSD__) || (__NetBSD__)
#include <pthread_np.h>
#endif

@ -1,9 +1,9 @@
#pragma once
#include <cstdint>
#include <libntrup/ntru.h>
#include <cstdint>
static constexpr uint32_t PUBKEYSIZE = 32;
static constexpr uint32_t SECKEYSIZE = 64;
static constexpr uint32_t NONCESIZE = 24;

@ -1,15 +1,16 @@
#include "crypto.hpp"
#include <oxenc/endian.h>
#include <sodium/core.h>
#include <sodium/crypto_aead_xchacha20poly1305.h>
#include <sodium/crypto_core_ed25519.h>
#include <sodium/crypto_generichash.h>
#include <sodium/crypto_sign.h>
#include <sodium/crypto_scalarmult_curve25519.h>
#include <sodium/crypto_scalarmult_ed25519.h>
#include <sodium/crypto_sign.h>
#include <sodium/crypto_stream_xchacha20.h>
#include <sodium/crypto_core_ed25519.h>
#include <sodium/crypto_aead_xchacha20poly1305.h>
#include <sodium/randombytes.h>
#include <sodium/utils.h>
#include <oxenc/endian.h>
#include <cassert>
#include <cstring>
#ifdef HAVE_CRYPT

@ -1,18 +1,18 @@
#pragma once
#include <llarp/util/buffer.hpp>
#include <functional>
#include <cstdint>
#include "constants.hpp"
#include "types.hpp"
#include <llarp/util/buffer.hpp>
#include <cstdint>
#include <functional>
namespace llarp
{
/*
TODO:
- make uint8_t pointers const where needed
-
*/
namespace crypto

@ -6,8 +6,8 @@
#include <llarp/util/buffer.hpp>
#include <llarp/util/mem.hpp>
#include <vector>
#include <stdexcept>
#include <vector>
namespace llarp
{

@ -1,9 +1,9 @@
#include "encrypted_frame.hpp"
#include <llarp/util/logging.hpp>
#include "crypto.hpp"
#include <llarp/util/logging.hpp>
namespace llarp
{
bool

@ -1,11 +1,12 @@
#pragma once
#include "encrypted.hpp"
#include "types.hpp"
#include <llarp/util/buffer.hpp>
#include <llarp/util/mem.h>
#include <utility>
#include "encrypted.hpp"
#include "types.hpp"
#include <utility>
namespace llarp
{

@ -2,7 +2,10 @@
#include <llarp/util/buffer.hpp>
#include <llarp/util/file.hpp>
#include <oxenc/hex.h>
#include <sodium/crypto_hash_sha512.h>
#include <sodium/crypto_scalarmult_ed25519.h>
namespace llarp
{

@ -1,16 +1,15 @@
#pragma once
#include <sodium.h>
#include "constants.hpp"
#include <llarp/router_id.hpp>
#include <llarp/util/aligned.hpp>
#include <llarp/util/types.hpp>
#include <llarp/util/fs.hpp>
#include <llarp/util/types.hpp>
#include <algorithm>
#include <iostream>
#include "constants.hpp"
namespace llarp
{
using SharedSecret = AlignedBuffer<SHAREDKEYSIZE>;

@ -2,6 +2,7 @@
#include "kademlia.hpp"
#include "key.hpp"
#include <llarp/util/status.hpp>
#include <map>

@ -1,662 +0,0 @@
#include "explorenetworkjob.hpp"
#include "localrouterlookup.hpp"
#include "localserviceaddresslookup.hpp"
#include "localtaglookup.hpp"
#include "node.hpp"
#include "publishservicejob.hpp"
#include "recursiverouterlookup.hpp"
#include "serviceaddresslookup.hpp"
#include "taglookup.hpp"
#include <llarp/path/path_context.hpp>
#include <llarp/router/router.hpp>
#include <llarp/nodedb.hpp>
#include <llarp/profiling.hpp>
#include <llarp/router/rc_lookup_handler.hpp>
#include <llarp/util/decaying_hashset.hpp>
#include <vector>
namespace llarp::dht
{
AbstractDHTMessageHandler::~AbstractDHTMessageHandler() = default;
struct DHTMessageHandler final : public AbstractDHTMessageHandler
{
DHTMessageHandler();
~DHTMessageHandler() override = default;
util::StatusObject
ExtractStatus() const override;
void
StoreRC(const RouterContact rc) const override
{
GetRouter()->rc_lookup_handler().check_rc(rc);
}
// void
// LookupIntroSetRelayed(
// const Key_t& target,
// const Key_t& whoasked,
// uint64_t whoaskedTX,
// const Key_t& askpeer,
// uint64_t relayOrder,
// service::EncryptedIntroSetLookupHandler result = nullptr) override;
// void
// LookupIntroSetDirect(
// const Key_t& target,
// const Key_t& whoasked,
// uint64_t whoaskedTX,
// const Key_t& askpeer,
// service::EncryptedIntroSetLookupHandler result = nullptr) override;
/// on behalf of whoasked request router with public key target from dht
/// router with key askpeer
void
LookupRouterRecursive(
const RouterID& target,
const Key_t& whoasked,
uint64_t whoaskedTX,
const Key_t& askpeer,
RouterLookupHandler result = nullptr) override;
bool
LookupRouter(const RouterID& target, RouterLookupHandler result) override
{
Key_t askpeer;
if (!_nodes->FindClosest(Key_t(target), askpeer))
{
return false;
}
LookupRouterRecursive(target, OurKey(), 0, askpeer, result);
return true;
}
bool
HasRouterLookup(const RouterID& target) const override
{
return pendingRouterLookups().HasLookupFor(target);
}
/// issue dht lookup for router via askpeer and send reply to local path
void
LookupRouterForPath(
const RouterID& target, uint64_t txid, const PathID_t& path, const Key_t& askpeer) override;
/// issue dht lookup for introset for addr via askpeer and send reply to
/// local path
void
LookupIntroSetForPath(
const Key_t& addr,
uint64_t txid,
const llarp::PathID_t& path,
const Key_t& askpeer,
uint64_t relayOrder) override;
/// send a dht message to peer, if keepalive is true then keep the session
/// with that peer alive for 10 seconds
void
DHTSendTo(const RouterID& peer, AbstractDHTMessage* msg, bool keepalive = true) override;
/// get routers closest to target excluding requester
bool
HandleExploritoryRouterLookup(
const Key_t& requester,
uint64_t txid,
const RouterID& target,
std::vector<std::unique_ptr<AbstractDHTMessage>>& reply) override;
/// handle rc lookup from requester for target
void
LookupRouterRelayed(
const Key_t& requester,
uint64_t txid,
const Key_t& target,
bool recursive,
std::vector<std::unique_ptr<AbstractDHTMessage>>& replies) override;
/// relay a dht message from a local path to the main network
bool
RelayRequestForPath(const llarp::PathID_t& localPath, const AbstractDHTMessage& msg) override;
/// send introset to peer as R/S
void
PropagateLocalIntroSet(
const PathID_t& from,
uint64_t txid,
const service::EncryptedIntroSet& introset,
const Key_t& tellpeer,
uint64_t relayOrder) override;
/// send introset to peer from source with S counter and excluding peers
void
PropagateIntroSetTo(
const Key_t& from,
uint64_t txid,
const service::EncryptedIntroSet& introset,
const Key_t& tellpeer,
uint64_t relayOrder) override;
/// initialize dht context and explore every exploreInterval milliseconds
void
Init(const Key_t& us, Router* router) override;
/// get localally stored introset by service address
std::optional<llarp::service::EncryptedIntroSet>
GetIntroSetByLocation(const Key_t& location) const override;
void
handle_cleaner_timer();
/// explore dht for new routers
void
Explore(size_t N = 3);
llarp::Router* router{nullptr};
// for router contacts
std::unique_ptr<Bucket<RCNode>> _nodes;
// for introduction sets
std::unique_ptr<Bucket<ISNode>> _services;
Bucket<ISNode>*
services() override
{
return _services.get();
}
bool allowTransit{false};
bool&
AllowTransit() override
{
return allowTransit;
}
const bool&
AllowTransit() const override
{
return allowTransit;
}
Bucket<RCNode>*
Nodes() const override
{
return _nodes.get();
}
void
PutRCNodeAsync(const RCNode& val) override
{
router->loop()->call([nodes = Nodes(), val] { nodes->PutNode(val); });
}
void
DelRCNodeAsync(const Key_t& val) override
{
router->loop()->call([nodes = Nodes(), val] { nodes->DelNode(val); });
}
const Key_t&
OurKey() const override
{
return ourKey;
}
llarp::Router*
GetRouter() const override
{
return router;
}
bool
GetRCFromNodeDB(const Key_t& k, llarp::RouterContact& rc) const override
{
if (const auto maybe = router->node_db()->Get(k.as_array()); maybe.has_value())
{
rc = *maybe;
return true;
}
return false;
}
PendingIntrosetLookups _pendingIntrosetLookups;
PendingRouterLookups _pendingRouterLookups;
PendingExploreLookups _pendingExploreLookups;
PendingIntrosetLookups&
pendingIntrosetLookups() override
{
return _pendingIntrosetLookups;
}
const PendingIntrosetLookups&
pendingIntrosetLookups() const override
{
return _pendingIntrosetLookups;
}
PendingRouterLookups&
pendingRouterLookups() override
{
return _pendingRouterLookups;
}
const PendingRouterLookups&
pendingRouterLookups() const override
{
return _pendingRouterLookups;
}
PendingExploreLookups&
pendingExploreLookups() override
{
return _pendingExploreLookups;
}
const PendingExploreLookups&
pendingExploreLookups() const override
{
return _pendingExploreLookups;
}
uint64_t
NextID()
{
return ++ids;
}
llarp_time_t
Now() const override;
void
ExploreNetworkVia(const Key_t& peer) override;
bool
handle_message(
const AbstractDHTMessage&, std::vector<std::unique_ptr<dht::AbstractDHTMessage>>&) override;
private:
std::shared_ptr<int> _timer_keepalive;
void
CleanupTX();
uint64_t ids;
Key_t ourKey;
};
DHTMessageHandler::DHTMessageHandler()
{
randombytes((byte_t*)&ids, sizeof(uint64_t));
}
void
DHTMessageHandler::Explore(size_t N)
{
// ask N random peers for new routers
llarp::LogDebug("Exploring network via ", N, " peers");
std::set<Key_t> peers;
if (_nodes->GetManyRandom(peers, N))
{
for (const auto& peer : peers)
ExploreNetworkVia(peer);
}
else
llarp::LogError("failed to select ", N, " random nodes for exploration");
}
void
DHTMessageHandler::ExploreNetworkVia(const Key_t& askpeer)
{
uint64_t txid = ++ids;
const TXOwner peer(askpeer, txid);
const TXOwner whoasked(OurKey(), txid);
const RouterID K(askpeer.as_array());
pendingExploreLookups().NewTX(
peer, whoasked, K, new ExploreNetworkJob(askpeer.as_array(), this));
}
void
DHTMessageHandler::handle_cleaner_timer()
{
// clean up transactions
CleanupTX();
const llarp_time_t now = Now();
if (_nodes)
{
// expire router contacts in memory
auto& nodes = _nodes->nodes;
auto itr = nodes.begin();
while (itr != nodes.end())
{
if (itr->second.rc.IsExpired(now))
{
itr = nodes.erase(itr);
}
else
++itr;
}
}
if (_services)
{
// expire intro sets
auto& nodes = _services->nodes;
auto itr = nodes.begin();
while (itr != nodes.end())
{
if (itr->second.introset.IsExpired(now))
{
itr = nodes.erase(itr);
}
else
++itr;
}
}
}
void
DHTMessageHandler::LookupRouterRelayed(
const Key_t& requester,
uint64_t txid,
const Key_t& target,
bool recursive,
std::vector<std::unique_ptr<AbstractDHTMessage>>& replies)
{
if (target == ourKey)
{
// we are the target, give them our RC
replies.emplace_back(new GotRouterMessage(requester, txid, {router->rc()}, false));
return;
}
if (not GetRouter()->SessionToRouterAllowed(target.as_array()))
{
// explicitly not allowed
replies.emplace_back(new GotRouterMessage(requester, txid, {}, false));
return;
}
const auto rc = GetRouter()->node_db()->FindClosestTo(target);
const Key_t next(rc.pubkey);
{
if (next == target)
{
// we know the target
if (rc.ExpiresSoon(llarp::time_now_ms()))
{
// ask target for their rc to keep it updated
LookupRouterRecursive(target.as_array(), requester, txid, next);
}
else
{
// send reply with rc we know of
replies.emplace_back(new GotRouterMessage(requester, txid, {rc}, false));
}
}
else if (recursive) // are we doing a recursive lookup?
{
// is the next peer we ask closer to the target than us?
if ((next ^ target) < (ourKey ^ target))
{
// yes it is closer, ask neighbour recursively
LookupRouterRecursive(target.as_array(), requester, txid, next);
}
else
{
// no we are closer to the target so tell requester it's not there
// so they switch to iterative lookup
replies.emplace_back(new GotRouterMessage(requester, txid, {}, false));
}
}
else
{
// iterative lookup and we don't have it tell them who is closer
replies.emplace_back(new GotRouterMessage(requester, next, txid, false));
}
}
}
std::optional<llarp::service::EncryptedIntroSet>
DHTMessageHandler::GetIntroSetByLocation(const Key_t& key) const
{
auto itr = _services->nodes.find(key);
if (itr == _services->nodes.end())
return {};
return itr->second.introset;
}
void
DHTMessageHandler::CleanupTX()
{
auto now = Now();
llarp::LogTrace("DHT tick");
pendingRouterLookups().Expire(now);
_pendingIntrosetLookups.Expire(now);
pendingExploreLookups().Expire(now);
}
util::StatusObject
DHTMessageHandler::ExtractStatus() const
{
util::StatusObject obj{
{"pendingRouterLookups", pendingRouterLookups().ExtractStatus()},
{"pendingIntrosetLookups", _pendingIntrosetLookups.ExtractStatus()},
{"pendingExploreLookups", pendingExploreLookups().ExtractStatus()},
{"nodes", _nodes->ExtractStatus()},
{"services", _services->ExtractStatus()},
{"ourKey", ourKey.ToHex()}};
return obj;
}
bool
DHTMessageHandler::handle_message(
const AbstractDHTMessage& msg, std::vector<std::unique_ptr<dht::AbstractDHTMessage>>& replies)
{
return msg.handle_message(*this, replies);
}
void
DHTMessageHandler::Init(const Key_t& us, Router* r)
{
router = r;
ourKey = us;
_nodes = std::make_unique<Bucket<RCNode>>(ourKey, llarp::randint);
_services = std::make_unique<Bucket<ISNode>>(ourKey, llarp::randint);
llarp::LogDebug("initialize dht with key ", ourKey);
// start cleanup timer
_timer_keepalive = std::make_shared<int>(0);
router->loop()->call_every(1s, _timer_keepalive, [this] { handle_cleaner_timer(); });
}
void
DHTMessageHandler::DHTSendTo(const RouterID& peer, AbstractDHTMessage* msg, bool)
{
router->SendToOrQueue(peer, msg);
auto now = Now();
router->PersistSessionUntil(peer, now + 1min);
}
// this function handles incoming DHT messages sent down a path by a client
// note that IMessage here is different than that found in the routing
// namespace. by the time this is called, we are inside
// llarp::routing::DHTMessage::HandleMessage()
bool
DHTMessageHandler::RelayRequestForPath(const llarp::PathID_t& id, const AbstractDHTMessage& msg)
{
routing::PathDHTMessage reply;
if (not handle_message(msg, reply.dht_msgs))
return false;
if (not reply.dht_msgs.empty())
{
auto path = router->path_context().GetByUpstream(router->pubkey(), id);
return path && path->SendRoutingMessage(reply, router);
}
return true;
}
void
DHTMessageHandler::LookupIntroSetForPath(
const Key_t& addr,
uint64_t txid,
const llarp::PathID_t& path,
const Key_t& askpeer,
uint64_t relayOrder)
{
const TXOwner asker(OurKey(), txid);
const TXOwner peer(askpeer, ++ids);
_pendingIntrosetLookups.NewTX(
peer,
asker,
asker,
new LocalServiceAddressLookup(path, txid, relayOrder, addr, this, askpeer));
}
void
DHTMessageHandler::PropagateIntroSetTo(
const Key_t& from,
uint64_t txid,
const service::EncryptedIntroSet& introset,
const Key_t& tellpeer,
uint64_t relayOrder)
{
const TXOwner asker(from, txid);
const TXOwner peer(tellpeer, ++ids);
_pendingIntrosetLookups.NewTX(
peer, asker, asker, new PublishServiceJob(asker, introset, this, relayOrder));
}
void
DHTMessageHandler::PropagateLocalIntroSet(
const PathID_t& from,
uint64_t txid,
const service::EncryptedIntroSet& introset,
const Key_t& tellpeer,
uint64_t relayOrder)
{
const TXOwner asker(OurKey(), txid);
const TXOwner peer(tellpeer, ++ids);
_pendingIntrosetLookups.NewTX(
peer,
asker,
peer,
new LocalPublishServiceJob(peer, from, txid, introset, this, relayOrder));
}
void
DHTMessageHandler::LookupIntroSetRelayed(
const Key_t& addr,
const Key_t& whoasked,
uint64_t txid,
const Key_t& askpeer,
uint64_t relayOrder,
service::EncryptedIntroSetLookupHandler handler)
{
const TXOwner asker(whoasked, txid);
const TXOwner peer(askpeer, ++ids);
_pendingIntrosetLookups.NewTX(
peer, asker, asker, new ServiceAddressLookup(asker, addr, this, relayOrder, handler));
}
void
DHTMessageHandler::LookupIntroSetDirect(
const Key_t& addr,
const Key_t& whoasked,
uint64_t txid,
const Key_t& askpeer,
service::EncryptedIntroSetLookupHandler handler)
{
const TXOwner asker(whoasked, txid);
const TXOwner peer(askpeer, ++ids);
_pendingIntrosetLookups.NewTX(
peer, asker, asker, new ServiceAddressLookup(asker, addr, this, 0, handler), 1s);
}
bool
DHTMessageHandler::HandleExploritoryRouterLookup(
const Key_t& requester,
uint64_t txid,
const RouterID& target,
std::vector<std::unique_ptr<AbstractDHTMessage>>& reply)
{
std::vector<RouterID> closer;
const Key_t t(target.as_array());
std::set<Key_t> foundRouters;
if (!_nodes)
return false;
const size_t nodeCount = _nodes->size();
if (nodeCount == 0)
{
llarp::LogError("cannot handle exploritory router lookup, no dht peers");
return false;
}
llarp::LogDebug("We have ", _nodes->size(), " connected nodes into the DHT");
// ourKey should never be in the connected list
// requester is likely in the connected list
// 4 or connection nodes (minus a potential requestor), whatever is less
if (!_nodes->GetManyNearExcluding(
t, foundRouters, std::min(nodeCount, size_t{4}), std::set<Key_t>{ourKey, requester}))
{
llarp::LogError(
"not enough dht nodes to handle exploritory router lookup, "
"have ",
nodeCount,
" dht peers");
return false;
}
for (const auto& f : foundRouters)
{
const RouterID id = f.as_array();
// discard shit routers
if (router->router_profiling().IsBadForConnect(id))
continue;
closer.emplace_back(id);
}
llarp::LogDebug("Gave ", closer.size(), " routers for exploration");
reply.emplace_back(new GotRouterMessage(txid, closer, false));
return true;
}
void
DHTMessageHandler::LookupRouterForPath(
const RouterID& target, uint64_t txid, const llarp::PathID_t& path, const Key_t& askpeer)
{
const TXOwner peer(askpeer, ++ids);
const TXOwner whoasked(OurKey(), txid);
_pendingRouterLookups.NewTX(
peer, whoasked, target, new LocalRouterLookup(path, txid, target, this));
}
void
DHTMessageHandler::LookupRouterRecursive(
const RouterID& target,
const Key_t& whoasked,
uint64_t txid,
const Key_t& askpeer,
RouterLookupHandler handler)
{
const TXOwner asker(whoasked, txid);
const TXOwner peer(askpeer, ++ids);
_pendingRouterLookups.NewTX(
peer, asker, target, new RecursiveRouterLookup(asker, target, this, handler));
}
llarp_time_t
DHTMessageHandler::Now() const
{
return router->now();
}
std::unique_ptr<AbstractDHTMessageHandler>
make_handler()
{
return std::make_unique<DHTMessageHandler>();
}
} // namespace llarp::dht

@ -1,52 +0,0 @@
#include "dht.h"
#include <llarp/router_contact.hpp>
// llarp_dht_context::llarp_dht_context(llarp::Router* router)
// {
// parent = router;
// impl = llarp::dht::make_handler();
// }
// struct llarp_dht_context*
// llarp_dht_context_new(llarp::Router* router)
// {
// return new llarp_dht_context(router);
// }
// void
// llarp_dht_context_free(struct llarp_dht_context* ctx)
// {
// delete ctx;
// }
// void
// __llarp_dht_remove_peer(struct llarp_dht_context* ctx, const byte_t* id)
// {
// ctx->impl->Nodes()->DelNode(llarp::dht::Key_t(id));
// }
// void
// llarp_dht_allow_transit(llarp_dht_context* ctx)
// {
// ctx->impl->AllowTransit() = true;
// }
// void
// llarp_dht_context_start(struct llarp_dht_context* ctx, const byte_t* key)
// {
// ctx->impl->Init(llarp::dht::Key_t(key), ctx->parent);
// }
void
llarp_dht_lookup_router(struct llarp_dht_context* ctx, struct llarp_router_lookup_job* job)
{
job->dht = ctx;
job->found = false;
job->result.Clear();
// llarp_rc_clear(&job->result);
llarp::LogError("implement me llarp_dht_lookup_router");
/*
ctx->parent->logic->queue_job(
{job, &llarp::dht::Context::queue_router_lookup});
*/
}

@ -1,61 +0,0 @@
#pragma once
#include <llarp/crypto/crypto.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/util/buffer.hpp>
/**
* dht.h
*
* DHT functions
*/
struct llarp_dht_context;
namespace llarp
{
struct Router;
}
/// allocator
struct llarp_dht_context*
llarp_dht_context_new(llarp::Router* parent);
/// deallocator
void
llarp_dht_context_free(struct llarp_dht_context* dht);
/// start dht context with our location in keyspace
void
llarp_dht_context_start(struct llarp_dht_context* ctx, const byte_t* key);
// remove this? dns needs it atm
struct llarp_router_lookup_job;
using llarp_router_lookup_handler = void (*)(struct llarp_router_lookup_job*);
struct llarp_router_lookup_job
{
/// can be anything but usually a class context for hook
void* user;
llarp_router_lookup_handler hook;
struct llarp_dht_context* dht;
llarp::PubKey target;
bool found;
// make sure you initialize addr and exits
llarp::RouterContact result;
bool iterative;
};
// end dns requirement
/// start allowing dht participation on a context
void
llarp_dht_allow_transit(struct llarp_dht_context* ctx);
/// remove router from tracked dht peer list
/// internal function do not use
void
__llarp_dht_remove_peer(struct llarp_dht_context* ctx, const byte_t* id);
void
llarp_dht_lookup_router(struct llarp_dht_context* ctx, struct llarp_router_lookup_job* job);

@ -1,6 +1,7 @@
#pragma once
#include "key.hpp"
#include <llarp/router_contact.hpp>
namespace llarp::dht

@ -1,7 +1,7 @@
#pragma once
#include <llarp/util/aligned.hpp>
#include <llarp/router_id.hpp>
#include <llarp/util/aligned.hpp>
#include <llarp/util/formattable.hpp>
#include <array>

@ -1,8 +1,10 @@
#pragma once
#include "key.hpp"
#include <llarp/router_contact.hpp>
#include <llarp/service/intro_set.hpp>
#include <utility>
namespace llarp::dht

@ -1,79 +0,0 @@
#ifndef LLARP_DHT_TX
#define LLARP_DHT_TX
#include "key.hpp"
#include "txowner.hpp"
#include <llarp/util/logging.hpp>
#include <llarp/util/status.hpp>
#include <set>
#include <vector>
namespace llarp
{
struct Router;
namespace dht
{
template <typename K, typename V>
struct TX
{
K target;
Router* router;
std::set<Key_t> peersAsked;
std::vector<V> valuesFound;
TXOwner whoasked;
TX(const TXOwner& asker, const K& k, Router* r) : target(k), router{r}, whoasked(asker)
{}
virtual ~TX() = default;
void
OnFound(const Key_t& askedPeer, const V& value);
util::StatusObject
ExtractStatus() const
{
util::StatusObject obj{
{"whoasked", whoasked.ExtractStatus()}, {"target", target.ExtractStatus()}};
std::vector<util::StatusObject> foundObjs;
std::transform(
valuesFound.begin(),
valuesFound.end(),
std::back_inserter(foundObjs),
[](const auto& item) -> util::StatusObject { return item.ExtractStatus(); });
obj["found"] = foundObjs;
std::vector<std::string> asked;
std::transform(
peersAsked.begin(),
peersAsked.end(),
std::back_inserter(asked),
[](const auto& item) -> std::string { return item.ToString(); });
obj["asked"] = asked;
return obj;
}
virtual bool
Validate(const V& value) const = 0;
virtual void
Start(const TXOwner& peer) = 0;
};
template <typename K, typename V>
inline void
TX<K, V>::OnFound(const Key_t& askedPeer, const V& value)
{
peersAsked.insert(askedPeer);
if (Validate(value))
{
valuesFound.push_back(value);
}
}
} // namespace dht
} // namespace llarp
#endif

@ -1,212 +0,0 @@
#ifndef LLARP_DHT_TXHOLDER
#define LLARP_DHT_TXHOLDER
#include "tx.hpp"
#include "txowner.hpp"
#include <llarp/util/time.hpp>
#include <llarp/util/status.hpp>
#include <memory>
#include <unordered_map>
namespace llarp::dht
{
template <typename K, typename V>
struct TXHolder
{
using TXPtr = std::unique_ptr<TX<K, V>>;
// tx who are waiting for a reply for each key
std::unordered_multimap<K, TXOwner> waiting;
// tx timesouts by key
std::unordered_map<K, llarp_time_t> timeouts;
// maps remote peer with tx to handle reply from them
std::unordered_map<TXOwner, TXPtr> tx;
const TX<K, V>*
GetPendingLookupFrom(const TXOwner& owner) const;
util::StatusObject
ExtractStatus() const
{
util::StatusObject obj{};
std::vector<util::StatusObject> txObjs, timeoutsObjs, waitingObjs;
std::transform(
tx.begin(),
tx.end(),
std::back_inserter(txObjs),
[](const auto& item) -> util::StatusObject {
return util::StatusObject{
{"owner", item.first.ExtractStatus()}, {"tx", item.second->ExtractStatus()}};
});
obj["tx"] = txObjs;
std::transform(
timeouts.begin(),
timeouts.end(),
std::back_inserter(timeoutsObjs),
[](const auto& item) -> util::StatusObject {
return util::StatusObject{
{"time", to_json(item.second)}, {"target", item.first.ExtractStatus()}};
});
obj["timeouts"] = timeoutsObjs;
std::transform(
waiting.begin(),
waiting.end(),
std::back_inserter(waitingObjs),
[](const auto& item) -> util::StatusObject {
return util::StatusObject{
{"target", item.first.ExtractStatus()}, {"whoasked", item.second.ExtractStatus()}};
});
obj["waiting"] = waitingObjs;
return obj;
}
bool
HasLookupFor(const K& target) const
{
return timeouts.find(target) != timeouts.end();
}
bool
HasPendingLookupFrom(const TXOwner& owner) const
{
return GetPendingLookupFrom(owner) != nullptr;
}
void
NewTX(
const TXOwner& askpeer,
const TXOwner& whoasked,
const K& k,
TX<K, V>* t,
llarp_time_t requestTimeoutMS = 15s);
/// mark tx as not fond
void
NotFound(const TXOwner& from, const std::unique_ptr<Key_t>& next);
void
Found(const TXOwner& from, const K& k, const std::vector<V>& values)
{
Inform(from, k, values, true);
}
/// inform all watches for key of values found
void
Inform(
TXOwner from,
K key,
std::vector<V> values,
bool sendreply = false,
bool removeTimeouts = true);
void
Expire(llarp_time_t now);
};
template <typename K, typename V>
const TX<K, V>*
TXHolder<K, V>::GetPendingLookupFrom(const TXOwner& owner) const
{
auto itr = tx.find(owner);
if (itr == tx.end())
{
return nullptr;
}
return itr->second.get();
}
template <typename K, typename V>
void
TXHolder<K, V>::NewTX(
const TXOwner& askpeer,
const TXOwner& whoasked,
const K& k,
TX<K, V>* t,
llarp_time_t requestTimeoutMS)
{
(void)whoasked;
tx.emplace(askpeer, std::unique_ptr<TX<K, V>>(t));
auto count = waiting.count(k);
waiting.emplace(k, askpeer);
auto itr = timeouts.find(k);
if (itr == timeouts.end())
{
timeouts.emplace(k, time_now_ms() + requestTimeoutMS);
}
if (count == 0)
{
t->Start(askpeer);
}
}
template <typename K, typename V>
void
TXHolder<K, V>::NotFound(const TXOwner& from, const std::unique_ptr<Key_t>&)
{
auto txitr = tx.find(from);
if (txitr == tx.end())
{
return;
}
Inform(from, txitr->second->target, {}, true, true);
}
template <typename K, typename V>
void
TXHolder<K, V>::Inform(
TXOwner from, K key, std::vector<V> values, bool sendreply, bool removeTimeouts)
{
auto range = waiting.equal_range(key);
auto itr = range.first;
while (itr != range.second)
{
auto txitr = tx.find(itr->second);
if (txitr != tx.end())
{
for (const auto& value : values)
{
txitr->second->OnFound(from.node, value);
}
if (sendreply)
{
txitr->second->SendReply();
tx.erase(txitr);
}
}
++itr;
}
if (sendreply)
{
waiting.erase(key);
}
if (removeTimeouts)
{
timeouts.erase(key);
}
}
template <typename K, typename V>
void
TXHolder<K, V>::Expire(llarp_time_t now)
{
auto itr = timeouts.begin();
while (itr != timeouts.end())
{
if (now >= itr->second)
{
Inform(TXOwner{}, itr->first, {}, true, false);
itr = timeouts.erase(itr);
}
else
{
++itr;
}
}
}
} // namespace llarp::dht
#endif

@ -1,61 +0,0 @@
#pragma once
#include "key.hpp"
#include <llarp/util/status.hpp>
#include <cstdint>
namespace llarp::dht
{
struct TXOwner
{
Key_t node;
uint64_t txid = 0;
TXOwner() = default;
TXOwner(const TXOwner&) = default;
TXOwner(TXOwner&&) = default;
TXOwner&
operator=(const TXOwner&) = default;
TXOwner(const Key_t& k, uint64_t id) : node(k), txid(id)
{}
util::StatusObject
ExtractStatus() const
{
util::StatusObject obj{
{"txid", txid},
{"node", node.ToHex()},
};
return obj;
}
bool
operator==(const TXOwner& other) const
{
return std::tie(txid, node) == std::tie(other.txid, other.node);
}
bool
operator<(const TXOwner& other) const
{
return std::tie(txid, node) < std::tie(other.txid, other.node);
}
};
} // namespace llarp::dht
namespace std
{
template <>
struct hash<llarp::dht::TXOwner>
{
std::size_t
operator()(const llarp::dht::TXOwner& o) const noexcept
{
std::size_t sz2;
memcpy(&sz2, o.node.data(), sizeof(std::size_t));
return o.txid ^ (sz2 << 1);
}
};
} // namespace std

@ -1,13 +1,15 @@
#include "message.hpp"
#include <oxenc/endian.h>
#include <llarp/util/buffer.hpp>
#include <llarp/net/ip.hpp>
#include <array>
#include "dns.hpp"
#include "srv_data.hpp"
#include <llarp/net/ip.hpp>
#include <llarp/util/buffer.hpp>
#include <oxenc/endian.h>
#include <array>
namespace llarp::dns
{
static auto logcat = log::Cat("dns");

@ -1,8 +1,8 @@
#pragma once
#include "serialize.hpp"
#include "rr.hpp"
#include "question.hpp"
#include "rr.hpp"
#include "serialize.hpp"
namespace llarp
{

@ -1,8 +1,9 @@
#include "name.hpp"
#include <llarp/net/ip.hpp>
#include <llarp/util/str.hpp>
#include <llarp/net/net_bits.hpp>
#include <llarp/util/str.hpp>
#include <oxenc/hex.h>
namespace llarp::dns

@ -2,8 +2,9 @@
#include <llarp/net/net_int.hpp>
#include <llarp/util/buffer.hpp>
#include <string>
#include <optional>
#include <string>
namespace llarp::dns
{

@ -2,6 +2,7 @@
#include "platform.hpp"
#include <llarp/constants/platform.hpp>
#include <type_traits>
#include <unordered_map>

@ -1,9 +1,10 @@
#pragma once
#include <llarp/net/sock_addr.hpp>
#include <llarp/util/logging.hpp>
#include <string>
#include <memory>
#include <stdexcept>
#include <string>
#ifndef _WIN32
#include <net/if.h>

@ -1,9 +1,9 @@
#include "question.hpp"
#include <llarp/util/str.hpp>
#include "dns.hpp"
#include <llarp/util/str.hpp>
namespace llarp::dns
{
static auto logcat = log::Cat("dns");

@ -1,7 +1,7 @@
#pragma once
#include "serialize.hpp"
#include "name.hpp"
#include "serialize.hpp"
#include <llarp/net/net_int.hpp>

@ -1,12 +1,13 @@
#pragma once
#include "name.hpp"
#include "serialize.hpp"
#include <llarp/net/net_int.hpp>
#include <memory>
#include <vector>
#include "name.hpp"
#include "serialize.hpp"
namespace llarp::dns
{
using RRClass_t = uint16_t;

@ -2,6 +2,7 @@
#include "platform.hpp"
#include <llarp/constants/platform.hpp>
#include <type_traits>
namespace llarp::dns

@ -2,6 +2,7 @@
#include <llarp/util/buffer.hpp>
#include <llarp/util/status.hpp>
#include <vector>
namespace llarp::dns

@ -1,19 +1,20 @@
#include "server.hpp"
#include <llarp/constants/platform.hpp>
#include "nm_platform.hpp"
#include "sd_platform.hpp"
#include <llarp/constants/apple.hpp>
#include <llarp/constants/platform.hpp>
#include <llarp/ev/udp_handle.hpp>
#include <oxen/log.hpp>
#include <unbound.h>
#include <uvw.hpp>
#include <memory>
#include <optional>
#include <stdexcept>
#include <utility>
#include <optional>
#include <memory>
#include "oxen/log.hpp"
#include "sd_platform.hpp"
#include "nm_platform.hpp"
#include <uvw.hpp>
namespace llarp::dns
{

@ -1,14 +1,15 @@
#pragma once
#include "message.hpp"
#include "platform.hpp"
#include <llarp/config/config.hpp>
#include <llarp/ev/ev.hpp>
#include <llarp/net/net.hpp>
#include <llarp/util/fs.hpp>
#include <llarp/util/compare_ptr.hpp>
#include <set>
#include <llarp/util/fs.hpp>
#include "message.hpp"
#include "platform.hpp"
#include <set>
namespace llarp::dns
{

@ -1,10 +1,10 @@
#include "srv_data.hpp"
#include <oxenc/bt_serialize.h>
#include <llarp/util/bencode.h>
#include <llarp/util/types.hpp>
#include <llarp/util/str.hpp>
#include <llarp/util/types.hpp>
#include <oxenc/bt_serialize.h>
namespace llarp::dns
{

@ -1,12 +1,13 @@
#pragma once
#include <tuple>
#include <string_view>
#include "dns.hpp"
#include "name.hpp"
#include "serialize.hpp"
#include "llarp/util/status.hpp"
#include <llarp/util/status.hpp>
#include <string_view>
#include <tuple>
namespace llarp::dns
{

@ -1,6 +1,6 @@
#include "endpoint_base.hpp"
#include "llarp/util/algorithm.hpp"
#include <llarp/util/algorithm.hpp>
namespace llarp
{

@ -1,22 +1,24 @@
#pragma once
#include "router_id.hpp"
#include <llarp/dns/srv_data.hpp>
#include <llarp/ev/ev.hpp>
#include <llarp/link/tunnel.hpp>
#include <llarp/service/address.hpp>
#include <llarp/service/convotag.hpp>
#include <llarp/service/protocol_type.hpp>
#include <oxenc/variant.h>
#include <quic.hpp>
#include <functional>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <tuple>
#include <optional>
#include <unordered_set>
#include <set>
#include "llarp/service/address.hpp"
#include "llarp/service/convotag.hpp"
#include "llarp/service/protocol_type.hpp"
#include "router_id.hpp"
#include "llarp/ev/ev.hpp"
#include "llarp/dns/srv_data.hpp"
#include "oxenc/variant.h"
namespace llarp
{
@ -25,6 +27,12 @@ namespace llarp
class Server;
}
// TODO: add forward declaration of TunnelManager
// namespace link
// {
// class TunneLManager;
// }
class EndpointBase
{
std::unordered_set<dns::SRVData> m_SRVRecords;

@ -1,9 +1,10 @@
#include "ev.hpp"
#include "libuv.hpp"
#include <llarp/net/net.hpp>
#include <cstddef>
#include "libuv.hpp"
#include <cstddef>
namespace llarp
{

@ -1,14 +1,16 @@
#pragma once
#include <llarp/net/interface_info.hpp>
#include <llarp/util/buffer.hpp>
#include <llarp/util/time.hpp>
#include <llarp/util/thread/threading.hpp>
#include <llarp/constants/evloop.hpp>
#include <llarp/net/interface_info.hpp>
#include <llarp/util/time.hpp>
#include <uvw.hpp>
#include <algorithm>
#include <deque>
#include <list>
#include <future>
#include <list>
#include <utility>
using oxen::log::slns::source_location;
@ -20,6 +22,8 @@ namespace uvw
namespace llarp
{
constexpr std::size_t event_loop_queue_size = 1024;
struct SockAddr;
struct UDPHandle;

@ -3,12 +3,12 @@
#include <llarp/util/exceptions.hpp>
#include <llarp/vpn/platform.hpp>
#include <uvw.hpp>
#include <cstring>
#include <memory>
#include <thread>
#include <type_traits>
#include <cstring>
#include <uvw.hpp>
namespace llarp::uv
{

@ -1,17 +1,16 @@
#pragma once
#include <llarp/util/thread/queue.hpp>
#include "ev.hpp"
#include "udp_handle.hpp"
#include <llarp/util/meta/memfn.hpp>
#include <uvw/loop.h>
#include <uvw/async.h>
#include <uvw/poll.h>
#include <uvw/udp.h>
#include <llarp/util/thread/queue.hpp>
// #include <uvw.hpp>
#include <functional>
#include <map>
#include <vector>
#include "ev.hpp"
#include "udp_handle.hpp"
namespace llarp::uv
{
class UVWakeup;

@ -1,5 +1,5 @@
#include "ev.hpp"
#include "../util/buffer.hpp"
#include "ev.hpp"
namespace llarp
{

@ -1,4 +1,5 @@
#include "context.hpp"
#include <memory>
#include <stdexcept>

@ -1,10 +1,11 @@
#pragma once
#include "policy.hpp"
#include <llarp/handlers/exit.hpp>
#include <string>
#include <unordered_map>
#include "policy.hpp"
namespace llarp::exit
{
/// owner of all the exit endpoints

@ -5,6 +5,7 @@
#include <llarp/path/abstracthophandler.hpp>
#include <llarp/service/protocol_type.hpp>
#include <llarp/util/time.hpp>
#include <queue>
namespace llarp

@ -1,8 +1,9 @@
#pragma once
#include <oxenc/bt.h>
#include <llarp/util/bencode.hpp>
#include <oxenc/bt.h>
namespace
{
static auto policy_cat = llarp::log::Cat("lokinet.policy");

@ -2,9 +2,10 @@
#include <llarp/crypto/crypto.hpp>
#include <llarp/nodedb.hpp>
#include <llarp/path/path_context.hpp>
#include <llarp/path/path.hpp>
#include <llarp/path/path_context.hpp>
#include <llarp/router/router.hpp>
#include <utility>
namespace llarp::exit

@ -1,9 +1,10 @@
#pragma once
#include <llarp/service/protocol_type.hpp>
#include <llarp/constants/path.hpp>
#include <llarp/net/ip_packet.hpp>
#include <llarp/path/pathbuilder.hpp>
#include <llarp/constants/path.hpp>
#include <llarp/service/protocol_type.hpp>
#include <deque>
#include <queue>

@ -3,9 +3,10 @@
#include <llarp/dns/dns.hpp>
#include <llarp/net/net.hpp>
#include <llarp/path/path_context.hpp>
#include <llarp/router/router.hpp>
#include <llarp/router/rc_lookup_handler.hpp>
#include <llarp/router/router.hpp>
#include <llarp/service/protocol_type.hpp>
#include <cassert>
namespace llarp::handlers

@ -1,10 +1,11 @@
#pragma once
#include <llarp/exit/endpoint.hpp>
#include "tun.hpp"
#include <llarp/dns/server.hpp>
#include <unordered_map>
#include <llarp/exit/endpoint.hpp>
#include "tun.hpp"
#include <unordered_map>
namespace llarp
{

@ -1,10 +1,10 @@
#pragma once
#include <llarp/ev/ev.hpp>
#include <llarp/link/tunnel.hpp>
#include <llarp/router/router.hpp>
#include <llarp/service/endpoint.hpp>
#include <llarp/service/protocol_type.hpp>
#include <llarp/router/router.hpp>
#include <llarp/ev/ev.hpp>
#include <llarp/vpn/egres_packet_router.hpp>
namespace llarp::handlers

@ -1,26 +1,26 @@
#include "tun.hpp"
#include <algorithm>
#include <iterator>
#include <variant>
#include "tun.hpp"
#ifndef _WIN32
#include <sys/socket.h>
#endif
#include <llarp/constants/platform.hpp>
#include <llarp/dns/dns.hpp>
#include <llarp/ev/ev.hpp>
#include <llarp/net/net.hpp>
#include <llarp/router/router.hpp>
#include <llarp/nodedb.hpp>
#include <llarp/router/route_poker.hpp>
#include <llarp/router/router.hpp>
#include <llarp/rpc/endpoint_rpc.hpp>
#include <llarp/service/context.hpp>
#include <llarp/service/outbound_context.hpp>
#include <llarp/service/endpoint_state.hpp>
#include <llarp/service/name.hpp>
#include <llarp/service/outbound_context.hpp>
#include <llarp/service/protocol_type.hpp>
#include <llarp/nodedb.hpp>
#include <llarp/rpc/endpoint_rpc.hpp>
#include <llarp/util/str.hpp>
#include <llarp/constants/platform.hpp>
namespace llarp::handlers
{

@ -11,6 +11,7 @@
#include <llarp/util/thread/threading.hpp>
#include <llarp/vpn/packet_router.hpp>
#include <llarp/vpn/platform.hpp>
#include <future>
#include <type_traits>
#include <variant>

@ -1,7 +1,8 @@
#pragma once
#include <llarp/router_id.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/router_id.hpp>
#include <quic.hpp>
namespace llarp::link

@ -1,13 +1,14 @@
#include "link_manager.hpp"
#include "connection.hpp"
#include "contacts.hpp"
#include <llarp/messages/dht.hpp>
#include <llarp/messages/exit.hpp>
#include <llarp/messages/path.hpp>
#include <llarp/router/router.hpp>
#include <llarp/router/rc_lookup_handler.hpp>
#include <llarp/nodedb.hpp>
#include <llarp/router/rc_lookup_handler.hpp>
#include <llarp/router/router.hpp>
#include <algorithm>
#include <set>

@ -1,19 +1,21 @@
#pragma once
#include "connection.hpp"
#include <llarp/constants/path.hpp>
#include <llarp/util/decaying_hashset.hpp>
#include <llarp/crypto/crypto.hpp>
#include <llarp/router/rc_lookup_handler.hpp>
#include <llarp/router_contact.hpp>
#include <llarp/crypto/crypto.hpp>
#include <llarp/util/compare_ptr.hpp>
#include <quic.hpp>
#include <llarp/util/decaying_hashset.hpp>
#include <llarp/util/logging.hpp>
#include <llarp/util/priority_queue.hpp>
#include <unordered_map>
#include <set>
#include <atomic>
#include "connection.hpp"
#include <quic.hpp>
#include <atomic>
#include <set>
#include <unordered_map>
namespace
{

@ -1,12 +1,14 @@
#include "tunnel.hpp"
#include <llarp/ev/libuv.hpp>
#include <llarp/service/convotag.hpp>
#include <llarp/service/endpoint.hpp>
#include <llarp/service/name.hpp>
#include <limits>
#include <llarp/util/logging.hpp>
#include <llarp/util/logging/buffer.hpp>
#include <llarp/util/str.hpp>
#include <llarp/ev/libuv.hpp>
#include <limits>
#include <memory>
#include <stdexcept>
#include <type_traits>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save