Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Wire Protocol Overhaul, Message Handling Refactor #2204

Merged
merged 32 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a921575
mein gott
dr7ana Aug 29, 2023
11e54f6
More message refactoring
dr7ana Aug 31, 2023
511c20c
Message handling methods
dr7ana Sep 13, 2023
0b6506a
oxen-libquic version bump
dr7ana Sep 13, 2023
81aa044
kitware CI deps
dr7ana Sep 13, 2023
7ce517b
oxen-libquic update; no leak warn deprecated
dr7ana Sep 13, 2023
821cbea
warnings_as_errors fixes
dr7ana Sep 13, 2023
7f8207d
Nuked superfluous interface classes
dr7ana Sep 13, 2023
a4272c4
Added span backport
dr7ana Sep 14, 2023
d1b7eee
Zlib version bump 1.2.13 -> 1.3
dr7ana Sep 14, 2023
fd527d6
Carving through llarp/link
dr7ana Sep 14, 2023
ffb90e8
libquic bump
dr7ana Sep 14, 2023
aaf688c
Deleted a lot
dr7ana Sep 15, 2023
bfa9629
More carving + libquic bump
dr7ana Sep 18, 2023
a3e6cec
Address type migration + libquic bump
dr7ana Sep 19, 2023
d0c3837
libquic bparser merged
dr7ana Sep 21, 2023
ae31909
libquic bump
dr7ana Sep 26, 2023
d9ead7d
crypto and message encoding
dr7ana Sep 27, 2023
ad007ff
libquic/oxen-mq/oxenc version bumps
dr7ana Sep 29, 2023
1a9f977
Message method implementation continued
dr7ana Sep 29, 2023
206bd0b
wawaweewa
dr7ana Oct 3, 2023
f35f7fe
refactor path build message construction, no more async nonsense
tewinget Oct 4, 2023
4ed6a01
following up before Tom meeting
dr7ana Oct 4, 2023
65bd224
Exit endpoints implemented
dr7ana Oct 6, 2023
bd81357
Path message transmission
dr7ana Oct 10, 2023
2cc02d7
handle path build requests, generate responses
tewinget Oct 11, 2023
c8dae87
Path routing partially implementing
dr7ana Oct 11, 2023
5ccec24
callsafe
dr7ana Oct 12, 2023
577f5e6
De-mutexing
dr7ana Oct 12, 2023
a6f901a
RIP everything
dr7ana Oct 12, 2023
6b1e3fb
Touched up path build message handling
dr7ana Oct 16, 2023
e4315cd
More message handling underway
dr7ana Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 41 additions & 10 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local default_deps_base = [
'libsqlite3-dev',
'libcurl4-openssl-dev',
'libzmq3-dev',
'libgnutls28-dev',
'make',
];
local default_deps_nocxx = ['libsodium-dev'] + default_deps_base; // libsodium-dev needs to be >= 1.0.18
Expand All @@ -30,11 +31,19 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/

local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';

local kitware_repo(distro) = [
'eatmydata ' + apt_get_quiet + ' install -y curl ca-certificates',
'curl -sSL https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - >/usr/share/keyrings/kitware-archive-keyring.gpg',
'echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ' + distro + ' main" >/etc/apt/sources.list.d/kitware.list',
'eatmydata ' + apt_get_quiet + ' update',
];

// Regular build on a debian-like system:
local debian_pipeline(name,
image,
arch='amd64',
deps=default_deps,
extra_setup=[],
build_type='Release',
lto=false,
werror=true,
Expand Down Expand Up @@ -70,13 +79,14 @@ local debian_pipeline(name,
'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
'eatmydata ' + apt_get_quiet + ' update',
] else []
) + [
) + extra_setup
+ [
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y gdb cmake git pkg-config ccache ' + std.join(' ', deps),
'mkdir build',
'cd build',
'cmake .. -DWITH_SETCAP=OFF -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE=' + build_type + ' ' +
(if build_type == 'Debug' then ' -DWARN_DEPRECATED=OFF ' else '') +
'-DWARN_DEPRECATED=OFF ' +
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
'-DWITH_LTO=' + (if lto then 'ON ' else 'OFF ') +
'-DWITH_TESTS=' + (if tests then 'ON ' else 'OFF ') +
Expand All @@ -90,6 +100,24 @@ local debian_pipeline(name,
},
],
};
local local_gnutls(jobs=6, prefix='/usr/local') = [
apt_get_quiet + ' install -y curl ca-certificates',
'curl -sSL https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz | tar xfz -',
'curl -sSL https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.0.tar.xz | tar xfJ -',
'export CC="ccache gcc"',
'export PKG_CONFIG_PATH=' + prefix + '/lib/pkgconfig:' + prefix + '/lib64/pkgconfig',
'export LD_LIBRARY_PATH=' + prefix + '/lib:' + prefix + '/lib64',
'cd nettle-3.9.1',
'./configure --prefix=' + prefix,
'make -j' + jobs,
'make install',
'cd ..',
'cd gnutls-3.8.0',
'./configure --prefix=' + prefix + ' --with-included-libtasn1 --with-included-unistring --without-p11-kit --disable-libdane --disable-cxx --without-tpm --without-tpm2',
'make -j' + jobs,
'make install',
'cd ..',
];
local apk_builder(name, image, extra_cmds=[], allow_fail=false, jobs=6) = {
kind: 'pipeline',
type: 'docker',
Expand Down Expand Up @@ -301,7 +329,7 @@ local mac_builder(name,
'ulimit -n 1024', // because macos sets ulimit to 256 for some reason yeah idk
'./contrib/mac-configure.sh ' +
ci_dep_mirror(local_mirror) +
(if build_type == 'Debug' then ' -DWARN_DEPRECATED=OFF ' else '') +
'-DWARN_DEPRECATED=OFF ' +
codesign,
'cd build-mac',
// We can't use the 'package' target here because making a .dmg requires an active logged in
Expand Down Expand Up @@ -351,28 +379,29 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
'echo "Building on ${DRONE_STAGE_MACHINE}"',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-14 jsonnet',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-15 jsonnet',
'./contrib/ci/drone-format-verify.sh',
],
}],
},
// documentation builder
docs_pipeline('Documentation',
docker_base + 'docbuilder',
extra_cmds=['UPLOAD_OS=docs ./contrib/ci/drone-static-upload.sh']),
//docs_pipeline('Documentation',
// docker_base + 'docbuilder',
// extra_cmds=['UPLOAD_OS=docs ./contrib/ci/drone-static-upload.sh']),

// Various debian builds
debian_pipeline('Debian sid (amd64)', docker_base + 'debian-sid'),
debian_pipeline('Debian sid/Debug (amd64)', docker_base + 'debian-sid', build_type='Debug'),
clang(13),
full_llvm(13),
clang(16),
full_llvm(16),
debian_pipeline('Debian stable (i386)', docker_base + 'debian-stable/i386'),
debian_pipeline('Debian buster (amd64)', docker_base + 'debian-buster', cmake_extra='-DDOWNLOAD_SODIUM=ON'),
debian_pipeline('Debian buster (amd64)', docker_base + 'debian-buster', extra_setup=kitware_repo('bionic') + local_gnutls(), cmake_extra='-DDOWNLOAD_SODIUM=ON'),
debian_pipeline('Ubuntu latest (amd64)', docker_base + 'ubuntu-rolling'),
debian_pipeline('Ubuntu LTS (amd64)', docker_base + 'ubuntu-lts'),
debian_pipeline('Ubuntu bionic (amd64)',
docker_base + 'ubuntu-bionic',
deps=['g++-8'] + default_deps_nocxx,
extra_setup=kitware_repo('bionic') + local_gnutls(),
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8',
oxen_repo=true),

Expand Down Expand Up @@ -403,6 +432,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
debian_pipeline('Static (bionic amd64)',
docker_base + 'ubuntu-bionic',
deps=['g++-8', 'python3-dev', 'automake', 'libtool'],
extra_setup=kitware_repo('bionic'),
lto=true,
tests=false,
oxen_repo=true,
Expand All @@ -420,6 +450,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
docker_base + 'debian-buster/arm32v7',
arch='arm64',
deps=['g++', 'python3-dev', 'automake', 'libtool'],
extra_setup=kitware_repo('bionic'),
cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
'-DCMAKE_CXX_FLAGS="-march=armv7-a+fp -Wno-psabi" -DCMAKE_C_FLAGS="-march=armv7-a+fp" ' +
'-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF',
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@
[submodule "external/oxen-libquic"]
path = external/oxen-libquic
url = https://github.com/oxen-io/oxen-libquic.git
[submodule "external/span-lite"]
path = external/span-lite
url = https://github.com/martinmoene/span-lite.git
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
add_definitions(-DLOKINET_DEBUG)
endif()

option(WARN_DEPRECATED "show deprecation warnings" ${debug})
option(WARN_DEPRECATED "show deprecation warnings" OFF)

include(CheckCXXSourceCompiles)
include(CheckLibraryExists)
Expand Down Expand Up @@ -187,11 +187,7 @@ set(warning_flags -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-function -Werro
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND warning_flags -Wno-unknown-warning-option)
endif()
if(WARN_DEPRECATED)
list(APPEND warning_flags -Wdeprecated-declarations)
else()
list(APPEND warning_flags -Wno-deprecated-declarations)
endif()
list(APPEND warning_flags -Wno-deprecated-declarations)

# If we blindly add these directly as compile_options then they get passed to swiftc on Apple and
# break, so we use a generate expression to set them only for C++/C/ObjC
Expand Down
4 changes: 2 additions & 2 deletions cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ set(LIBUV_SOURCE libuv-v${LIBUV_VERSION}.tar.gz)
set(LIBUV_HASH SHA512=91197ff9303112567bbb915bbb88058050e2ad1c048815a3b57c054635d5dc7df458b956089d785475290132236cb0edcfae830f5d749de29a9a3213eeaf0b20
CACHE STRING "libuv source hash")

set(ZLIB_VERSION 1.2.13 CACHE STRING "zlib version")
set(ZLIB_VERSION 1.3 CACHE STRING "zlib version")
set(ZLIB_MIRROR ${LOCAL_MIRROR} https://zlib.net
CACHE STRING "zlib mirror(s)")
set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.xz)
set(ZLIB_HASH SHA256=d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98
set(ZLIB_HASH SHA256=8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7
CACHE STRING "zlib source hash")

set(CURL_VERSION 7.86.0 CACHE STRING "curl version")
Expand Down
4 changes: 2 additions & 2 deletions daemon/lokinet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ namespace
{
auto deadlock_cat = llarp::log::Cat("deadlock");
for (const auto& wtf :
{"you have been visited by the mascott of the deadlocked router.",
{"you have been visited by the mascot of the deadlocked router.",
"⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠄⠄⠄⠄",
"⠄⠄⠄⠄⠄⢀⣀⣀⡀⠄⠄⠄⡠⢲⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠄⠄",
"⠄⠄⠄⠔⣈⣀⠄⢔⡒⠳⡴⠊⠄⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⣿⣿⣧⠄⠄",
Expand Down Expand Up @@ -674,4 +674,4 @@ main(int argc, char* argv[])
return 1;
}
#endif
}
}
23 changes: 7 additions & 16 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ if(SUBMODULE_CHECK)
endfunction ()

message(STATUS "Checking submodules")
check_submodule(CLI11)
check_submodule(cpr)
check_submodule(nlohmann)
# check_submodule(ghc-filesystem)
# check_submodule(oxen-logging fmt spdlog)
check_submodule(oxen-libquic)
check_submodule(oxen-mq)
check_submodule(pybind11)
check_submodule(span-lite)
check_submodule(sqlite_orm)
check_submodule(oxen-mq)
check_submodule(uvw)
check_submodule(cpr)
check_submodule(oxen-libquic)
check_submodule(CLI11)
endif()
endif()

Expand Down Expand Up @@ -65,12 +64,6 @@ set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install OFF CACHE INTERNAL "")
system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann)

#if (STATIC OR FORCE_SPDLOG_SUBMODULE OR FORCE_FMT_SUBMODULE)
# set(OXEN_LOGGING_FORCE_SUBMODULES ON CACHE INTERNAL "")
#endif()
#set(OXEN_LOGGING_SOURCE_ROOT "${PROJECT_SOURCE_DIR}" CACHE INTERNAL "")
#add_subdirectory(oxen-logging)

if(WITH_HIVE)
add_subdirectory(pybind11 EXCLUDE_FROM_ALL)
endif()
Expand All @@ -92,12 +85,10 @@ add_library(uvw INTERFACE)
target_include_directories(uvw INTERFACE uvw/src)
target_link_libraries(uvw INTERFACE libuv)

# ngtcp2 needs some massaging to build nicely:
#include(ngtcp2_lib)
#add_ngtcp2_lib()

add_subdirectory(oxen-libquic)

add_subdirectory(span-lite)

# cpr configuration. Ideally we'd just do this via add_subdirectory, but cpr's cmake requires
# 3.15+, and we target lower than that (and this is fairly simple to build).
if(WITH_BOOTSTRAP)
Expand Down
2 changes: 1 addition & 1 deletion external/oxen-mq
1 change: 1 addition & 0 deletions external/span-lite
Submodule span-lite added at bc08bf
6 changes: 3 additions & 3 deletions include/llarp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace llarp
struct Config;
struct Crypto;
struct CryptoManager;
struct AbstractRouter;
struct Router;
class NodeDB;

namespace thread
Expand All @@ -40,7 +40,7 @@ namespace llarp
{
std::shared_ptr<Crypto> crypto = nullptr;
std::shared_ptr<CryptoManager> cryptoManager = nullptr;
std::shared_ptr<AbstractRouter> router = nullptr;
std::shared_ptr<Router> router = nullptr;
std::shared_ptr<EventLoop> loop = nullptr;
std::shared_ptr<NodeDB> nodedb = nullptr;

Expand Down Expand Up @@ -89,7 +89,7 @@ namespace llarp

/// Creates a router. Can be overridden to allow a different class of router
/// to be created instead. Defaults to llarp::Router.
virtual std::shared_ptr<AbstractRouter>
virtual std::shared_ptr<Router>
makeRouter(const std::shared_ptr<EventLoop>& loop);

/// create the nodedb given our current configs
Expand Down
4 changes: 2 additions & 2 deletions jni/lokinet_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "lokinet_jni_common.hpp"
#include <llarp.hpp>
#include <llarp/config/config.hpp>
#include <llarp/router/abstractrouter.hpp>
#include <llarp/router/router.hpp>

extern "C"
{
Expand Down Expand Up @@ -85,7 +85,7 @@ extern "C"
Java_network_loki_lokinet_LokinetDaemon_GetUDPSocket(JNIEnv* env, jobject self)
{
if (auto ptr = GetImpl<llarp::Context>(env, self); ptr and ptr->router)
return ptr->router->OutboundUDPSocket();
return ptr->router->outbound_socket();
return -1;
}

Expand Down