mirror of https://github.com/oxen-io/lokinet
Merge pull request #2108 from majestrate/service-refactor-2023-01-08
[internals refactor] docs and reorganize compilation units
This commit is contained in:
commit
7ae1a1a83b
|
@ -54,3 +54,8 @@ PointerAlignment: Left
|
|||
# when wrapping function calls/declarations, force each parameter to have its own line
|
||||
BinPackParameters: 'false'
|
||||
BinPackArguments: 'false'
|
||||
|
||||
# TODO: uncomment me when we are reading to rearrange the header includes
|
||||
# IncludeBlocks: Regroup
|
||||
# IncludeCategories: 'llarp/'
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ endif()
|
|||
option(USE_AVX2 "enable avx2 code" OFF)
|
||||
option(USE_NETNS "enable networking namespace support. Linux only" OFF)
|
||||
option(NATIVE_BUILD "optimise for host system and FPU" ON)
|
||||
option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF)
|
||||
option(BUILD_LIBLOKINET "build liblokinet.so" ON)
|
||||
option(WITH_EMBEDDED_LOKINET "build liblokinet.so for embedded lokinet" OFF)
|
||||
option(XSAN "use sanitiser, if your system has it (requires -DCMAKE_BUILD_TYPE=Debug)" OFF)
|
||||
option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON)
|
||||
option(TESTNET "testnet build" OFF)
|
||||
|
|
|
@ -33,7 +33,6 @@ for abi in $build_abis; do
|
|||
-DBUILD_PACKAGE=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_LIBLOKINET=OFF \
|
||||
-DWITH_TESTS=OFF \
|
||||
-DWITH_BOOTSTRAP=OFF \
|
||||
-DNATIVE_BUILD=OFF \
|
||||
|
|
|
@ -13,7 +13,6 @@ cd build-mac
|
|||
cmake \
|
||||
-G Ninja \
|
||||
-DBUILD_STATIC_DEPS=ON \
|
||||
-DBUILD_LIBLOKINET=OFF \
|
||||
-DWITH_TESTS=OFF \
|
||||
-DWITH_BOOTSTRAP=OFF \
|
||||
-DNATIVE_BUILD=OFF \
|
||||
|
|
|
@ -32,7 +32,6 @@ cmake \
|
|||
-DBUILD_PACKAGE=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_LIBLOKINET=OFF \
|
||||
-DWITH_TESTS=OFF \
|
||||
-DWITH_BOOTSTRAP=OFF \
|
||||
-DNATIVE_BUILD=OFF \
|
||||
|
|
|
@ -20,7 +20,7 @@ add_library(lokinet-cryptography
|
|||
libntrup/src/ref/rq.c
|
||||
)
|
||||
|
||||
target_include_directories(lokinet-cryptography PUBLIC libntrup/include)
|
||||
target_include_directories(lokinet-cryptography PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libntrup/include)
|
||||
|
||||
# The avx implementation uses runtime CPU feature detection to enable itself, so we *always* want to
|
||||
# compile it with avx2/fma support when supported by the compiler even if we aren't compiling with
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
# High Level Iterative Approach
|
||||
|
||||
the desired outcome of this refactor will be splitting the existing code up into a stack of new components.
|
||||
a layer hides all functionality of the layer below it to reduce the complexity like the OSI stack intends to.
|
||||
the refactor starts at the top layer, wiring up the old implementation piecewise to the top layer.
|
||||
once the top layer is wired up to the old implementation we will move down to the next layer.
|
||||
this will repeat until we reach the bottom layer.
|
||||
once the old implementation is wired up into these new clearly defined layers, we can fixup or replace different parts of each layer one at a time as needed.
|
||||
|
||||
working down from each layer will let us pick apart the old implementation (if needed) that we would wire up to the new base classes for that layer we are defining now without worrying about what is below it (yet).
|
||||
|
||||
this refactor is very able to be split up into small work units that (ideally) do not confict with each other.
|
||||
|
||||
|
||||
PDU: https://en.wikipedia.org/wiki/Protocol_data_unit
|
||||
|
||||
# The New Layers
|
||||
|
||||
from top to bottom the new layers are:
|
||||
|
||||
* Platform Layer
|
||||
* Flow Layer
|
||||
* Routing Layer
|
||||
* Onion Layer
|
||||
* Link Layer
|
||||
* Wire Layer
|
||||
|
||||
|
||||
## Platform Layer
|
||||
|
||||
this is the top layer, it is responsibile ONLY to act as a handler of reading data from the "user" (via tun interface or whatever) to forward to the flow layer as desired, and to take data from the flow layer and send it to the "user".
|
||||
any kind of IP/dns mapping or traffic isolation details are done here. embedded lokinet would be implemented in this layer as well, as it is without a full tun interface.
|
||||
|
||||
Platform layer PDU are what the OS gives us and we internally convert them into flow layer PDU and hand them off to the flow layer.
|
||||
|
||||
|
||||
## Flow Layer
|
||||
|
||||
this layer is tl;dr mean to multiplex data from the platform layer across the routing layer and propagating PDU from the routing to the platform layer if needed.
|
||||
|
||||
the flow layer is responsible for sending platform layer PDU across path we have already established.
|
||||
this layer is informed by the routing layer below it of state changes in what paths are available for use.
|
||||
the flow layer requests from the layer below to make new paths if it wishes to get new ones on demand.
|
||||
this layer will recieve routing layer PDU from the routing layer and apply any congestion control needed to buffer things to the os if it is needed at all.
|
||||
|
||||
flow layer PDU are (data, ethertype, src-pubkey, dst-pubkey, isolation-metric) tuples.
|
||||
data is the datum we are tunneling over lokinet. ethertype tells us what kind of datum this is, e.g. plainquic/ipv4/ipv6/auth/etc.
|
||||
src-pubkey and dst-pubkey are public the ed25519 public keys of each end of the flow in use.
|
||||
the isolation metric is a piece of metadata we use to distinguish unique flows (convotag). in this new seperation convotags explicitly do not hand over across paths.
|
||||
|
||||
|
||||
## Routing Layer
|
||||
|
||||
this layer is tl;dr meant for path management but not path building.
|
||||
|
||||
the routing layer is responsible for sending/recieving flow layer PDU, DHT requests/responses, latency testing PDU and any other kind of PDU we send/recieve over the onion layer.
|
||||
this layer will be responsible for managing paths we have already built across lokinet.
|
||||
the routing layer will periodically measure path status/latency, and do any other kinds of perioidic path related tasks post build.
|
||||
this layer when asked for a new path from the flow layer will use one that has been prebuilt already and if the number of prebuilt paths is below a threshold we will tell the onion layer to build more paths.
|
||||
the routing layer will recieve path build results be their success/fail/timeout from the onion layer that were requested and apply any congestion control needed at the pivot router.
|
||||
|
||||
routing layer PDU are (data, src-path, dst-path) tuples.
|
||||
data is the datum we are transferring between paths.
|
||||
src-path and dst-path are (pathid, router id) tuples, the source being which path this routing layer PDU originated from, destination being which path it is going to.
|
||||
in the old model, router id is always the router that recieves it as the pivot router, this remains the same unless we explicitly provide router-id.
|
||||
this lets us propagate hints to DHT related PDU held inside the datum.
|
||||
|
||||
|
||||
## Onion Layer
|
||||
|
||||
the onion layer is repsonsible for path builds, path selection logic and low level details of encrypted/decrypting PDU that are onion routed over paths.
|
||||
this layer is requested by the routing layer to build a path to a pivot router with an optional additional constraints (e.g. unique cidr/operator/geoip/etc, latency constaints, hop length, path lifetime).
|
||||
the onion layer will encrypt PDU and send them to link layer as (frame/edge router id) tuples, and recieve link layer frames from edge routers, decrypt them and propagate them as needed to the routing layer.
|
||||
this layer also handles transit onion traffic and transit path build responsibilities as a snode and apply congestion control as needed per transit path.
|
||||
|
||||
the onion layer PDU are (data, src-path, dst-path) tuples.
|
||||
src-path and dst-path are (router-id, path-id) tuples which contain the ed25519 pubkey of the node and the 128 bit path-id it was associated with.
|
||||
data is some datum we are onion routing that we would apply symettric encryption as needed before propagating to upper or lower layers.
|
||||
|
||||
|
||||
## Link Layer
|
||||
|
||||
the link layer is responsbile for transmission of frames between nodes.
|
||||
this layer will handle queuing and congestion control between wire proto sessions between nodes.
|
||||
the link layer is will initate and recieve wire session to/from remote nodes.
|
||||
|
||||
the link layer PDU is (data, src-router-id, dst-router-id) tuples.
|
||||
data is a datum of a link layer frame.
|
||||
src-router-id and dst-router-id are (ed25519-pubkey, net-addr, wire-proto-info) tuples.
|
||||
the ed25519 pubkey is a .snode address, (clients have these too but they are ephemeral).
|
||||
net-addr is an (ip, port) tuple the node is reachable via the wire protocol.
|
||||
wire-proto-info is dialect specific wire protocol specific info.
|
||||
|
||||
## Wire Layer
|
||||
|
||||
the wire layer is responsible for transmitting link layer frames between nodes.
|
||||
all details here are specific to each wire proto dialect.
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
option(SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON)
|
||||
if(SUBMODULE_CHECK)
|
||||
find_package(Git)
|
||||
|
@ -140,3 +139,27 @@ if(WITH_BOOTSTRAP)
|
|||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# libcrypt defaults, only on with macos and non static linux
|
||||
set(default_libcrypt OFF)
|
||||
|
||||
if(LINUX AND NOT STATIC_LINK)
|
||||
set(default_libcrypt ON)
|
||||
endif()
|
||||
if(MACOS)
|
||||
set(default_libcrypt ON)
|
||||
endif()
|
||||
|
||||
option(WITH_LIBCRYPT "enable fast password hash with libcrypt" ${default_libcrypt})
|
||||
|
||||
add_library(lokinet-libcrypt INTERFACE)
|
||||
if(WITH_LIBCRYPT)
|
||||
pkg_check_modules(LIBCRYPT libcrypt IMPORTED_TARGET REQUIRED)
|
||||
add_definitions(-DHAVE_CRYPT)
|
||||
target_link_libraries(lokinet-libcrypt INTERFACE PkgConfig::LIBCRYPT)
|
||||
message(STATUS "using libcrypt ${LIBCRYPT_VERSION}")
|
||||
else()
|
||||
# TODO static build lib crypt?
|
||||
message(STATUS "not building with libcrypt")
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
include(Version)
|
||||
|
||||
target_sources(lokinet-cryptography PRIVATE
|
||||
crypto/crypto_libsodium.cpp
|
||||
crypto/crypto.cpp
|
||||
crypto/encrypted_frame.cpp
|
||||
crypto/types.cpp
|
||||
)
|
||||
|
||||
add_library(lokinet-util
|
||||
STATIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp
|
||||
|
@ -15,19 +22,9 @@ add_library(lokinet-util
|
|||
util/thread/threading.cpp
|
||||
util/time.cpp)
|
||||
|
||||
|
||||
add_dependencies(lokinet-util genversion)
|
||||
|
||||
target_include_directories(lokinet-util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(lokinet-util PUBLIC
|
||||
lokinet-cryptography
|
||||
nlohmann_json::nlohmann_json
|
||||
filesystem
|
||||
oxenc::oxenc
|
||||
oxen::logging
|
||||
)
|
||||
|
||||
# lokinet-platform holds all platform specific code
|
||||
add_library(lokinet-platform
|
||||
STATIC
|
||||
# for networking
|
||||
|
@ -45,9 +42,6 @@ add_library(lokinet-platform
|
|||
vpn/platform.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(lokinet-platform PUBLIC lokinet-cryptography lokinet-util Threads::Threads base_libs uvw)
|
||||
target_link_libraries(lokinet-platform PRIVATE oxenmq::oxenmq)
|
||||
|
||||
if (ANDROID)
|
||||
target_sources(lokinet-platform PRIVATE android/ifaddrs.c util/nop_service_manager.cpp)
|
||||
endif()
|
||||
|
@ -66,36 +60,26 @@ if (WIN32)
|
|||
net/win32.cpp
|
||||
vpn/win32.cpp
|
||||
win32/service_manager.cpp
|
||||
win32/exec.cpp)
|
||||
add_library(lokinet-win32 STATIC
|
||||
win32/exec.cpp
|
||||
win32/dll.cpp
|
||||
win32/exception.cpp)
|
||||
add_library(lokinet-wintun STATIC
|
||||
win32/wintun.cpp)
|
||||
add_library(lokinet-windivert STATIC
|
||||
win32/exception.cpp
|
||||
win32/wintun.cpp
|
||||
win32/windivert.cpp)
|
||||
|
||||
# wintun and windivert are privated linked by lokinet-platform
|
||||
# this is so their details do not leak out to deps of lokinet-platform
|
||||
# wintun and windivert still need things from lokinet-platform
|
||||
target_compile_options(lokinet-wintun PUBLIC -I${CMAKE_BINARY_DIR}/wintun/include/)
|
||||
target_compile_options(lokinet-windivert PUBLIC -I${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/include/)
|
||||
target_include_directories(lokinet-windivert PUBLIC ${PROJECT_SOURCE_DIR})
|
||||
target_link_libraries(lokinet-wintun PUBLIC lokinet-platform lokinet-util lokinet-config)
|
||||
target_link_libraries(lokinet-win32 PUBLIC lokinet-util)
|
||||
target_link_libraries(lokinet-windivert PUBLIC oxen-logging)
|
||||
target_link_libraries(lokinet-windivert PRIVATE lokinet-win32)
|
||||
target_link_libraries(lokinet-platform PRIVATE lokinet-win32 lokinet-wintun lokinet-windivert)
|
||||
target_include_directories(lokinet-platform PRIVATE ${CMAKE_BINARY_DIR}/wintun/include/ ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/include/)
|
||||
else()
|
||||
target_sources(lokinet-platform PRIVATE
|
||||
net/posix.cpp)
|
||||
endif()
|
||||
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
target_include_directories(lokinet-platform SYSTEM PUBLIC /usr/local/include)
|
||||
if(APPLE)
|
||||
add_subdirectory(apple)
|
||||
target_sources(lokinet-platform PRIVATE util/nop_service_manager.cpp)
|
||||
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
|
||||
STATIC
|
||||
dns/message.cpp
|
||||
|
@ -107,13 +91,50 @@ add_library(lokinet-dns
|
|||
dns/server.cpp
|
||||
dns/srv_data.cpp)
|
||||
|
||||
# platform specific bits and bobs for setting dns
|
||||
add_library(lokinet-dns-platform INTERFACE)
|
||||
if(WITH_SYSTEMD)
|
||||
target_sources(lokinet-dns PRIVATE dns/nm_platform.cpp dns/sd_platform.cpp)
|
||||
add_library(lokinet-dns-systemd STATIC dns/nm_platform.cpp dns/sd_platform.cpp)
|
||||
target_link_libraries(lokinet-dns-platform INTERFACE lokinet-dns-systemd)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lokinet-dns PUBLIC lokinet-platform uvw)
|
||||
target_link_libraries(lokinet-dns PRIVATE libunbound lokinet-config)
|
||||
# lokinet-nodedb holds all types and logic for storing parsing and constructing
|
||||
# nodedb data published to the network and versions of it stored locally
|
||||
add_library(lokinet-nodedb
|
||||
STATIC
|
||||
bootstrap.cpp
|
||||
net/address_info.cpp
|
||||
net/exit_info.cpp
|
||||
net/traffic_policy.cpp
|
||||
nodedb.cpp
|
||||
pow.cpp
|
||||
profiling.cpp
|
||||
router_contact.cpp
|
||||
router_id.cpp
|
||||
router_version.cpp
|
||||
)
|
||||
|
||||
set(BOOTSTRAP_FALLBACKS)
|
||||
foreach(bs IN ITEMS MAINNET TESTNET)
|
||||
if(BOOTSTRAP_FALLBACK_${bs})
|
||||
message(STATUS "Building with ${bs} fallback boostrap path \"${BOOTSTRAP_FALLBACK_${bs}}\"")
|
||||
file(READ "${BOOTSTRAP_FALLBACK_${bs}}" bs_data HEX)
|
||||
if(bs STREQUAL TESTNET)
|
||||
set(network "gamma")
|
||||
elseif(bs STREQUAL MAINNET)
|
||||
set(network "lokinet")
|
||||
else()
|
||||
string(TOLOWER "${bs}" network)
|
||||
endif()
|
||||
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "\\\\x\\1" bs_data "${bs_data}")
|
||||
set(BOOTSTRAP_FALLBACKS "${BOOTSTRAP_FALLBACKS}{\"${network}\"s, \"${bs_data}\"sv},\n")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_file("bootstrap-fallbacks.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/bootstrap-fallbacks.cpp" @ONLY)
|
||||
target_sources(lokinet-nodedb PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/bootstrap-fallbacks.cpp")
|
||||
|
||||
|
||||
# lokinet-config is for all configuration types and parsers
|
||||
add_library(lokinet-config
|
||||
STATIC
|
||||
config/config.cpp
|
||||
|
@ -121,18 +142,15 @@ add_library(lokinet-config
|
|||
config/ini.cpp
|
||||
config/key_manager.cpp)
|
||||
|
||||
target_link_libraries(lokinet-config PUBLIC lokinet-dns lokinet-platform oxenmq::oxenmq)
|
||||
|
||||
add_library(lokinet-amalgum
|
||||
# lokinet-consensus is for deriving and tracking network consensus state for both service nodes and clients
|
||||
add_library(lokinet-consensus
|
||||
STATIC
|
||||
consensus/reachability_testing.cpp
|
||||
)
|
||||
|
||||
bootstrap.cpp
|
||||
context.cpp
|
||||
crypto/crypto_libsodium.cpp
|
||||
crypto/crypto.cpp
|
||||
crypto/encrypted_frame.cpp
|
||||
crypto/types.cpp
|
||||
# lokinet-dht holds all logic related to interacting with and participating in the DHT hashring
|
||||
add_library(lokinet-dht
|
||||
STATIC
|
||||
dht/context.cpp
|
||||
dht/dht.cpp
|
||||
dht/explorenetworkjob.cpp
|
||||
|
@ -151,44 +169,56 @@ add_library(lokinet-amalgum
|
|||
dht/recursiverouterlookup.cpp
|
||||
dht/serviceaddresslookup.cpp
|
||||
dht/taglookup.cpp
|
||||
)
|
||||
|
||||
endpoint_base.cpp
|
||||
# lokinet-layer-flow is the flow layer which sits atop the routing layer which manages
|
||||
# flows between lokinet snapp endpoints be they .loki or .snode
|
||||
add_library(lokinet-layer-flow
|
||||
STATIC
|
||||
layers/flow/stub.cpp # todo: remove me
|
||||
)
|
||||
|
||||
exit/context.cpp
|
||||
exit/endpoint.cpp
|
||||
exit/exit_messages.cpp
|
||||
exit/policy.cpp
|
||||
exit/session.cpp
|
||||
handlers/exit.cpp
|
||||
handlers/tun.cpp
|
||||
iwp/iwp.cpp
|
||||
iwp/linklayer.cpp
|
||||
iwp/message_buffer.cpp
|
||||
iwp/session.cpp
|
||||
link/link_manager.cpp
|
||||
link/session.cpp
|
||||
link/server.cpp
|
||||
messages/dht_immediate.cpp
|
||||
messages/link_intro.cpp
|
||||
messages/link_message_parser.cpp
|
||||
messages/relay.cpp
|
||||
messages/relay_commit.cpp
|
||||
messages/relay_status.cpp
|
||||
net/address_info.cpp
|
||||
net/exit_info.cpp
|
||||
net/traffic_policy.cpp
|
||||
nodedb.cpp
|
||||
|
||||
# lokinet-layer-onion is the "dumb" onion routing layer with builds manages and does i/o
|
||||
# with onion paths. onion paths anonymize routing layer pdu.
|
||||
add_library(lokinet-layer-onion
|
||||
STATIC
|
||||
path/ihophandler.cpp
|
||||
path/path_context.cpp
|
||||
path/path.cpp
|
||||
path/pathbuilder.cpp
|
||||
path/pathset.cpp
|
||||
path/transit_hop.cpp
|
||||
peerstats/peer_db.cpp
|
||||
peerstats/types.cpp
|
||||
pow.cpp
|
||||
profiling.cpp
|
||||
|
||||
messages/relay.cpp
|
||||
messages/relay_commit.cpp
|
||||
messages/relay_status.cpp
|
||||
)
|
||||
|
||||
# lokinet-layer-wire is a layer 1 analog which splits up
|
||||
# layer 2 frames into layer 1 symbols which in the case of iwp are encrypted udp/ip packets
|
||||
add_library(lokinet-layer-wire
|
||||
STATIC
|
||||
iwp/iwp.cpp
|
||||
iwp/linklayer.cpp
|
||||
iwp/message_buffer.cpp
|
||||
iwp/session.cpp
|
||||
)
|
||||
|
||||
# lokinet-layer-link is for our layer 2 analog which splits up layer 2 frames into
|
||||
# a series of layer 1 symbols which are then transmitted between lokinet instances
|
||||
add_library(lokinet-layer-link
|
||||
STATIC
|
||||
link/link_manager.cpp
|
||||
link/session.cpp
|
||||
link/server.cpp
|
||||
messages/dht_immediate.cpp
|
||||
messages/link_intro.cpp
|
||||
messages/link_message_parser.cpp
|
||||
)
|
||||
|
||||
# lokinet-plainquic is for holding the tunneled plainquic code, not quic wire protocol code
|
||||
add_library(lokinet-plainquic
|
||||
STATIC
|
||||
quic/address.cpp
|
||||
quic/client.cpp
|
||||
quic/connection.cpp
|
||||
|
@ -197,27 +227,61 @@ add_library(lokinet-amalgum
|
|||
quic/server.cpp
|
||||
quic/stream.cpp
|
||||
quic/tunnel.cpp
|
||||
)
|
||||
|
||||
router_contact.cpp
|
||||
router_id.cpp
|
||||
router_version.cpp
|
||||
service/name.cpp
|
||||
# lokinet-context holds the contextualized god objects for a lokinet instance
|
||||
# it is what any main function would link to in practice but it is hidden behind an interface library (lokinet-amalgum)
|
||||
add_library(lokinet-context
|
||||
STATIC
|
||||
context.cpp
|
||||
link/link_manager.cpp
|
||||
router/outbound_message_handler.cpp
|
||||
router/outbound_session_maker.cpp
|
||||
router/rc_lookup_handler.cpp
|
||||
router/rc_gossiper.cpp
|
||||
router/router.cpp
|
||||
router/route_poker.cpp
|
||||
)
|
||||
|
||||
# lokinet-rpc holds all rpc related compilation units
|
||||
add_library(lokinet-rpc
|
||||
STATIC
|
||||
rpc/lokid_rpc_client.cpp
|
||||
rpc/rpc_server.cpp
|
||||
rpc/endpoint_rpc.cpp
|
||||
)
|
||||
|
||||
# optional peer stats library
|
||||
add_library(lokinet-peerstats
|
||||
STATIC
|
||||
peerstats/peer_db.cpp
|
||||
peerstats/types.cpp
|
||||
)
|
||||
|
||||
# lokinet-layer-routing holds logic related to the routing layer
|
||||
# routing layer is anonymized over the onion layer
|
||||
add_library(lokinet-layer-routing
|
||||
STATIC
|
||||
routing/dht_message.cpp
|
||||
routing/message_parser.cpp
|
||||
routing/path_confirm_message.cpp
|
||||
routing/path_latency_message.cpp
|
||||
routing/path_transfer_message.cpp
|
||||
routing/transfer_traffic_message.cpp
|
||||
rpc/lokid_rpc_client.cpp
|
||||
rpc/rpc_server.cpp
|
||||
rpc/endpoint_rpc.cpp
|
||||
)
|
||||
|
||||
# kitchen sink to be removed after refactor
|
||||
add_library(lokinet-service-deprecated-kitchensink
|
||||
STATIC
|
||||
endpoint_base.cpp
|
||||
exit/context.cpp
|
||||
exit/endpoint.cpp
|
||||
exit/exit_messages.cpp
|
||||
exit/policy.cpp
|
||||
exit/session.cpp
|
||||
handlers/exit.cpp
|
||||
handlers/tun.cpp
|
||||
service/name.cpp
|
||||
service/address.cpp
|
||||
service/async_key_exchange.cpp
|
||||
service/auth.cpp
|
||||
|
@ -242,65 +306,216 @@ add_library(lokinet-amalgum
|
|||
service/tag.cpp
|
||||
)
|
||||
|
||||
set(BOOTSTRAP_FALLBACKS)
|
||||
foreach(bs IN ITEMS MAINNET TESTNET)
|
||||
if(BOOTSTRAP_FALLBACK_${bs})
|
||||
message(STATUS "Building with ${bs} fallback boostrap path \"${BOOTSTRAP_FALLBACK_${bs}}\"")
|
||||
file(READ "${BOOTSTRAP_FALLBACK_${bs}}" bs_data HEX)
|
||||
if(bs STREQUAL TESTNET)
|
||||
set(network "gamma")
|
||||
elseif(bs STREQUAL MAINNET)
|
||||
set(network "lokinet")
|
||||
else()
|
||||
string(TOLOWER "${bs}" network)
|
||||
endif()
|
||||
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "\\\\x\\1" bs_data "${bs_data}")
|
||||
set(BOOTSTRAP_FALLBACKS "${BOOTSTRAP_FALLBACKS}{\"${network}\"s, \"${bs_data}\"sv},\n")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_file("bootstrap-fallbacks.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/bootstrap-fallbacks.cpp" @ONLY)
|
||||
target_sources(lokinet-amalgum PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/bootstrap-fallbacks.cpp")
|
||||
add_library(lokinet-layer-platform
|
||||
STATIC
|
||||
layers/platform/stub.cpp # todo: remove me
|
||||
)
|
||||
|
||||
if(WITH_PEERSTATS_BACKEND)
|
||||
target_compile_definitions(lokinet-amalgum PRIVATE -DLOKINET_PEERSTATS_BACKEND)
|
||||
target_link_libraries(lokinet-amalgum PUBLIC sqlite_orm)
|
||||
endif()
|
||||
|
||||
# interal tooling for pybind
|
||||
add_library(lokinet-tooling INTERFACE)
|
||||
if(WITH_HIVE)
|
||||
target_sources(lokinet-amalgum PRIVATE
|
||||
add_library(lokinet-hive-tooling
|
||||
STATIC
|
||||
tooling/router_hive.cpp
|
||||
tooling/hive_router.cpp
|
||||
tooling/hive_context.cpp
|
||||
)
|
||||
target_link_libraries(lokinet-tooling INTERFACE lokinet-hive-tooling)
|
||||
endif()
|
||||
|
||||
# TODO: make libunbound hidden behind a feature flag like sqlite for embedded lokinet
|
||||
target_link_libraries(lokinet-amalgum PRIVATE libunbound)
|
||||
|
||||
target_link_libraries(lokinet-amalgum PUBLIC
|
||||
CLI11
|
||||
oxenc::oxenc
|
||||
lokinet-platform
|
||||
lokinet-config
|
||||
# interface library for setting commone includes, linkage and flags.
|
||||
add_library(lokinet-base INTERFACE)
|
||||
target_include_directories(lokinet-base
|
||||
INTERFACE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include
|
||||
)
|
||||
target_link_libraries(lokinet-base INTERFACE oxen::logging lokinet-cryptography)
|
||||
|
||||
if(WITH_PEERSTATS)
|
||||
target_compile_definitions(lokinet-base INTERFACE -DLOKINET_PEERSTATS_BACKEND)
|
||||
target_link_libraries(lokinet-base INTERFACE sqlite_orm)
|
||||
endif()
|
||||
|
||||
# interface libraries for internal linkage
|
||||
add_library(lokinet-layers INTERFACE)
|
||||
add_library(lokinet-amalgum INTERFACE)
|
||||
|
||||
|
||||
# helper function to link a library to lokinet-base, enable lto, add to lokinet-amalgum and then link to other libs
|
||||
function(lokinet_link_lib libname)
|
||||
message(DEBUG "created target: ${libname}")
|
||||
enable_lto(${libname})
|
||||
target_link_libraries(${libname} PUBLIC lokinet-base ${ARGN})
|
||||
target_link_libraries(lokinet-amalgum INTERFACE ${libname})
|
||||
endfunction()
|
||||
|
||||
# internal public linkages of components
|
||||
lokinet_link_lib(lokinet-util)
|
||||
lokinet_link_lib(lokinet-cryptography lokinet-libcrypt lokinet-util)
|
||||
lokinet_link_lib(lokinet-peerstats lokinet-context)
|
||||
lokinet_link_lib(lokinet-consensus lokinet-context)
|
||||
lokinet_link_lib(lokinet-layer-link lokinet-peerstats)
|
||||
|
||||
if(TARGET lokinet-hive-tooling)
|
||||
lokinet_link_lib(lokinet-hive-tooling lokinet-context)
|
||||
endif()
|
||||
|
||||
if(TARGET lokinet-dns-systemd)
|
||||
lokinet_link_lib(lokinet-dns-systemd
|
||||
lokinet-dns
|
||||
lokinet-util
|
||||
lokinet-cryptography
|
||||
ngtcp2_static
|
||||
oxenmq::oxenmq)
|
||||
|
||||
enable_lto(lokinet-util lokinet-platform lokinet-dns lokinet-config lokinet-amalgum)
|
||||
|
||||
pkg_check_modules(CRYPT libcrypt IMPORTED_TARGET)
|
||||
if(CRYPT_FOUND AND NOT CMAKE_CROSSCOMPILING)
|
||||
add_definitions(-DHAVE_CRYPT)
|
||||
add_library(libcrypt INTERFACE)
|
||||
target_link_libraries(libcrypt INTERFACE PkgConfig::CRYPT)
|
||||
target_link_libraries(lokinet-amalgum PRIVATE libcrypt)
|
||||
message(STATUS "using libcrypt ${CRYPT_VERSION}")
|
||||
lokinet-platform
|
||||
)
|
||||
endif()
|
||||
|
||||
lokinet_link_lib(lokinet-platform lokinet-util)
|
||||
|
||||
if(BUILD_LIBLOKINET)
|
||||
lokinet_link_lib(lokinet-config
|
||||
lokinet-util
|
||||
lokinet-nodedb
|
||||
lokinet-dns
|
||||
lokinet-platform
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-context
|
||||
lokinet-config
|
||||
lokinet-platform
|
||||
lokinet-peerstats
|
||||
lokinet-layers
|
||||
lokinet-consensus
|
||||
lokinet-rpc
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-dht
|
||||
lokinet-util
|
||||
lokinet-nodedb
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-plainquic
|
||||
lokinet-platform
|
||||
lokinet-config
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-dns
|
||||
lokinet-platform
|
||||
lokinet-dns-platform
|
||||
lokinet-config
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-nodedb
|
||||
lokinet-util
|
||||
lokinet-platform
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-util
|
||||
lokinet-nodedb
|
||||
lokinet-platform
|
||||
)
|
||||
|
||||
lokinet_link_lib(lokinet-rpc
|
||||
lokinet-context
|
||||
lokinet-peerstats
|
||||
lokinet-util
|
||||
)
|
||||
|
||||
# inter lokinet-layer public/private linkage.
|
||||
# when linking each layer, we consider the layer directly below private linkage and the layer above public linkage.
|
||||
# this lets us hide functionality of layers below us when depended on by another component.
|
||||
#
|
||||
# from highest to lowest layer, the above layers are stacked as follows:
|
||||
#
|
||||
# platform (what lokinet snapps interact with, be it l3 os interaction or embedded lokinet)
|
||||
# flow (how we want to route and stripe over our onion routing)
|
||||
# routing (what we are onion routing)
|
||||
# onion (how the onion routing happens)
|
||||
# link (what we want to send over the wire and to where)
|
||||
# wire (what is actually sent over the wire)
|
||||
#
|
||||
function(link_lokinet_layers)
|
||||
set(lib ${ARGV0})
|
||||
if(${ARGC} GREATER 1)
|
||||
lokinet_link_lib(${ARGV1} ${lib})
|
||||
list(REMOVE_AT ARGV 1)
|
||||
target_link_libraries(${lib} PRIVATE ${ARGV1})
|
||||
# recursion :D
|
||||
link_lokinet_layers(${ARGV})
|
||||
else()
|
||||
lokinet_link_lib(${lib})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
link_lokinet_layers(
|
||||
lokinet-layer-platform
|
||||
lokinet-layer-flow
|
||||
lokinet-layer-routing
|
||||
lokinet-layer-onion
|
||||
lokinet-layer-link
|
||||
lokinet-layer-wire
|
||||
)
|
||||
|
||||
# set me to OFF to disable old codepath
|
||||
set(use_old_impl ON)
|
||||
if(use_old_impl)
|
||||
# flow layer deprecated-kitchensink (remove me after refactor)
|
||||
lokinet_link_lib(lokinet-service-deprecated-kitchensink
|
||||
lokinet-dns
|
||||
lokinet-nodedb
|
||||
lokinet-context
|
||||
lokinet-plainquic
|
||||
lokinet-layer-routing
|
||||
lokinet-layer-onion
|
||||
lokinet-dht
|
||||
lokinet-platform
|
||||
lokinet-rpc
|
||||
)
|
||||
target_link_libraries(lokinet-layers INTERFACE lokinet-service-deprecated-kitchensink)
|
||||
endif()
|
||||
|
||||
target_link_libraries(lokinet-layers INTERFACE
|
||||
lokinet-layer-platform
|
||||
lokinet-layer-flow
|
||||
lokinet-layer-routing
|
||||
lokinet-layer-onion
|
||||
lokinet-layer-link
|
||||
lokinet-layer-wire
|
||||
)
|
||||
|
||||
|
||||
# per component external deps
|
||||
|
||||
target_link_libraries(lokinet-config PUBLIC oxenmq::oxenmq)
|
||||
target_link_libraries(lokinet-platform PUBLIC oxenmq::oxenmq)
|
||||
target_link_libraries(lokinet-dns PUBLIC libunbound)
|
||||
|
||||
target_link_libraries(lokinet-cryptography PUBLIC
|
||||
oxenc::oxenc
|
||||
sodium
|
||||
)
|
||||
|
||||
target_link_libraries(lokinet-context PUBLIC
|
||||
CLI11
|
||||
oxenmq::oxenmq
|
||||
uvw
|
||||
)
|
||||
|
||||
target_link_libraries(lokinet-platform PUBLIC
|
||||
Threads::Threads
|
||||
base_libs
|
||||
uvw
|
||||
)
|
||||
|
||||
target_link_libraries(lokinet-util PUBLIC
|
||||
nlohmann_json::nlohmann_json
|
||||
filesystem
|
||||
oxenc::oxenc
|
||||
)
|
||||
|
||||
target_link_libraries(lokinet-plainquic PUBLIC
|
||||
ngtcp2_static
|
||||
uvw
|
||||
)
|
||||
|
||||
if(WITH_EMBEDDED_LOKINET)
|
||||
include(GNUInstallDirs)
|
||||
add_library(lokinet-shared SHARED lokinet_shared.cpp)
|
||||
target_link_libraries(lokinet-shared PUBLIC lokinet-amalgum)
|
||||
|
@ -316,11 +531,5 @@ if(BUILD_LIBLOKINET)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_subdirectory(apple)
|
||||
target_sources(lokinet-platform PRIVATE util/nop_service_manager.cpp)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE docs_SRC */*.hpp *.hpp)
|
||||
|
||||
set(DOCS_SRC ${docs_SRC} PARENT_SCOPE)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include <chrono>
|
||||
#include "config.hpp"
|
||||
|
||||
#include "config/definition.hpp"
|
||||
#include "definition.hpp"
|
||||
#include "ini.hpp"
|
||||
|
||||
#include <llarp/constants/files.hpp>
|
||||
#include <llarp/constants/platform.hpp>
|
||||
#include <llarp/constants/version.hpp>
|
||||
|
@ -18,6 +17,7 @@
|
|||
|
||||
#include <llarp/service/name.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <ios>
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#pragma once
|
||||
#include "ini.hpp"
|
||||
#include "definition.hpp"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#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 "ini.hpp"
|
||||
#include "definition.hpp"
|
||||
#include <llarp/constants/files.hpp>
|
||||
#include <llarp/net/ip_address.hpp>
|
||||
#include <llarp/net/net_int.hpp>
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include <llarp/service/address.hpp>
|
||||
#include <llarp/service/auth.hpp>
|
||||
#include <llarp/dns/srv_data.hpp>
|
||||
|
||||
#include <llarp/router_contact.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <constants/version.hpp>
|
||||
#include <constants/proto.hpp>
|
||||
#include <llarp/constants/version.hpp>
|
||||
#include <llarp/constants/proto.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "rr.hpp"
|
||||
#include "dns.hpp"
|
||||
#include "util/formattable.hpp"
|
||||
#include <llarp/util/formattable.hpp>
|
||||
#include <llarp/util/mem.hpp>
|
||||
#include <llarp/util/logging.hpp>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "exit_messages.hpp"
|
||||
#include "service/protocol_type.hpp"
|
||||
#include <llarp/service/protocol_type.hpp>
|
||||
#include <llarp/net/ip_packet.hpp>
|
||||
#include <llarp/path/pathbuilder.hpp>
|
||||
#include <llarp/routing/transfer_traffic_message.hpp>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <llarp/router/i_rc_lookup_handler.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include "service/protocol_type.hpp"
|
||||
#include <llarp/service/protocol_type.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <llarp/crypto/encrypted_frame.hpp>
|
||||
#include <llarp/crypto/types.hpp>
|
||||
#include "link_message.hpp"
|
||||
#include <llarp/messages/link_message.hpp>
|
||||
#include <llarp/path/path_types.hpp>
|
||||
#include <llarp/pow.hpp>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "pathbuilder.hpp"
|
||||
#include "path_context.hpp"
|
||||
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/messages/relay_commit.hpp>
|
||||
#include <llarp/nodedb.hpp>
|
||||
#include "path_context.hpp"
|
||||
#include "util/logging.hpp"
|
||||
#include <llarp/util/logging.hpp>
|
||||
#include <llarp/profiling.hpp>
|
||||
#include <llarp/router/abstractrouter.hpp>
|
||||
#include <llarp/router/i_rc_lookup_handler.hpp>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "path_types.hpp"
|
||||
#include "service/protocol_type.hpp"
|
||||
#include <llarp/service/protocol_type.hpp>
|
||||
#include <llarp/router_id.hpp>
|
||||
#include <llarp/routing/message.hpp>
|
||||
#include <llarp/service/intro_set.hpp>
|
||||
|
|
|
@ -33,7 +33,9 @@ namespace llarp
|
|||
}
|
||||
|
||||
TransitHop::TransitHop()
|
||||
: m_UpstreamGather(transit_hop_queue_size), m_DownstreamGather(transit_hop_queue_size)
|
||||
: IHopHandler{}
|
||||
, m_UpstreamGather{transit_hop_queue_size}
|
||||
, m_DownstreamGather{transit_hop_queue_size}
|
||||
{
|
||||
m_UpstreamGather.enable();
|
||||
m_DownstreamGather.enable();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <llarp/constants/path.hpp>
|
||||
#include "ihophandler.hpp"
|
||||
#include "path_types.hpp"
|
||||
#include <llarp/path/ihophandler.hpp>
|
||||
#include <llarp/path/path_types.hpp>
|
||||
#include <llarp/routing/handler.hpp>
|
||||
#include <llarp/router_id.hpp>
|
||||
#include <llarp/util/compare_ptr.hpp>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "tunnel.hpp"
|
||||
#include "service/convotag.hpp"
|
||||
#include "service/endpoint.hpp"
|
||||
#include "service/name.hpp"
|
||||
#include <llarp/service/convotag.hpp>
|
||||
#include <llarp/service/endpoint.hpp>
|
||||
#include <llarp/service/name.hpp>
|
||||
#include "stream.hpp"
|
||||
#include <limits>
|
||||
#include <llarp/util/logging.hpp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "route_poker.hpp"
|
||||
#include "abstractrouter.hpp"
|
||||
#include "net/sock_addr.hpp"
|
||||
#include <llarp/router/abstractrouter.hpp>
|
||||
#include <llarp/net/sock_addr.hpp>
|
||||
#include <llarp/service/context.hpp>
|
||||
#include <llarp/dns/platform.hpp>
|
||||
#include <unordered_set>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "convotag.hpp"
|
||||
#include "net/ip.hpp"
|
||||
#include <llarp/net/ip.hpp>
|
||||
|
||||
namespace llarp::service
|
||||
{
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
#include <chrono>
|
||||
#include <memory>
|
||||
#include "endpoint.hpp"
|
||||
#include "endpoint_state.hpp"
|
||||
#include "endpoint_util.hpp"
|
||||
#include "hidden_service_address_lookup.hpp"
|
||||
#include "outbound_context.hpp"
|
||||
#include "protocol.hpp"
|
||||
#include "info.hpp"
|
||||
#include "protocol_type.hpp"
|
||||
|
||||
#include <llarp/net/ip.hpp>
|
||||
#include <llarp/dht/context.hpp>
|
||||
#include <llarp/dht/key.hpp>
|
||||
#include <llarp/dht/messages/findintro.hpp>
|
||||
|
@ -16,27 +24,18 @@
|
|||
#include <llarp/router/abstractrouter.hpp>
|
||||
#include <llarp/routing/dht_message.hpp>
|
||||
#include <llarp/routing/path_transfer_message.hpp>
|
||||
#include "endpoint_state.hpp"
|
||||
#include "endpoint_util.hpp"
|
||||
#include "hidden_service_address_lookup.hpp"
|
||||
#include "net/ip.hpp"
|
||||
#include "outbound_context.hpp"
|
||||
#include "protocol.hpp"
|
||||
#include "service/info.hpp"
|
||||
#include "service/protocol_type.hpp"
|
||||
|
||||
#include <llarp/util/str.hpp>
|
||||
#include <llarp/util/buffer.hpp>
|
||||
#include <llarp/util/meta/memfn.hpp>
|
||||
#include <llarp/link/link_manager.hpp>
|
||||
#include <llarp/tooling/dht_event.hpp>
|
||||
#include <llarp/quic/server.hpp>
|
||||
#include <llarp/quic/tunnel.hpp>
|
||||
#include <llarp/util/priority_queue.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include <llarp/quic/server.hpp>
|
||||
#include <llarp/quic/tunnel.hpp>
|
||||
#include <uvw.hpp>
|
||||
#include <variant>
|
||||
|
||||
|
|
|
@ -6,24 +6,27 @@
|
|||
#include <llarp/net/net.hpp>
|
||||
#include <llarp/path/path.hpp>
|
||||
#include <llarp/path/pathbuilder.hpp>
|
||||
#include "address.hpp"
|
||||
#include "handler.hpp"
|
||||
#include "identity.hpp"
|
||||
#include "pendingbuffer.hpp"
|
||||
#include "protocol.hpp"
|
||||
#include "sendcontext.hpp"
|
||||
#include "service/protocol_type.hpp"
|
||||
#include "session.hpp"
|
||||
#include "lookup.hpp"
|
||||
#include <llarp/util/compare_ptr.hpp>
|
||||
|
||||
// --- begin kitchen sink headers ----
|
||||
#include <llarp/service/address.hpp>
|
||||
#include <llarp/service/handler.hpp>
|
||||
#include <llarp/service/identity.hpp>
|
||||
#include <llarp/service/pendingbuffer.hpp>
|
||||
#include <llarp/service/protocol.hpp>
|
||||
#include <llarp/service/sendcontext.hpp>
|
||||
#include <llarp/service/protocol_type.hpp>
|
||||
#include <llarp/service/session.hpp>
|
||||
#include <llarp/service/lookup.hpp>
|
||||
#include <llarp/service/endpoint_types.hpp>
|
||||
#include <llarp/endpoint_base.hpp>
|
||||
#include <llarp/service/auth.hpp>
|
||||
// ----- end kitchen sink headers -----
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
#include <oxenc/variant.h>
|
||||
#include "endpoint_types.hpp"
|
||||
#include "llarp/endpoint_base.hpp"
|
||||
|
||||
#include "auth.hpp"
|
||||
|
||||
#include <llarp/vpn/egres_packet_router.hpp>
|
||||
#include <llarp/dns/server.hpp>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "intro.hpp"
|
||||
#include "util/time.hpp"
|
||||
#include <llarp/util/time.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#include "outbound_context.hpp"
|
||||
|
||||
#include <llarp/router/abstractrouter.hpp>
|
||||
#include "async_key_exchange.hpp"
|
||||
#include "hidden_service_address_lookup.hpp"
|
||||
#include "endpoint.hpp"
|
||||
#include "endpoint_util.hpp"
|
||||
#include "protocol_type.hpp"
|
||||
|
||||
#include <llarp/router/abstractrouter.hpp>
|
||||
#include <llarp/nodedb.hpp>
|
||||
#include <llarp/profiling.hpp>
|
||||
#include <llarp/util/meta/memfn.hpp>
|
||||
|
||||
#include "endpoint_util.hpp"
|
||||
#include "service/protocol_type.hpp"
|
||||
|
||||
#include <random>
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "router_event.hpp"
|
||||
|
||||
#include <llarp.hpp>
|
||||
#include <config/config.hpp>
|
||||
#include <tooling/hive_context.hpp>
|
||||
#include <llarp/config/config.hpp>
|
||||
#include <llarp/tooling/hive_context.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "vpn/win32.hpp"
|
||||
#include "win32.hpp"
|
||||
#include <llarp/win32/windivert.hpp>
|
||||
#include <llarp/win32/wintun.hpp>
|
||||
#include <fmt/core.h>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include <llarp/tooling/hive_context.hpp>
|
||||
#include <llarp/router/router.hpp>
|
||||
#include <llarp/handlers/pyhandler.hpp>
|
||||
#include "service/protocol_type.hpp"
|
||||
#include <llarp/service/protocol_type.hpp>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
void
|
||||
|
|
|
@ -60,8 +60,4 @@ if(WIN32)
|
|||
target_link_libraries(testAll PUBLIC ws2_32 iphlpapi shlwapi)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
target_link_directories(testAll PRIVATE /usr/local/lib)
|
||||
endif()
|
||||
|
||||
add_custom_target(check COMMAND testAll)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#define CATCH_CONFIG_RUNNER
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <util/logging.hpp>
|
||||
#include <util/service_manager.hpp>
|
||||
#include <llarp/util/logging.hpp>
|
||||
#include <llarp/util/service_manager.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <config/definition.hpp>
|
||||
#include <llarp/config/definition.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <config/ini.hpp>
|
||||
#include <llarp/config/ini.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <config/definition.hpp>
|
||||
#include <llarp/config/definition.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <crypto/types.hpp>
|
||||
#include <llarp/crypto/types.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include <test_util.hpp>
|
||||
#include "test_util.hpp"
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#include <config/key_manager.hpp>
|
||||
#include "llarp_test.hpp"
|
||||
#include "test_util.hpp"
|
||||
|
||||
#include <crypto/crypto.hpp>
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp_test.hpp>
|
||||
#include <llarp/config/key_manager.hpp>
|
||||
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <random>
|
||||
|
||||
#include <string>
|
||||
#include <test_util.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
using namespace ::llarp;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <dns/dns.hpp>
|
||||
#include <dns/message.hpp>
|
||||
#include <dns/name.hpp>
|
||||
#include <dns/rr.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <net/ip.hpp>
|
||||
#include <util/buffer.hpp>
|
||||
#include <llarp/dns/dns.hpp>
|
||||
#include <llarp/dns/message.hpp>
|
||||
#include <llarp/dns/name.hpp>
|
||||
#include <llarp/dns/rr.hpp>
|
||||
#include <llarp/net/net.hpp>
|
||||
#include <llarp/net/ip.hpp>
|
||||
#include <llarp/util/buffer.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
namespace llarp::test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <net/ip_address.hpp>
|
||||
#include <llarp/net/ip_address.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <net/net_int.hpp>
|
||||
#include <net/ip.hpp>
|
||||
#include <net/ip_range.hpp>
|
||||
#include <net/net.hpp>
|
||||
#include <llarp/net/net_int.hpp>
|
||||
#include <llarp/net/ip.hpp>
|
||||
#include <llarp/net/ip_range.hpp>
|
||||
#include <llarp/net/net.hpp>
|
||||
#include <oxenc/hex.h>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <util/mem.hpp>
|
||||
#include <net/sock_addr.hpp>
|
||||
#include <net/net_if.hpp>
|
||||
#include <llarp/util/mem.hpp>
|
||||
#include <llarp/net/sock_addr.hpp>
|
||||
#include <llarp/net/net_if.hpp>
|
||||
#include <llarp/util/logging.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include "config/config.hpp"
|
||||
|
||||
#include <router_contact.hpp>
|
||||
#include <nodedb.hpp>
|
||||
#include <llarp/config/config.hpp>
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <llarp/nodedb.hpp>
|
||||
|
||||
using llarp_nodedb = llarp::NodeDB;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <path/path.hpp>
|
||||
#include <llarp/path/path.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
using Path_t = llarp::path::Path;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include <peerstats/peer_db.hpp>
|
||||
#include <llarp/peerstats/peer_db.hpp>
|
||||
#include <test_util.hpp>
|
||||
|
||||
#include <numeric>
|
||||
#include <catch2/catch.hpp>
|
||||
#include "peerstats/types.hpp"
|
||||
#include "router_contact.hpp"
|
||||
#include "util/logging.hpp"
|
||||
#include "util/time.hpp"
|
||||
#include <llarp/peerstats/types.hpp>
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <llarp/util/logging.hpp>
|
||||
#include <llarp/util/time.hpp>
|
||||
|
||||
TEST_CASE("Test PeerDb PeerStats memory storage", "[PeerDb]")
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <numeric>
|
||||
#include <peerstats/types.hpp>
|
||||
#include <llarp/peerstats/types.hpp>
|
||||
#include <test_util.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <router_version.hpp>
|
||||
#include "router/router.hpp"
|
||||
#include <llarp/router_version.hpp>
|
||||
#include <llarp/router/router.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include <exit/exit_messages.hpp>
|
||||
|
||||
#include <crypto/crypto.hpp>
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp_test.hpp>
|
||||
#include "llarp_test.hpp"
|
||||
#include <llarp/exit/exit_messages.hpp>
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <routing/transfer_traffic_message.hpp>
|
||||
#include <llarp/routing/transfer_traffic_message.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <service/address.hpp>
|
||||
#include <llarp/service/address.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include <crypto/crypto.hpp>
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
#include <sodium/crypto_scalarmult_ed25519.h>
|
||||
#include <path/path.hpp>
|
||||
#include <service/address.hpp>
|
||||
#include <service/identity.hpp>
|
||||
#include <service/intro_set.hpp>
|
||||
#include <util/time.hpp>
|
||||
#include <llarp/path/path.hpp>
|
||||
#include <llarp/service/address.hpp>
|
||||
#include <llarp/service/identity.hpp>
|
||||
#include <llarp/service/intro_set.hpp>
|
||||
#include <llarp/util/time.hpp>
|
||||
|
||||
#include <test_util.hpp>
|
||||
#include "test_util.hpp"
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
using namespace llarp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "catch2/catch.hpp"
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <service/name.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/service/name.hpp>
|
||||
#include <oxenc/hex.h>
|
||||
|
||||
using namespace std::literals;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
#include <crypto/encrypted_frame.hpp>
|
||||
|
||||
#include <crypto/crypto.hpp>
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <llarp_test.hpp>
|
||||
#include <messages/relay_commit.hpp>
|
||||
|
||||
#include <test_util.hpp>
|
||||
|
||||
#include "llarp_test.hpp"
|
||||
#include "test_util.hpp"
|
||||
#include <llarp/crypto/encrypted_frame.hpp>
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/messages/relay_commit.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
using namespace ::llarp;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <crypto/crypto.hpp>
|
||||
#include <crypto/crypto_libsodium.hpp>
|
||||
#include <router_contact.hpp>
|
||||
#include <net/net_int.hpp>
|
||||
#include <llarp/crypto/crypto.hpp>
|
||||
#include <llarp/crypto/crypto_libsodium.hpp>
|
||||
#include <llarp/router_contact.hpp>
|
||||
#include <llarp/net/net_int.hpp>
|
||||
#include <llarp/util/time.hpp>
|
||||
|
||||
namespace
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <test_util.hpp>
|
||||
#include "test_util.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#ifndef TEST_UTIL_HPP
|
||||
#define TEST_UTIL_HPP
|
||||
|
||||
#include <util/fs.hpp>
|
||||
#include <util/types.hpp>
|
||||
|
||||
#include <llarp/util/fs.hpp>
|
||||
#include <llarp/util/types.hpp>
|
||||
#include <bitset>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <util/meta/memfn.hpp>
|
||||
#include <llarp/util/meta/memfn.hpp>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <util/aligned.hpp>
|
||||
#include <llarp/util/aligned.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <util/bencode.h>
|
||||
#include <util/bencode.hpp>
|
||||
#include <llarp/util/bencode.h>
|
||||
#include <llarp/util/bencode.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <util/bits.hpp>
|
||||
#include <llarp/util/bits.hpp>
|
||||
|
||||
using namespace llarp::bits;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <util/decaying_hashset.hpp>
|
||||
#include <router_id.hpp>
|
||||
#include <llarp/util/decaying_hashset.hpp>
|
||||
#include <llarp/router_id.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
TEST_CASE("DecayingHashSet test decay static time", "[decaying-hashset]")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <catch2/catch.hpp>
|
||||
#include <util/logging.hpp>
|
||||
#include <config/config.hpp>
|
||||
#include <llarp/util/logging.hpp>
|
||||
#include <llarp/config/config.hpp>
|
||||
#include <oxen/log/level.hpp>
|
||||
|
||||
using TestString = std::string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <util/str.hpp>
|
||||
#include <llarp/util/str.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <util/thread/queue.hpp>
|
||||
#include <util/thread/threading.hpp>
|
||||
#include <util/thread/barrier.hpp>
|
||||
#include <llarp/util/thread/queue.hpp>
|
||||
#include <llarp/util/thread/threading.hpp>
|
||||
#include <llarp/util/thread/barrier.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <condition_variable>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <util/thread/queue_manager.hpp>
|
||||
#include <llarp/util/thread/queue_manager.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
|
Loading…
Reference in New Issue