diff --git a/.drone.jsonnet b/.drone.jsonnet index 0c41502a6..05f110acb 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -41,6 +41,6 @@ local rpm_pipeline(image, buildarch='amd64', rpmarch='x86_64', jobs=6) = { }; [ - rpm_pipeline(distro_docker), - rpm_pipeline("arm64v8/" + distro_docker, buildarch='arm64', rpmarch="aarch64", jobs=4) + rpm_pipeline(distro_docker), + rpm_pipeline("arm64v8/" + distro_docker, buildarch='arm64', rpmarch="aarch64", jobs=4) ] diff --git a/.gitattributes b/.gitattributes index 9a5991388..40b418198 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ external/date/test export-ignore external/nlohmann/doc export-ignore external/nlohmann/test export-ignore external/nlohmann/benchmarks/data export-ignore +*.signed binary diff --git a/CMakeLists.txt b/CMakeLists.txt index 3077b523d..7ab561a0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ endif() project(lokinet - VERSION 0.9.6 + VERSION 0.9.7 DESCRIPTION "lokinet - IP packet onion router" LANGUAGES ${LANGS}) @@ -51,7 +51,7 @@ option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF) option(BUILD_LIBLOKINET "build liblokinet.so" ON) option(SHADOW "use shadow testing framework. linux only" OFF) option(XSAN "use sanitiser, if your system has it (requires -DCMAKE_BUILD_TYPE=Debug)" OFF) -option(WITH_JEMALLOC "use jemalloc as allocator" OFF) +option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON) option(TESTNET "testnet build" OFF) option(WITH_COVERAGE "generate coverage data" OFF) option(USE_SHELLHOOKS "enable shell hooks on compile time (dangerous)" OFF) @@ -299,7 +299,6 @@ endif() add_subdirectory(external) include_directories(SYSTEM external/sqlite_orm/include) -option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON) if(USE_JEMALLOC AND NOT STATIC_LINK) pkg_check_modules(JEMALLOC jemalloc IMPORTED_TARGET) if(JEMALLOC_FOUND) diff --git a/SPECS/lokinet.spec b/SPECS/lokinet.spec index 63d7c70be..149e5ecd3 100644 --- a/SPECS/lokinet.spec +++ b/SPECS/lokinet.spec @@ -1,5 +1,5 @@ Name: lokinet -Version: 0.9.6 +Version: 0.9.7 Release: 1%{?dist} Summary: Lokinet anonymous, decentralized overlay network @@ -156,6 +156,9 @@ fi %systemd_postun lokinet.service %changelog +* Wed Oct 20 2021 Technical Tumbleweed - 0.9.7-1 +- bump version + * Thu Sep 09 2021 Jason Rhinelander - 0.9.6-1 - 0.9.6 release. - bundle bootstrap.signed instead of downloading @@ -176,8 +179,8 @@ fi - Updated for rpm.oxen.io packaging - Split into lokinet/lokinet-bin/lokinet-monitor packages -* Thu Jul 22 2021 Technical Tumbleweed (necro_nemesis@hotmail.com) Lokinet 0.9.5 +* Thu Jul 22 2021 Technical Tumbleweed Lokinet 0.9.5 - Build with systemd-resolved and binary lokinet-bootstrap -* Sun Mar 07 2021 Technical Tumbleweed (necro_nemesis@hotmail.com) Lokinet 0.8.2 +* Sun Mar 07 2021 Technical Tumbleweed Lokinet 0.8.2 - First Lokinet RPM diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index adf00bc0f..6b000a8ef 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -388,6 +388,7 @@ foreach(curl_arch ${curl_arches}) --disable-progress-meter --without-brotli --with-zlib=${DEPS_DESTDIR} ${curl_ssl_opts} --without-libmetalink --without-librtmp --disable-versioned-symbols --enable-hidden-symbols --without-zsh-functions-dir --without-fish-functions-dir + --without-nghttp3 --without-zstd "CC=${deps_cc}" "CFLAGS=${deps_noarch_CFLAGS}${cflags_extra}" ${curl_extra} BUILD_COMMAND true INSTALL_COMMAND ${_make} -C lib install && ${_make} -C include install diff --git a/cmake/add_log_tag.cmake b/cmake/add_log_tag.cmake index 1bde3029d..b86ab5717 100644 --- a/cmake/add_log_tag.cmake +++ b/cmake/add_log_tag.cmake @@ -2,7 +2,6 @@ function(add_log_tag target) get_target_property(TARGET_SRCS ${target} SOURCES) foreach(F ${TARGET_SRCS}) get_filename_component(fpath "${F}" ABSOLUTE) - string(REPLACE "${PROJECT_SOURCE_DIR}/" "" logtag "${fpath}") - set_property(SOURCE ${F} APPEND PROPERTY COMPILE_DEFINITIONS LOG_TAG=\"${logtag}\") + set_property(SOURCE ${F} APPEND PROPERTY COMPILE_DEFINITIONS SOURCE_ROOT=\"${PROJECT_SOURCE_DIR}\") endforeach() endfunction() diff --git a/cmake/libatomic.cmake b/cmake/libatomic.cmake index d29155913..3a8234e45 100644 --- a/cmake/libatomic.cmake +++ b/cmake/libatomic.cmake @@ -1,49 +1,49 @@ -function(check_working_cxx_atomics64 varname) - set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - if (EMBEDDED_CFG) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m32 -march=i486") - elseif(MSVC OR MSVC_VERSION) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -arch:IA32 -std:c++14") - else() - # CMAKE_CXX_STANDARD does not propagate to cmake compile tests - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++14") - endif() - check_cxx_source_compiles(" -#include -#include -std::atomic x (0); -int main() { - uint64_t i = x.load(std::memory_order_relaxed); - return 0; -} -" ${varname}) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) -endfunction() - -function(link_libatomic) - check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) - - if(HAVE_CXX_ATOMICS64_WITHOUT_LIB) - message(STATUS "Have working 64bit atomics") - return() - endif() - - if (NOT MSVC AND NOT MSVC_VERSION) - check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) - if (HAVE_CXX_LIBATOMICS64) - message(STATUS "Have 64bit atomics via library") - list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") - check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) - if (HAVE_CXX_ATOMICS64_WITH_LIB) - message(STATUS "Can link with libatomic") - link_libraries(-latomic) - return() - endif() - endif() - endif() - if (MSVC OR MSVC_VERSION) - message(FATAL_ERROR "Host compiler must support 64-bit std::atomic! (What does MSVC do to inline atomics?)") - else() - message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") - endif() -endfunction() \ No newline at end of file +function(check_working_cxx_atomics64 varname) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if (EMBEDDED_CFG) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m32 -march=i486") + elseif(MSVC OR MSVC_VERSION) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -arch:IA32 -std:c++14") + else() + # CMAKE_CXX_STANDARD does not propagate to cmake compile tests + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++14") + endif() + check_cxx_source_compiles(" +#include +#include +std::atomic x (0); +int main() { + uint64_t i = x.load(std::memory_order_relaxed); + return 0; +} +" ${varname}) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endfunction() + +function(link_libatomic) + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) + + if(HAVE_CXX_ATOMICS64_WITHOUT_LIB) + message(STATUS "Have working 64bit atomics") + return() + endif() + + if (NOT MSVC AND NOT MSVC_VERSION) + check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) + if (HAVE_CXX_LIBATOMICS64) + message(STATUS "Have 64bit atomics via library") + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") + check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) + if (HAVE_CXX_ATOMICS64_WITH_LIB) + message(STATUS "Can link with libatomic") + link_libraries(-latomic) + return() + endif() + endif() + endif() + if (MSVC OR MSVC_VERSION) + message(FATAL_ERROR "Host compiler must support 64-bit std::atomic! (What does MSVC do to inline atomics?)") + else() + message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!") + endif() +endfunction() diff --git a/cmake/ngtcp2_lib.cmake b/cmake/ngtcp2_lib.cmake new file mode 100644 index 000000000..c6d06a42a --- /dev/null +++ b/cmake/ngtcp2_lib.cmake @@ -0,0 +1,52 @@ +# ngtcp2's top-level CMakeLists.txt loads a bunch of crap we don't want (examples, a conflicting +# 'check' target, etc.); instead we directly include it's lib subdirectory to build just the +# library, but we have to set up a couple things to make that work: +function(add_ngtcp2_lib) + file(STRINGS ngtcp2/CMakeLists.txt ngtcp2_project_line REGEX "^project\\(ngtcp2 ") + if(NOT ngtcp2_project_line MATCHES "^project\\(ngtcp2 VERSION ([0-9]+)\\.([0-9]+)\\.([0-9]+)\\)$") + message(FATAL_ERROR "Unable to extract ngtcp2 version from ngtcp2/CMakeLists.txt (found '${ngtcp2_project_line}')") + endif() + + set(PACKAGE_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}") + include(ngtcp2/cmake/Version.cmake) + HexVersion(PACKAGE_VERSION_NUM ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${CMAKE_MATCH_3}) + configure_file("ngtcp2/lib/includes/ngtcp2/version.h.in" "ngtcp2/lib/includes/ngtcp2/version.h" @ONLY) + + set(BUILD_SHARED_LIBS OFF) + + # Checks for header files. + include(CheckIncludeFile) + check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) + check_include_file("netinet/in.h" HAVE_NETINET_IN_H) + check_include_file("stddef.h" HAVE_STDDEF_H) + check_include_file("stdint.h" HAVE_STDINT_H) + check_include_file("stdlib.h" HAVE_STDLIB_H) + check_include_file("string.h" HAVE_STRING_H) + check_include_file("unistd.h" HAVE_UNISTD_H) + check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H) + check_include_file("endian.h" HAVE_ENDIAN_H) + check_include_file("byteswap.h" HAVE_BYTESWAP_H) + + include(CheckTypeSize) + check_type_size("ssize_t" SIZEOF_SSIZE_T) + if(SIZEOF_SSIZE_T STREQUAL "") + set(ssize_t ptrdiff_t) + endif() + + include(CheckSymbolExists) + if(HAVE_ENDIAN_H) + check_symbol_exists(be64toh "endian.h" HAVE_BE64TOH) + endif() + if(NOT HAVE_BE64TO AND HAVE_SYS_ENDIAN_H) + check_symbol_exists(be64toh "sys/endian.h" HAVE_BE64TOH) + endif() + + check_symbol_exists(bswap_64 "byteswap.h" HAVE_BSWAP_64) + + configure_file(ngtcp2/cmakeconfig.h.in ngtcp2/config.h) + include_directories("${CMAKE_CURRENT_BINARY_DIR}/ngtcp2") # for config.h + + add_subdirectory(ngtcp2/lib EXCLUDE_FROM_ALL) + + target_compile_definitions(ngtcp2 PRIVATE -DHAVE_CONFIG_H -D_GNU_SOURCE) +endfunction() diff --git a/cmake/unix.cmake b/cmake/unix.cmake index c151fcdd9..3adbc844e 100644 --- a/cmake/unix.cmake +++ b/cmake/unix.cmake @@ -7,15 +7,6 @@ endif() include(CheckCXXSourceCompiles) include(CheckLibraryExists) -if(WITH_JEMALLOC) - find_package(Jemalloc REQUIRED) - if(NOT JEMALLOC_FOUND) - message(FATAL_ERROR "did not find jemalloc") - endif() - add_definitions(-DUSE_JEMALLOC) - message(STATUS "using jemalloc") -endif() - add_definitions(-DUNIX) add_definitions(-DPOSIX) diff --git a/cmake/win32_installer_deps.cmake b/cmake/win32_installer_deps.cmake index f928a5e60..95ea1aedf 100644 --- a/cmake/win32_installer_deps.cmake +++ b/cmake/win32_installer_deps.cmake @@ -5,17 +5,12 @@ endif() set(TUNTAP_URL "https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe") set(TUNTAP_EXE "${CMAKE_BINARY_DIR}/tuntap-install.exe") -set(BOOTSTRAP_URL "https://seed.lokinet.org/lokinet.signed") -set(BOOTSTRAP_FILE "${CMAKE_BINARY_DIR}/bootstrap.signed") +set(BOOTSTRAP_FILE "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed") file(DOWNLOAD ${TUNTAP_URL} ${TUNTAP_EXE}) -file(DOWNLOAD - ${BOOTSTRAP_URL} - ${BOOTSTRAP_FILE}) - file(DOWNLOAD ${GUI_ZIP_URL} ${CMAKE_BINARY_DIR}/lokinet-gui.zip @@ -26,7 +21,7 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${CMAKE_BINARY_DIR}/lokinet-g install(DIRECTORY ${CMAKE_BINARY_DIR}/gui DESTINATION share COMPONENT gui) install(PROGRAMS ${TUNTAP_EXE} DESTINATION bin COMPONENT tuntap) -install(FILES ${BOOTSTRAP_FILE} DESTINATION share COMPONENT lokinet) +install(FILES ${BOOTSTRAP_FILE} DESTINATION share COMPONENT lokinet RENAME bootstrap.signed) set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/win32-setup/lokinet.ico") diff --git a/contrib/bootstrap/mainnet.signed b/contrib/bootstrap/mainnet.signed new file mode 100644 index 000000000..4dabc8e93 Binary files /dev/null and b/contrib/bootstrap/mainnet.signed differ diff --git a/contrib/bootstrap/testnet.signed b/contrib/bootstrap/testnet.signed new file mode 100644 index 000000000..9ad107115 --- /dev/null +++ b/contrib/bootstrap/testnet.signed @@ -0,0 +1 @@ +d1:ald1:ci2e1:d3:iwp1:e32:9xsXl%<,s؛_1:i21:::ffff:144.76.164.2021:pi1666e1:vi0eee1:i5:gamma1:k32:m=oZ1mc%SĹ1:p32:!Ez: /0ڄ ݪNB1:rli0ei0ei8ei3ee1:ui1614788310454e1:vi0e1:xle1:z64:uGD=x{51`߀Ew m)q2g )TP1e \ No newline at end of file diff --git a/contrib/ci/docker/00-debian-bullseye-base.dockerfile b/contrib/ci/docker/00-debian-bullseye-base.dockerfile new file mode 100644 index 000000000..4d691d074 --- /dev/null +++ b/contrib/ci/docker/00-debian-bullseye-base.dockerfile @@ -0,0 +1,6 @@ +ARG ARCH=amd64 +FROM ${ARCH}/debian:bullseye +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y diff --git a/contrib/ci/docker/00-debian-buster-base.dockerfile b/contrib/ci/docker/00-debian-buster-base.dockerfile new file mode 100644 index 000000000..43c6ca4be --- /dev/null +++ b/contrib/ci/docker/00-debian-buster-base.dockerfile @@ -0,0 +1,6 @@ +ARG ARCH=amd64 +FROM ${ARCH}/debian:buster +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y diff --git a/contrib/ci/docker/00-debian-sid-base.dockerfile b/contrib/ci/docker/00-debian-sid-base.dockerfile new file mode 100644 index 000000000..9293b6e9e --- /dev/null +++ b/contrib/ci/docker/00-debian-sid-base.dockerfile @@ -0,0 +1,6 @@ +ARG ARCH=amd64 +FROM ${ARCH}/debian:sid +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y diff --git a/contrib/ci/docker/00-debian-stable-base.dockerfile b/contrib/ci/docker/00-debian-stable-base.dockerfile new file mode 100644 index 000000000..62eedbd67 --- /dev/null +++ b/contrib/ci/docker/00-debian-stable-base.dockerfile @@ -0,0 +1,6 @@ +ARG ARCH=amd64 +FROM ${ARCH}/debian:stable +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y diff --git a/contrib/ci/docker/00-debian-testing-base.dockerfile b/contrib/ci/docker/00-debian-testing-base.dockerfile new file mode 100644 index 000000000..714e24542 --- /dev/null +++ b/contrib/ci/docker/00-debian-testing-base.dockerfile @@ -0,0 +1,6 @@ +ARG ARCH=amd64 +FROM ${ARCH}/debian:testing +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y diff --git a/contrib/ci/docker/10-debian-bullseye.dockerfile b/contrib/ci/docker/10-debian-bullseye.dockerfile new file mode 100644 index 000000000..d92ea1b97 --- /dev/null +++ b/contrib/ci/docker/10-debian-bullseye.dockerfile @@ -0,0 +1,39 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-bullseye-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-debian-buster.dockerfile b/contrib/ci/docker/10-debian-buster.dockerfile new file mode 100644 index 000000000..f77b9deda --- /dev/null +++ b/contrib/ci/docker/10-debian-buster.dockerfile @@ -0,0 +1,40 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-buster-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev \ + xz-utils diff --git a/contrib/ci/docker/10-debian-sid.dockerfile b/contrib/ci/docker/10-debian-sid.dockerfile new file mode 100644 index 000000000..7bb2f8c3c --- /dev/null +++ b/contrib/ci/docker/10-debian-sid.dockerfile @@ -0,0 +1,39 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-sid-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-debian-stable.dockerfile b/contrib/ci/docker/10-debian-stable.dockerfile new file mode 100644 index 000000000..cd50a4651 --- /dev/null +++ b/contrib/ci/docker/10-debian-stable.dockerfile @@ -0,0 +1,39 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-stable-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-ubuntu-bionic.dockerfile b/contrib/ci/docker/10-ubuntu-bionic.dockerfile new file mode 100644 index 000000000..767d2f3d1 --- /dev/null +++ b/contrib/ci/docker/10-ubuntu-bionic.dockerfile @@ -0,0 +1,31 @@ +ARG ARCH=amd64 +FROM ${ARCH}/ubuntu:bionic +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q --no-install-recommends install -y \ + autoconf \ + automake \ + ccache \ + cmake \ + eatmydata \ + file \ + g++-8 \ + gdb \ + git \ + gperf \ + libjemalloc-dev \ + libpgm-dev \ + libtool \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + ninja-build \ + openssh-client \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev \ + && mkdir -p /usr/lib/x86_64-linux-gnu/pgm-5.2/include diff --git a/contrib/ci/docker/10-ubuntu-focal.dockerfile b/contrib/ci/docker/10-ubuntu-focal.dockerfile new file mode 100644 index 000000000..a9d38599e --- /dev/null +++ b/contrib/ci/docker/10-ubuntu-focal.dockerfile @@ -0,0 +1,42 @@ +ARG ARCH=amd64 +FROM ${ARCH}/ubuntu:focal +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-ubuntu-impish.dockerfile b/contrib/ci/docker/10-ubuntu-impish.dockerfile new file mode 100644 index 000000000..0e7c354e0 --- /dev/null +++ b/contrib/ci/docker/10-ubuntu-impish.dockerfile @@ -0,0 +1,42 @@ +ARG ARCH=amd64 +FROM ${ARCH}/ubuntu:impish +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-ubuntu-lts.dockerfile b/contrib/ci/docker/10-ubuntu-lts.dockerfile new file mode 100644 index 000000000..3b2dfc413 --- /dev/null +++ b/contrib/ci/docker/10-ubuntu-lts.dockerfile @@ -0,0 +1,42 @@ +ARG ARCH=amd64 +FROM ${ARCH}/ubuntu:latest +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/10-ubuntu-rolling.dockerfile b/contrib/ci/docker/10-ubuntu-rolling.dockerfile new file mode 100644 index 000000000..989dc0a5c --- /dev/null +++ b/contrib/ci/docker/10-ubuntu-rolling.dockerfile @@ -0,0 +1,42 @@ +ARG ARCH=amd64 +FROM ${ARCH}/ubuntu:rolling +RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + automake \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + libboost-program-options-dev \ + libboost-serialization-dev \ + libboost-thread-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libgtest-dev \ + libhidapi-dev \ + libjemalloc-dev \ + libminiupnpc-dev \ + libreadline-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libsystemd-dev \ + libtool \ + libunbound-dev \ + libunwind8-dev \ + libusb-1.0.0-dev \ + libuv1-dev \ + libzmq3-dev \ + lsb-release \ + make \ + nettle-dev \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + python3-dev \ + qttools5-dev diff --git a/contrib/ci/docker/40-debian-bullseye-debhelper.dockerfile b/contrib/ci/docker/40-debian-bullseye-debhelper.dockerfile new file mode 100644 index 000000000..05236d48c --- /dev/null +++ b/contrib/ci/docker/40-debian-bullseye-debhelper.dockerfile @@ -0,0 +1,10 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-bullseye/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + ccache \ + debhelper \ + devscripts \ + equivs \ + git \ + git-buildpackage \ + python3-dev diff --git a/contrib/ci/docker/40-debian-sid-debhelper.dockerfile b/contrib/ci/docker/40-debian-sid-debhelper.dockerfile new file mode 100644 index 000000000..e05764508 --- /dev/null +++ b/contrib/ci/docker/40-debian-sid-debhelper.dockerfile @@ -0,0 +1,10 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-sid/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + ccache \ + debhelper \ + devscripts \ + equivs \ + git \ + git-buildpackage \ + python3-dev diff --git a/contrib/ci/docker/40-ubuntu-focal-debhelper.dockerfile b/contrib/ci/docker/40-ubuntu-focal-debhelper.dockerfile new file mode 100644 index 000000000..288179538 --- /dev/null +++ b/contrib/ci/docker/40-ubuntu-focal-debhelper.dockerfile @@ -0,0 +1,10 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-ubuntu-focal/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + ccache \ + debhelper \ + devscripts \ + equivs \ + git \ + git-buildpackage \ + python3-dev diff --git a/contrib/ci/docker/40-ubuntu-impish-debhelper.dockerfile b/contrib/ci/docker/40-ubuntu-impish-debhelper.dockerfile new file mode 100644 index 000000000..e73bb07ec --- /dev/null +++ b/contrib/ci/docker/40-ubuntu-impish-debhelper.dockerfile @@ -0,0 +1,10 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-ubuntu-impish/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \ + ccache \ + debhelper \ + devscripts \ + equivs \ + git \ + git-buildpackage \ + python3-dev diff --git a/contrib/ci/docker/50-android.dockerfile b/contrib/ci/docker/50-android.dockerfile new file mode 100644 index 000000000..04163fc63 --- /dev/null +++ b/contrib/ci/docker/50-android.dockerfile @@ -0,0 +1,23 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-testing-base/${ARCH} +RUN /bin/bash -c 'sed -i "s/main/main contrib/g" /etc/apt/sources.list' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + android-sdk \ + automake \ + ccache \ + cmake \ + curl \ + git \ + google-android-ndk-installer \ + libtool \ + make \ + openssh-client \ + patch \ + pkg-config \ + wget \ + xz-utils \ + zip \ + && git clone https://github.com/Shadowstyler/android-sdk-licenses.git /tmp/android-sdk-licenses \ + && cp -a /tmp/android-sdk-licenses/*-license /usr/lib/android-sdk/licenses \ + && rm -rf /tmp/android-sdk-licenses diff --git a/contrib/ci/docker/android.dockerfile b/contrib/ci/docker/android.dockerfile deleted file mode 100644 index 417735ae7..000000000 --- a/contrib/ci/docker/android.dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM debian:testing -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'sed -i "s/main/main contrib/g" /etc/apt/sources.list' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y android-sdk google-android-ndk-installer wget git pkg-config automake libtool cmake ccache curl zip' -RUN /bin/bash -c 'git clone https://github.com/Shadowstyler/android-sdk-licenses.git /tmp/android-sdk-licenses && cp -a /tmp/android-sdk-licenses/*-license /usr/lib/android-sdk/licenses && rm -rf /tmp/android-sdk-licenses' -RUN /bin/bash -c 'wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.2.2-stable.tar.xz -O /tmp/flutter.tar.xz && cd /opt && tar -xJvf /tmp/flutter.tar.xz && rm /tmp/flutter.tar.xz && ln -s /opt/flutter/bin/flutter /usr/local/bin/' -RUN /bin/bash -c 'flutter precache' \ No newline at end of file diff --git a/contrib/ci/docker/arm32v7/00-debian-buster-base.dockerfile b/contrib/ci/docker/arm32v7/00-debian-buster-base.dockerfile new file mode 120000 index 000000000..e4ab00108 --- /dev/null +++ b/contrib/ci/docker/arm32v7/00-debian-buster-base.dockerfile @@ -0,0 +1 @@ +../00-debian-buster-base.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm32v7/00-debian-stable-base.dockerfile b/contrib/ci/docker/arm32v7/00-debian-stable-base.dockerfile new file mode 120000 index 000000000..2d62f76d4 --- /dev/null +++ b/contrib/ci/docker/arm32v7/00-debian-stable-base.dockerfile @@ -0,0 +1 @@ +../00-debian-stable-base.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm32v7/10-debian-buster.dockerfile b/contrib/ci/docker/arm32v7/10-debian-buster.dockerfile new file mode 120000 index 000000000..592305776 --- /dev/null +++ b/contrib/ci/docker/arm32v7/10-debian-buster.dockerfile @@ -0,0 +1 @@ +../10-debian-buster.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm32v7/10-debian-stable.dockerfile b/contrib/ci/docker/arm32v7/10-debian-stable.dockerfile new file mode 120000 index 000000000..a10f6b3c5 --- /dev/null +++ b/contrib/ci/docker/arm32v7/10-debian-stable.dockerfile @@ -0,0 +1 @@ +../10-debian-stable.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm64v8/00-debian-sid-base.dockerfile b/contrib/ci/docker/arm64v8/00-debian-sid-base.dockerfile new file mode 120000 index 000000000..3fdec500d --- /dev/null +++ b/contrib/ci/docker/arm64v8/00-debian-sid-base.dockerfile @@ -0,0 +1 @@ +../00-debian-sid-base.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm64v8/10-debian-sid.dockerfile b/contrib/ci/docker/arm64v8/10-debian-sid.dockerfile new file mode 120000 index 000000000..baf7ccaad --- /dev/null +++ b/contrib/ci/docker/arm64v8/10-debian-sid.dockerfile @@ -0,0 +1 @@ +../10-debian-sid.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/arm64v8/40-debian-sid-debhelper.dockerfile b/contrib/ci/docker/arm64v8/40-debian-sid-debhelper.dockerfile new file mode 120000 index 000000000..e7f04dc7a --- /dev/null +++ b/contrib/ci/docker/arm64v8/40-debian-sid-debhelper.dockerfile @@ -0,0 +1 @@ +../40-debian-sid-debhelper.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/debian-sid-clang.dockerfile b/contrib/ci/docker/debian-sid-clang.dockerfile new file mode 100644 index 000000000..6d21df7fe --- /dev/null +++ b/contrib/ci/docker/debian-sid-clang.dockerfile @@ -0,0 +1,7 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-sid/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + clang-13 \ + libc++-13-dev \ + libc++abi-13-dev \ + lld-13 diff --git a/contrib/ci/docker/debian-sid.dockerfile b/contrib/ci/docker/debian-sid.dockerfile deleted file mode 100644 index 9d45c5251..000000000 --- a/contrib/ci/docker/debian-sid.dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM debian:sid -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata gdb cmake git ninja-build pkg-config ccache clang-11 libsodium-dev libsystemd-dev python3-dev libuv1-dev libunbound-dev nettle-dev libssl-dev libevent-dev libsqlite3-dev libboost-thread-dev libboost-serialization-dev libboost-program-options-dev libgtest-dev libminiupnpc-dev libunwind8-dev libreadline-dev libhidapi-dev libusb-1.0.0-dev qttools5-dev libcurl4-openssl-dev' diff --git a/contrib/ci/docker/debian-stable.dockerfile b/contrib/ci/docker/debian-stable.dockerfile deleted file mode 100644 index f5de1e581..000000000 --- a/contrib/ci/docker/debian-stable.dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM debian:stable -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata gdb cmake git ninja-build pkg-config ccache g++ libsodium-dev libsystemd-dev python3-dev libuv1-dev libunbound-dev nettle-dev libssl-dev libevent-dev libsqlite3-dev libboost-thread-dev libboost-serialization-dev libboost-program-options-dev libgtest-dev libminiupnpc-dev libunwind8-dev libreadline-dev libhidapi-dev libusb-1.0.0-dev qttools5-dev libcurl4-openssl-dev' diff --git a/contrib/ci/docker/debian-win32-cross.dockerfile b/contrib/ci/docker/debian-win32-cross.dockerfile index 60bd1ffdf..f2d852644 100644 --- a/contrib/ci/docker/debian-win32-cross.dockerfile +++ b/contrib/ci/docker/debian-win32-cross.dockerfile @@ -1,4 +1,24 @@ -FROM debian:testing -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata build-essential cmake git ninja-build pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip automake libtool autoconf make qttools5-dev file gperf patch openssh-client' -RUN /bin/bash -c 'update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix && update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix' +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-testing-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + autoconf \ + automake \ + build-essential \ + ccache \ + cmake \ + eatmydata \ + file \ + g++-mingw-w64-x86-64-posix \ + git \ + gperf \ + libtool \ + make \ + ninja-build \ + nsis \ + openssh-client \ + patch \ + pkg-config \ + qttools5-dev \ + zip \ + && update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \ + && update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix diff --git a/contrib/ci/docker/flutter.dockerfile b/contrib/ci/docker/flutter.dockerfile new file mode 100644 index 000000000..17b39a980 --- /dev/null +++ b/contrib/ci/docker/flutter.dockerfile @@ -0,0 +1,7 @@ +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-android/${ARCH} +RUN cd /opt \ + && curl https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.2.2-stable.tar.xz \ + | tar xJv \ + && ln -s /opt/flutter/bin/flutter /usr/local/bin/ \ + && flutter precache diff --git a/contrib/ci/docker/i386/00-debian-stable-base.dockerfile b/contrib/ci/docker/i386/00-debian-stable-base.dockerfile new file mode 120000 index 000000000..2d62f76d4 --- /dev/null +++ b/contrib/ci/docker/i386/00-debian-stable-base.dockerfile @@ -0,0 +1 @@ +../00-debian-stable-base.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/i386/10-debian-stable.dockerfile b/contrib/ci/docker/i386/10-debian-stable.dockerfile new file mode 120000 index 000000000..a10f6b3c5 --- /dev/null +++ b/contrib/ci/docker/i386/10-debian-stable.dockerfile @@ -0,0 +1 @@ +../10-debian-stable.dockerfile \ No newline at end of file diff --git a/contrib/ci/docker/lint.dockerfile b/contrib/ci/docker/lint.dockerfile index f247fd6a7..d9636827d 100644 --- a/contrib/ci/docker/lint.dockerfile +++ b/contrib/ci/docker/lint.dockerfile @@ -1,3 +1,7 @@ -FROM debian:sid -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata git clang-format-11' +ARG ARCH=amd64 +FROM registry.oxen.rocks/lokinet-ci-debian-sid-base/${ARCH} +RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + clang-format-11 \ + eatmydata \ + git \ + jsonnet diff --git a/contrib/ci/docker/nodejs.dockerfile b/contrib/ci/docker/nodejs.dockerfile index 059d16a6f..625251173 100644 --- a/contrib/ci/docker/nodejs.dockerfile +++ b/contrib/ci/docker/nodejs.dockerfile @@ -1,3 +1,17 @@ FROM node:14.16.1 RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q install -y eatmydata gdb cmake git ninja-build pkg-config ccache g++ wine' +RUN apt-get -o=Dpkg::Use-Pty=0 -q update \ + && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \ + && apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \ + ccache \ + cmake \ + eatmydata \ + g++ \ + gdb \ + git \ + make \ + ninja-build \ + openssh-client \ + patch \ + pkg-config \ + wine diff --git a/contrib/ci/docker/readme.md b/contrib/ci/docker/readme.md index 7b3cfbe87..5cd271f2d 100644 --- a/contrib/ci/docker/readme.md +++ b/contrib/ci/docker/readme.md @@ -1,8 +1,13 @@ ## drone-ci docker jizz -To rebuild all ci images and push them to a registry server do: +To rebuild all ci images and push them to the oxen registry server do: - $ docker login your.registry.here - $ ./rebuild-docker-images.sh your.registry.here *.dockerfile + $ docker login registry.oxen.rocks + $ ./rebuild-docker-images.sh -The docker images will be `your.registry.here/lokinet-ci-*`for each *.dockerfile in this directory +If you aren't part of the Oxen team, you'll likely need to set up your own registry and change +registry.oxen.rocks to your own domain name in order to do anything useful with this. + +The docker images will be `registry.oxen.rocks/lokinet-ci-*`for each \*.dockerfile in this +directory, with the leading numeric `NN-` removed, if present (so that you can ensure proper +ordering using two-digit numeric prefixes). diff --git a/contrib/ci/docker/rebuild-docker-images.sh b/contrib/ci/docker/rebuild-docker-images.sh index 959643cef..a0773a0b1 100755 --- a/contrib/ci/docker/rebuild-docker-images.sh +++ b/contrib/ci/docker/rebuild-docker-images.sh @@ -1,13 +1,44 @@ #!/bin/bash -# the registry server to use -registry=$1 +set -o errexit -test "x$registry" != "x" || exit 1 +trap 'echo -e "\n\n\n\e[31;1mAn error occurred!\e[1m\n\n"' ERR -for file in ${@:2} ; do - name="$(echo $file | cut -d'.' -f1)" - echo "rebuild $name" - docker build -f $file -t $registry/lokinet-ci-$name . - docker push $registry/lokinet-ci-$name +registry=registry.oxen.rocks + +if [[ $# -eq 0 ]]; then + files=(*.dockerfile i386/*.dockerfile arm64v8/*.dockerfile arm32v7/*.dockerfile) +else + files=("$@") +fi + +declare -A manifests + +for file in "${files[@]}"; do + if [[ "$file" == */* ]]; then + arch="${file%%/*}" + name="${file#*/}" + else + arch="amd64" + name="$file" + fi + + name="${name#[0-9][0-9]-}" # s/^\d\d-// + name="${name%.dockerfile}" # s/\.dockerfile$// + namearch=$registry/lokinet-ci-$name/$arch + latest=$registry/lokinet-ci-$name:latest + echo -e "\e[32;1mrebuilding \e[35;1m$namearch\e[0m" + docker build --pull -f $file -t $namearch --build-arg ARCH=$arch . + docker push $namearch + + manifests[$latest]="${manifests[$latest]} $namearch" done + +for latest in "${!manifests[@]}"; do + echo -e "\e[32;1mpushing new manifest for \e[33;1m$latest[\e[35;1m${manifests[$latest]} \e[33;1m]\e[0m" + docker manifest rm $latest 2>/dev/null || true + docker manifest create $latest ${manifests[$latest]} + docker manifest push $latest +done + +echo -e "\n\n\n\e[32;1mAll done!\e[1m\n\n" diff --git a/contrib/ci/docker/ubuntu-bionic.dockerfile b/contrib/ci/docker/ubuntu-bionic.dockerfile deleted file mode 100644 index b6bf4f09a..000000000 --- a/contrib/ci/docker/ubuntu-bionic.dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM ubuntu:bionic -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 -q --no-install-recommends install -y eatmydata gdb cmake git ninja-build pkg-config ccache g++-8 python3-dev automake libtool autoconf make qttools5-dev file gperf patch openssh-client' diff --git a/contrib/ci/docker/ubuntu-focal.dockerfile b/contrib/ci/docker/ubuntu-focal.dockerfile deleted file mode 100644 index 5df8d737e..000000000 --- a/contrib/ci/docker/ubuntu-focal.dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM ubuntu:focal -RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections' -RUN /bin/bash -c 'apt-get -o=Dpkg::Use-Pty=0 -q update && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y eatmydata gdb cmake git ninja-build pkg-config ccache g++ libsodium-dev libsystemd-dev python3-dev libuv1-dev libunbound-dev nettle-dev libssl-dev libevent-dev libsqlite3-dev libboost-thread-dev libboost-serialization-dev libboost-program-options-dev libgtest-dev libminiupnpc-dev libunwind8-dev libreadline-dev libhidapi-dev libusb-1.0.0-dev qttools5-dev libcurl4-openssl-dev' diff --git a/contrib/ci/drone-format-verify.sh b/contrib/ci/drone-format-verify.sh index 68a7ac620..387340018 100755 --- a/contrib/ci/drone-format-verify.sh +++ b/contrib/ci/drone-format-verify.sh @@ -2,4 +2,5 @@ test "x$IGNORE" != "x" && exit 0 repo=$(readlink -e $(dirname $0)/../../) clang-format-11 -i $(find $repo/jni $repo/daemon $repo/llarp $repo/include $repo/pybind | grep -E '\.[hc](pp)?$') +jsonnetfmt -i $repo/.drone.jsonnet git --no-pager diff --exit-code --color || (echo -ne '\n\n\e[31;1mLint check failed; please run ./contrib/format.sh\e[0m\n\n' ; exit 1) diff --git a/contrib/deb.loki.network.gpg b/contrib/deb.oxen.io.gpg similarity index 100% rename from contrib/deb.loki.network.gpg rename to contrib/deb.oxen.io.gpg diff --git a/contrib/format.sh b/contrib/format.sh index e514590bd..956f5db92 100755 --- a/contrib/format.sh +++ b/contrib/format.sh @@ -2,12 +2,12 @@ CLANG_FORMAT_DESIRED_VERSION=11 -binary=$(which clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null) +binary=$(command -v clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null) if [ $? -ne 0 ]; then - binary=$(which clang-format-mp-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null) + binary=$(command -v clang-format-mp-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null) fi if [ $? -ne 0 ]; then - binary=$(which clang-format 2>/dev/null) + binary=$(command -v clang-format 2>/dev/null) if [ $? -ne 0 ]; then echo "Please install clang-format version $CLANG_FORMAT_DESIRED_VERSION and re-run this script." exit 1 @@ -22,18 +22,18 @@ fi cd "$(dirname $0)/../" if [ "$1" = "verify" ] ; then if [ $($binary --output-replacements-xml $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|mm?)$' | grep -v '\#') | grep '' | wc -l) -ne 0 ] ; then - exit 1 + exit 2 fi else $binary -i $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|mm)$' | grep -v '\#') &> /dev/null fi -swift_format=$(which swiftformat 2>/dev/null) +swift_format=$(command -v swiftformat 2>/dev/null) if [ $? -eq 0 ]; then if [ "$1" = "verify" ] ; then for f in $(find daemon | grep -E '\.swift$' | grep -v '\#') ; do if [ $($swift_format --quiet --dryrun < "$f" | diff "$f" - | wc -l) -ne 0 ] ; then - exit 1 + exit 3 fi done else @@ -41,3 +41,14 @@ if [ $? -eq 0 ]; then fi fi + +jsonnet_format=$(command -v jsonnetfmt 2>/dev/null) +if [ $? -eq 0 ]; then + if [ "$1" = "verify" ]; then + if ! $jsonnet_format --test .drone.jsonnet; then + exit 4 + fi + else + $jsonnet_format --in-place .drone.jsonnet + fi +fi diff --git a/crypto/libntrup/src/avx/mult.c b/crypto/libntrup/src/avx/mult.c index 237bb240b..687acb46a 100644 --- a/crypto/libntrup/src/avx/mult.c +++ b/crypto/libntrup/src/avx/mult.c @@ -333,7 +333,7 @@ mult96x8_float(__m256 h[192], const __m256 f[96], const __m256 g[96]) /* 96*(16*int8 stored in 32*int8) g inputs between -8 and 8 */ /* 192*16*int16 h outputs between -2400 and 2400 */ static void -mult96x16(__m256i h[192], const __m256i f[96], const __m256i g[96]) +mult96x16(__m256i * h, const __m256i * f, const __m256i * g) { __m256 hfloat[192]; __m256 gfloat[96]; diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index e2e725d74..bc7be3a1f 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -1,3 +1,8 @@ +set(DEFAULT_WITH_BOOTSTRAP ON) +if(APPLE) + set(DEFAULT_WITH_BOOTSTRAP OFF) +endif() +option(WITH_BOOTSTRAP "build lokinet-bootstrap tool" ${DEFAULT_WITH_BOOTSTRAP}) add_executable(lokinet-vpn lokinet-vpn.cpp) if(APPLE) @@ -5,8 +10,12 @@ if(APPLE) enable_lto(lokinet) else() add_executable(lokinet lokinet.cpp) - add_executable(lokinet-bootstrap lokinet-bootstrap.cpp) - enable_lto(lokinet lokinet-vpn lokinet-bootstrap) + enable_lto(lokinet lokinet-vpn) + + if(WITH_BOOTSTRAP) + add_executable(lokinet-bootstrap lokinet-bootstrap.cpp) + enable_lto(lokinet-bootstrap) + endif() endif() @@ -30,7 +39,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") endif() endif() -if(NOT APPLE) +if(WITH_BOOTSTRAP) target_link_libraries(lokinet-bootstrap PUBLIC cpr::cpr) if(NOT WIN32) find_package(OpenSSL REQUIRED) @@ -40,7 +49,7 @@ if(NOT APPLE) endif() set(exetargets lokinet lokinet-vpn) -if(NOT APPLE) +if(WITH_BOOTSTRAP) list(APPEND exetargets lokinet-bootstrap) endif() @@ -53,9 +62,6 @@ foreach(exe ${exetargets}) target_link_directories(${exe} PRIVATE /usr/local/lib) endif() target_link_libraries(${exe} PUBLIC liblokinet) - if(WITH_JEMALLOC) - target_link_libraries(${exe} PUBLIC jemalloc) - endif() target_include_directories(${exe} PUBLIC "${PROJECT_SOURCE_DIR}") target_compile_definitions(${exe} PRIVATE -DVERSIONTAG=${GIT_VERSION_REAL}) add_log_tag(${exe}) @@ -79,10 +85,9 @@ if(APPLE) DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh) add_custom_target(icons DEPENDS ${mac_icon}) add_dependencies(lokinet icons lokinet-extension) - file(DOWNLOAD "https://seed.lokinet.org/lokinet.signed" ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.signed) add_custom_command(TARGET lokinet POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.signed + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed $/Contents/Resources/bootstrap.signed COMMAND mkdir -p $/Contents/PlugIns COMMAND cp -a $ $/Contents/PlugIns/ diff --git a/daemon/lokinet.cpp b/daemon/lokinet.cpp index 316d1b856..2c1a70794 100644 --- a/daemon/lokinet.cpp +++ b/daemon/lokinet.cpp @@ -18,32 +18,6 @@ #include #include -#ifdef USE_JEMALLOC -#include -#include - -void* -operator new(std::size_t sz) -{ - void* ptr = malloc(sz); - if (ptr) - return ptr; - else - throw std::bad_alloc{}; -} -void -operator delete(void* ptr) noexcept -{ - free(ptr); -} - -void -operator delete(void* ptr, size_t) noexcept -{ - free(ptr); -} -#endif - int lokinet_main(int, char**); @@ -259,7 +233,7 @@ run_main_context(std::optional confFile, const llarp::RuntimeOptions o try { std::shared_ptr conf; - if (confFile.has_value()) + if (confFile) { llarp::LogInfo("Using config file: ", *confFile); conf = std::make_shared(confFile->parent_path()); @@ -268,8 +242,12 @@ run_main_context(std::optional confFile, const llarp::RuntimeOptions o { conf = std::make_shared(llarp::GetDefaultDataDir()); } - if (!conf->Load(confFile, opts.isSNode)) - throw std::runtime_error{"Config file parsing failed"}; + if (not conf->Load(confFile, opts.isSNode)) + { + llarp::LogError("failed to parse configuration"); + exit_code.set_value(1); + return; + } ctx = std::make_shared(); ctx->Configure(std::move(conf)); @@ -281,7 +259,17 @@ run_main_context(std::optional confFile, const llarp::RuntimeOptions o signal(SIGUSR1, handle_signal); #endif - ctx->Setup(opts); + try + { + ctx->Setup(opts); + } + catch (std::exception& ex) + { + llarp::LogError( + "failed to set up lokinet: ", ex.what(), ", is lokinet already running? 🤔"); + exit_code.set_value(1); + return; + } llarp::util::SetThreadName("llarp-mainloop"); @@ -522,7 +510,7 @@ lokinet_main(int argc, char* argv[]) } catch (std::exception& ex) { - LogError("cannot generate config at ", *configFile, ": ", ex.what()); + llarp::LogError("cannot generate config at ", *configFile, ": ", ex.what()); return 1; } } @@ -538,7 +526,7 @@ lokinet_main(int argc, char* argv[]) } catch (std::exception& ex) { - LogError("cannot check if ", *configFile, " exists: ", ex.what()); + llarp::LogError("cannot check if ", *configFile, " exists: ", ex.what()); return 1; } } @@ -600,7 +588,7 @@ lokinet_main(int argc, char* argv[]) "file a bug report now or be cursed with this " "annoying image in your syslog for all time."}) { - LogError(wtf); + llarp::LogError{wtf}; llarp::LogContext::Instance().ImmediateFlush(); } #ifdef _WIN32 diff --git a/docs/exit-setup.md b/docs/exit-setup.md index 8edfa30e0..e86a20de6 100644 --- a/docs/exit-setup.md +++ b/docs/exit-setup.md @@ -10,7 +10,7 @@ to configure lokinet to be an exit add into `lokinet.ini`: keyfile=/var/lib/lokinet/exit.private reachable=1 ifaddr=10.0.0.1/16 - hops=1 + hops=2 paths=8 diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index f574f4193..2ddd0e96f 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -50,15 +50,9 @@ add_library(uvw INTERFACE) target_include_directories(uvw INTERFACE uvw/src) target_link_libraries(uvw INTERFACE libuv) - - -# We don't need any of these as we don't use the ssl crypto helper code at all: -set(ENABLE_GNUTLS OFF CACHE BOOL "Disable gnutls for ngtcp2") -set(ENABLE_OPENSSL OFF CACHE BOOL "Disable openssl for ngtcp2") -set(ENABLE_BORINGSSL OFF CACHE BOOL "Disable boringssl for ngtcp2") - -add_definitions(-D_GNU_SOURCE) -add_subdirectory(ngtcp2 EXCLUDE_FROM_ALL) +# ngtcp2 needs some massaging to build nicely: +include(ngtcp2_lib) +add_ngtcp2_lib() # 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). diff --git a/external/ngtcp2 b/external/ngtcp2 index 51e95c8d8..15ba6021c 160000 --- a/external/ngtcp2 +++ b/external/ngtcp2 @@ -1 +1 @@ -Subproject commit 51e95c8d8972abd69515d9790e8fbb774262d9ea +Subproject commit 15ba6021ca352e2e60f9b43f4b96d2e97a42f60b diff --git a/llarp/CMakeLists.txt b/llarp/CMakeLists.txt index 30e90b7be..05a60bbc3 100644 --- a/llarp/CMakeLists.txt +++ b/llarp/CMakeLists.txt @@ -1,6 +1,7 @@ include(Version) add_library(lokinet-util + STATIC ${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp util/bencode.cpp util/buffer.cpp @@ -9,7 +10,6 @@ add_library(lokinet-util util/logging/android_logger.cpp util/logging/buffer.cpp util/logging/file_logger.cpp - util/logging/json_logger.cpp util/logging/logger.cpp util/logging/logger_internal.cpp util/logging/loglevel.cpp diff --git a/llarp/apple/apple_logger.cpp b/llarp/apple/apple_logger.cpp index 4a41c78cf..6dca15fa3 100644 --- a/llarp/apple/apple_logger.cpp +++ b/llarp/apple/apple_logger.cpp @@ -6,7 +6,7 @@ namespace llarp::apple NSLogStream::PreLog( std::stringstream& ss, LogLevel lvl, - const char* fname, + std::string_view fname, int lineno, const std::string& nodename) const { @@ -17,7 +17,7 @@ namespace llarp::apple } void - NSLogStream::Print(LogLevel, const char*, const std::string& msg) + NSLogStream::Print(LogLevel, std::string_view, const std::string& msg) { ns_logger(msg.c_str()); } diff --git a/llarp/apple/apple_logger.hpp b/llarp/apple/apple_logger.hpp index b97810c76..954d5b402 100644 --- a/llarp/apple/apple_logger.hpp +++ b/llarp/apple/apple_logger.hpp @@ -16,15 +16,15 @@ namespace llarp::apple PreLog( std::stringstream& s, LogLevel lvl, - const char* fname, + std::string_view fname, int lineno, const std::string& nodename) const override; void - Print(LogLevel lvl, const char* tag, const std::string& msg) override; + Print(LogLevel lvl, std::string_view tag, const std::string& msg) override; void - PostLog(std::stringstream& ss) const override + PostLog(std::stringstream&) const override {} void diff --git a/llarp/apple/context_wrapper.cpp b/llarp/apple/context_wrapper.cpp index 09b45ba9a..fd662967c 100644 --- a/llarp/apple/context_wrapper.cpp +++ b/llarp/apple/context_wrapper.cpp @@ -105,7 +105,7 @@ llarp_apple_init(llarp_apple_config* appleconf) } catch (const std::exception& e) { - LogError("Failed to initialize lokinet from config: ", e.what()); + llarp::LogError("Failed to initialize lokinet from config: ", e.what()); } return nullptr; } @@ -149,7 +149,7 @@ llarp_apple_start(void* lokinet, void* callback_context) } catch (const std::exception& e) { - LogError("Failed to initialize lokinet: ", e.what()); + llarp::LogError("Failed to initialize lokinet: ", e.what()); return -1; } @@ -178,7 +178,7 @@ llarp_apple_incoming(void* lokinet, const void* bytes, size_t size) if (iface->OfferReadPacket(buf)) return 0; - LogError("invalid IP packet: ", llarp::buffer_printer(buf)); + llarp::LogError("invalid IP packet: ", llarp::buffer_printer(buf)); return -1; } diff --git a/llarp/config/config.cpp b/llarp/config/config.cpp index 4e1b4c80e..3a2719343 100644 --- a/llarp/config/config.cpp +++ b/llarp/config/config.cpp @@ -569,7 +569,13 @@ namespace llarp IP6RangeDefault, [this](std::string arg) { if (arg.empty()) + { + LogError( + "!!! Disabling ipv6 tunneling when you have ipv6 routes WILL lead to " + "de-anonymization as lokinet will no longer carry your ipv6 traffic !!!"); + m_baseV6Address = std::nullopt; return; + } m_baseV6Address = huint128_t{}; if (not m_baseV6Address->FromString(arg)) throw std::invalid_argument( @@ -1048,7 +1054,6 @@ namespace llarp Comment{ "Log type (format). Valid options are:", " file - plaintext formatting", - " json - json-formatted log statements", " syslog - logs directed to syslog", }); diff --git a/llarp/dns/message.cpp b/llarp/dns/message.cpp index f10e9b9c6..0d78d1fdb 100644 --- a/llarp/dns/message.cpp +++ b/llarp/dns/message.cpp @@ -117,16 +117,16 @@ namespace llarp { if (!qd.Decode(buf)) { - llarp::LogError("failed to decode question"); + LogError("failed to decode question"); return false; } - llarp::LogDebug(qd); + LogDebug("dns question: ", qd); } for (auto& an : answers) { if (not an.Decode(buf)) { - llarp::LogDebug("failed to decode answer"); + LogDebug("failed to decode answer"); return false; } } diff --git a/llarp/iwp/session.cpp b/llarp/iwp/session.cpp index d9388325c..0b5b3bec5 100644 --- a/llarp/iwp/session.cpp +++ b/llarp/iwp/session.cpp @@ -748,11 +748,14 @@ namespace llarp LogError("short XMIT from ", m_RemoteAddr); return; } - uint16_t sz = bufbe16toh(data.data() + CommandOverhead + PacketOverhead); - uint64_t rxid = bufbe64toh(data.data() + CommandOverhead + sizeof(uint16_t) + PacketOverhead); - ShortHash h{ - data.data() + CommandOverhead + sizeof(uint16_t) + sizeof(uint64_t) + PacketOverhead}; - LogTrace("rxid=", rxid, " sz=", sz, " h=", h.ToHex(), " from ", m_RemoteAddr); + auto* pos = data.data() + CommandOverhead + PacketOverhead; + uint16_t sz = bufbe16toh(pos); + pos += sizeof(sz); + uint64_t rxid = bufbe64toh(pos); + pos += sizeof(rxid); + auto p2 = pos + ShortHash::SIZE; + assert(p2 == data.data() + XMITOverhead); + LogTrace("rxid=", rxid, " sz=", sz, " h=", oxenmq::to_hex(pos, p2), " from ", m_RemoteAddr); m_LastRX = m_Parent->Now(); { // check for replay @@ -769,8 +772,8 @@ namespace llarp auto itr = m_RXMsgs.find(rxid); if (itr == m_RXMsgs.end()) { - itr = - m_RXMsgs.emplace(rxid, InboundMessage{rxid, sz, std::move(h), m_Parent->Now()}).first; + itr = m_RXMsgs.emplace(rxid, InboundMessage{rxid, sz, ShortHash{pos}, m_Parent->Now()}) + .first; sz = std::min(sz, uint16_t{FragmentSize}); if ((data.size() - XMITOverhead) == sz) { diff --git a/llarp/path/pathbuilder.hpp b/llarp/path/pathbuilder.hpp index 2114ae2c4..a01198974 100644 --- a/llarp/path/pathbuilder.hpp +++ b/llarp/path/pathbuilder.hpp @@ -110,7 +110,7 @@ namespace llarp llarp_time_t Now() const override; - void + virtual void Tick(llarp_time_t now) override; void diff --git a/llarp/quic/address.hpp b/llarp/quic/address.hpp index 42150ed3e..5f7bc3522 100644 --- a/llarp/quic/address.hpp +++ b/llarp/quic/address.hpp @@ -21,7 +21,7 @@ namespace llarp::quic class Address { sockaddr_in6 saddr{}; - ngtcp2_addr a{sizeof(saddr), reinterpret_cast(&saddr), nullptr}; + ngtcp2_addr a{sizeof(saddr), reinterpret_cast(&saddr)}; public: Address() = default; @@ -102,8 +102,7 @@ namespace llarp::quic Address local_, remote_; public: - ngtcp2_path path{ - {local_.sockaddr_size(), local_, nullptr}, {remote_.sockaddr_size(), remote_, nullptr}}; + ngtcp2_path path{{local_.sockaddr_size(), local_}, {remote_.sockaddr_size(), remote_}, nullptr}; // Public accessors are const: const Address& local = local_; diff --git a/llarp/quic/connection.cpp b/llarp/quic/connection.cpp index c3b21d597..778908385 100644 --- a/llarp/quic/connection.cpp +++ b/llarp/quic/connection.cpp @@ -244,6 +244,7 @@ namespace llarp::quic int stream_close_cb( ngtcp2_conn* conn, + uint32_t flags, int64_t stream_id, uint64_t app_error_code, void* user_data, @@ -275,17 +276,13 @@ namespace llarp::quic return 0; } - int - rand( - uint8_t* dest, - size_t destlen, - const ngtcp2_rand_ctx* rand_ctx, - [[maybe_unused]] ngtcp2_rand_usage usage) + void + rand(uint8_t* dest, size_t destlen, const ngtcp2_rand_ctx* rand_ctx) { LogTrace("######################", __func__); randombytes_buf(dest, destlen); - return 0; } + int get_new_connection_id( ngtcp2_conn* conn_, ngtcp2_cid* cid_, uint8_t* token, size_t cidlen, void* user_data) @@ -340,7 +337,7 @@ namespace llarp::quic va_start(ap, fmt); if (char* msg; vasprintf(&msg, fmt, ap) >= 0) { - LogTraceExplicit("external/ngtcp2/*.c", 0, msg); + LogTrace{msg}; std::free(msg); } va_end(ap); @@ -406,7 +403,7 @@ namespace llarp::quic settings.initial_ts = get_timestamp(); // FIXME: IPv6 - settings.max_udp_payload_size = NGTCP2_MAX_PKTLEN_IPV4; + settings.max_udp_payload_size = Endpoint::max_pkt_size_v4; settings.cc_algo = NGTCP2_CC_ALGO_CUBIC; // settings.initial_rtt = ???; # NGTCP2's default is 333ms @@ -1185,8 +1182,7 @@ namespace llarp::quic ngtcp2_conn_get_local_transport_params(*this, &tparams); assert(conn_buffer.empty()); - static_assert(NGTCP2_MAX_PKTLEN_IPV4 > NGTCP2_MAX_PKTLEN_IPV6); - conn_buffer.resize(NGTCP2_MAX_PKTLEN_IPV4); + conn_buffer.resize(Endpoint::max_pkt_size_v4); auto* buf = u8data(conn_buffer); auto* bufend = buf + conn_buffer.size(); diff --git a/llarp/quic/connection.hpp b/llarp/quic/connection.hpp index 828e99d23..be8eb715c 100644 --- a/llarp/quic/connection.hpp +++ b/llarp/quic/connection.hpp @@ -123,7 +123,7 @@ namespace llarp::quic }; // Packet data storage for a packet we are currently sending - std::array send_buffer{}; + std::array send_buffer{}; size_t send_buffer_size = 0; ngtcp2_pkt_info send_pkt_info{}; diff --git a/llarp/quic/endpoint.cpp b/llarp/quic/endpoint.cpp index 16444c1a4..5d57e9010 100644 --- a/llarp/quic/endpoint.cpp +++ b/llarp/quic/endpoint.cpp @@ -199,7 +199,7 @@ namespace llarp::quic void Endpoint::send_version_negotiation(const version_info& vi, const Address& source) { - std::array buf; + std::array buf; std::array versions; std::iota(versions.begin() + 1, versions.end(), NGTCP2_PROTO_VER_MIN); // we're supposed to send some 0x?a?a?a?a version to trigger version negotiation @@ -234,11 +234,13 @@ namespace llarp::quic Path path; ngtcp2_pkt_info pi; - auto write_close_func = - application ? ngtcp2_conn_write_application_close : ngtcp2_conn_write_connection_close; + auto write_close_func = application ? ngtcp2_conn_write_application_close_versioned + : ngtcp2_conn_write_connection_close_versioned; + auto written = write_close_func( conn, path, + NGTCP2_PKT_INFO_VERSION, &pi, u8data(conn.conn_buffer), conn.conn_buffer.size(), diff --git a/llarp/quic/endpoint.hpp b/llarp/quic/endpoint.hpp index 53a850ea4..cfbf92c54 100644 --- a/llarp/quic/endpoint.hpp +++ b/llarp/quic/endpoint.hpp @@ -64,8 +64,8 @@ namespace llarp::quic // Max theoretical size of a UDP packet is 2^16-1 minus IP/UDP header overhead static constexpr size_t max_buf_size = 64 * 1024; // Max size of a UDP packet that we'll send - static constexpr size_t max_pkt_size_v4 = NGTCP2_MAX_PKTLEN_IPV4; - static constexpr size_t max_pkt_size_v6 = NGTCP2_MAX_PKTLEN_IPV6; + static constexpr size_t max_pkt_size_v4 = NGTCP2_MAX_UDP_PAYLOAD_SIZE; + static constexpr size_t max_pkt_size_v6 = NGTCP2_MAX_UDP_PAYLOAD_SIZE; using primary_conn_ptr = std::shared_ptr; using alias_conn_ptr = std::weak_ptr; diff --git a/llarp/router/abstractrouter.hpp b/llarp/router/abstractrouter.hpp index 1e43ac0c2..c249ef420 100644 --- a/llarp/router/abstractrouter.hpp +++ b/llarp/router/abstractrouter.hpp @@ -324,6 +324,9 @@ namespace llarp virtual util::StatusObject ExtractStatus() const = 0; + virtual util::StatusObject + ExtractSummaryStatus() const = 0; + /// gossip an rc if required virtual void GossipRCIfNeeded(const RouterContact rc) = 0; diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 4fa608afc..e7eae19a1 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -97,6 +96,77 @@ namespace llarp } } + util::StatusObject + Router::ExtractSummaryStatus() const + { + if (!_running) + return util::StatusObject{{"running", false}}; + + auto services = _hiddenServiceContext.ExtractStatus(); + auto link_types = _linkManager.ExtractStatus(); + + uint64_t tx_rate = 0; + uint64_t rx_rate = 0; + uint64_t peers = 0; + for (const auto& links : link_types) + { + for (const auto& link : links) + { + if (link.empty()) + continue; + for (const auto& peer : link["sessions"]["established"]) + { + tx_rate += peer["tx"].get(); + rx_rate += peer["rx"].get(); + peers++; + } + } + } + + // Compute all stats on all path builders on the default endpoint + // Merge snodeSessions, remoteSessions and default into a single array + std::vector builders; + auto snode_sessions = services["default"]["snodeSessions"]; + for (const auto& session : snode_sessions) + builders.push_back(session["buildStats"]); + + auto remote_sessions = services["default"]["remoteSessions"]; + for (const auto& session : remote_sessions) + builders.push_back(session["buildStats"]); + + builders.push_back(services["default"]["buildStats"]); + + // Iterate over all items on this array to build the global pathStats + uint64_t paths = 0; + uint64_t success = 0; + uint64_t attempts = 0; + for (const auto& builder : builders) + { + if (builder.is_null()) + continue; + if (builder["length"].is_number()) + paths += builder["length"].get(); + if (builder["success"].is_number()) + success += builder["success"].get(); + if (builder["attempts"].is_number()) + attempts += builder["attempts"].get(); + } + double ratio = static_cast(success) / (attempts + 1); + + return util::StatusObject{ + {"running", true}, + {"authCodes", services["default"]["authCodes"]}, + {"exitMap", services["default"]["exitMap"]}, + {"lokiAddress", services["default"]["identity"]}, + {"numPathsBuilt", paths}, + {"numPeersConnected", peers}, + {"numRoutersKnown", _nodedb->NumLoaded()}, + {"ratio", ratio}, + {"txRate", tx_rate}, + {"rxRate", rx_rate}, + }; + } + bool Router::HandleRecvLinkMessageBuffer(ILinkSession* session, const llarp_buffer_t& buf) { diff --git a/llarp/router/router.hpp b/llarp/router/router.hpp index 9131dbec9..946bc8594 100644 --- a/llarp/router/router.hpp +++ b/llarp/router/router.hpp @@ -103,6 +103,9 @@ namespace llarp util::StatusObject ExtractStatus() const override; + util::StatusObject + ExtractSummaryStatus() const override; + const std::shared_ptr& nodedb() const override { diff --git a/llarp/router/systemd_resolved.cpp b/llarp/router/systemd_resolved.cpp index d0ee535c2..5f1e40813 100644 --- a/llarp/router/systemd_resolved.cpp +++ b/llarp/router/systemd_resolved.cpp @@ -87,46 +87,84 @@ namespace llarp { // This passing address by bytes and using two separate calls for ipv4/ipv6 is gross, but the // alternative is to build up a bunch of crap with va_args, which is slightly more gross. + const bool isStandardDNSPort = dns.getPort() == 53; if (dns.isIPv6()) { auto ipv6 = dns.getIPv6(); static_assert(sizeof(ipv6) == 16); auto* a = reinterpret_cast(&ipv6); - resolved_call( - bus, - "SetLinkDNSEx", - "ia(iayqs)", - (int32_t)if_ndx, - (int)1, // number of "iayqs"s we are passing - (int32_t)AF_INET6, // network address type - (int)16, // network addr byte size - // clang-format off - a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], - a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], // yuck - // clang-format on - (uint16_t)dns.getPort(), - nullptr // dns server name (for TLS SNI which we don't care about) - ); + if (isStandardDNSPort) + { + resolved_call( + bus, + "SetLinkDNS", + "ia(iay)", + (int32_t)if_ndx, + (int)1, // number of "iayqs"s we are passing + (int32_t)AF_INET6, // network address type + (int)16, // network addr byte size + // clang-format off + a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], + a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15] // yuck + // clang-format on + ); + } + else + { + resolved_call( + bus, + "SetLinkDNSEx", + "ia(iayqs)", + (int32_t)if_ndx, + (int)1, // number of "iayqs"s we are passing + (int32_t)AF_INET6, // network address type + (int)16, // network addr byte size + // clang-format off + a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], + a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15], // yuck + // clang-format on + (uint16_t)dns.getPort(), + nullptr // dns server name (for TLS SNI which we don't care about) + ); + } } else { auto ipv4 = dns.getIPv4(); static_assert(sizeof(ipv4) == 4); auto* a = reinterpret_cast(&ipv4); - resolved_call( - bus, - "SetLinkDNSEx", - "ia(iayqs)", - (int32_t)if_ndx, - (int)1, // number of "iayqs"s we are passing - (int32_t)AF_INET, // network address type - (int)4, // network addr byte size - // clang-format off - a[0], a[1], a[2], a[3], // yuck - // clang-format on - (uint16_t)dns.getPort(), - nullptr // dns server name (for TLS SNI which we don't care about) - ); + if (isStandardDNSPort) + { + resolved_call( + bus, + "SetLinkDNS", + "ia(iay)", + (int32_t)if_ndx, + (int)1, // number of "iayqs"s we are passing + (int32_t)AF_INET, // network address type + (int)4, // network addr byte size + // clang-format off + a[0], a[1], a[2], a[3] // yuck + // clang-format on + ); + } + else + { + resolved_call( + bus, + "SetLinkDNSEx", + "ia(iayqs)", + (int32_t)if_ndx, + (int)1, // number of "iayqs"s we are passing + (int32_t)AF_INET, // network address type + (int)4, // network addr byte size + // clang-format off + a[0], a[1], a[2], a[3], // yuck + // clang-format on + (uint16_t)dns.getPort(), + nullptr // dns server name (for TLS SNI which we don't care about) + ); + } } if (global) diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index 347c0e405..bb500dfba 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -35,7 +35,9 @@ namespace llarp explicit NetID(const byte_t* val); - explicit NetID(const NetID& other) = default; + NetID(const NetID& other) = default; + NetID& + operator=(const NetID& other) = default; bool operator==(const NetID& other) const; diff --git a/llarp/rpc/rpc_server.cpp b/llarp/rpc/rpc_server.cpp index 8e880a187..5bb14e84e 100644 --- a/llarp/rpc/rpc_server.cpp +++ b/llarp/rpc/rpc_server.cpp @@ -133,6 +133,13 @@ namespace llarp::rpc defer.reply(data); }); }) + .add_request_command( + "get_status", + [&](oxenmq::Message& msg) { + m_Router->loop()->call([defer = msg.send_later(), r = m_Router]() { + defer.reply(CreateJSONResponse(r->ExtractSummaryStatus())); + }); + }) .add_request_command( "quic_connect", [&](oxenmq::Message& msg) { diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 796d9e536..943dfe4e4 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -470,6 +470,7 @@ namespace llarp if (itr == Sessions().end()) return false; si = itr->second.remote; + si.UpdateAddr(); return true; } @@ -1100,13 +1101,14 @@ namespace llarp bool Endpoint::HandleDataMessage( - path::Path_ptr, const PathID_t from, std::shared_ptr msg) + path::Path_ptr p, const PathID_t from, std::shared_ptr msg) { PutSenderFor(msg->tag, msg->sender, true); Introduction intro = msg->introReply; if (HasInboundConvo(msg->sender.Addr())) { intro.pathID = from; + intro.router = p->Endpoint(); } PutReplyIntroFor(msg->tag, intro); ConvoTagRX(msg->tag); diff --git a/llarp/service/intro.hpp b/llarp/service/intro.hpp index 093c1035b..507d0ffc9 100644 --- a/llarp/service/intro.hpp +++ b/llarp/service/intro.hpp @@ -13,7 +13,7 @@ namespace llarp { struct Introduction { - PubKey router; + RouterID router; PathID_t pathID; llarp_time_t latency = 0s; llarp_time_t expiresAt = 0s; diff --git a/llarp/service/outbound_context.cpp b/llarp/service/outbound_context.cpp index 98f6cd28c..e2ac2cb6e 100644 --- a/llarp/service/outbound_context.cpp +++ b/llarp/service/outbound_context.cpp @@ -54,7 +54,7 @@ namespace llarp return true; } - constexpr auto OutboundContextNumPaths = 2; + constexpr auto OutboundContextNumPaths = 4; OutboundContext::OutboundContext(const IntroSet& introset, Endpoint* parent) : path::Builder{parent->Router(), OutboundContextNumPaths, parent->numHops} @@ -64,12 +64,17 @@ namespace llarp , currentIntroSet{introset} { + assert(not introset.intros.empty()); updatingIntroSet = false; - for (const auto& intro : introset.intros) + + // pick random first intro + auto it = introset.intros.begin(); + if (introset.intros.size() > 1) { - if (m_NextIntro.latency == 0s or m_NextIntro.latency > intro.latency) - m_NextIntro = intro; + CSRNG rng{}; + it += std::uniform_int_distribution{0, introset.intros.size() - 1}(rng); } + m_NextIntro = *it; currentConvoTag.Randomize(); lastShift = Now(); // add send and connect timeouts to the parent endpoints path alignment timeout @@ -333,6 +338,7 @@ namespace llarp Encrypted<64> tmp; tmp.Randomize(); SendPacketToRemote(tmp, ProtocolType::Control); + m_LastKeepAliveAt = Now(); } bool @@ -348,7 +354,10 @@ namespace llarp // expunge SharedSecret discardme; if (not m_DataHandler->GetCachedSessionKeyFor(currentConvoTag, discardme)) + { + LogError(Name(), " no cached key after sending intro, we are in a fugged state, oh no"); return true; + } } if (m_GotInboundTraffic and m_LastInboundTraffic + sendTimeout <= now) @@ -404,21 +413,33 @@ namespace llarp m_ReadyHooks.clear(); } - if (m_LastInboundTraffic > 0s and lastGoodSend > 0s - and now >= sendTimeout + m_LastInboundTraffic) - return true; - const auto timeout = std::max(lastGoodSend, m_LastInboundTraffic); if (lastGoodSend > 0s and now >= timeout + (sendTimeout / 2)) { // send a keep alive to keep this session alive KeepAlive(); if (markedBad) + { + LogWarn(Name(), " keepalive timeout hit"); return true; + } + } + + // check for half open state where we can send but we get nothing back + if (m_LastInboundTraffic == 0s and now - createdAt > connectTimeout) + { + LogWarn(Name(), " half open state, we can send but we got nothing back"); + return true; } // if we are dead return true so we are removed - return timeout > 0s ? (now >= timeout && now - timeout > sendTimeout) - : (now >= createdAt && now - createdAt > connectTimeout); + const bool removeIt = timeout > 0s ? (now >= timeout && now - timeout > sendTimeout) + : (now >= createdAt && now - createdAt > connectTimeout); + if (removeIt) + { + LogInfo(Name(), " session is stale"); + return true; + } + return false; } void @@ -584,6 +605,25 @@ namespace llarp } } + bool + OutboundContext::ShouldKeepAlive(llarp_time_t now) const + { + const auto SendKeepAliveInterval = sendTimeout / 2; + if (not m_GotInboundTraffic) + return false; + if (m_LastInboundTraffic == 0s) + return false; + return (now - m_LastKeepAliveAt) >= SendKeepAliveInterval; + } + + void + OutboundContext::Tick(llarp_time_t now) + { + path::Builder::Tick(now); + if (ShouldKeepAlive(now)) + KeepAlive(); + } + bool OutboundContext::HandleHiddenServiceFrame(path::Path_ptr p, const ProtocolFrame& frame) { diff --git a/llarp/service/outbound_context.hpp b/llarp/service/outbound_context.hpp index 8e27500e6..b005bcd19 100644 --- a/llarp/service/outbound_context.hpp +++ b/llarp/service/outbound_context.hpp @@ -23,6 +23,9 @@ namespace llarp ~OutboundContext() override; + void + Tick(llarp_time_t now) override; + util::StatusObject ExtractStatus() const; @@ -129,6 +132,9 @@ namespace llarp void KeepAlive(); + bool + ShouldKeepAlive(llarp_time_t now) const; + const IntroSet& GetCurrentIntroSet() const { @@ -170,6 +176,7 @@ namespace llarp bool sentIntro = false; std::vector> m_ReadyHooks; llarp_time_t m_LastIntrosetUpdateAt = 0s; + llarp_time_t m_LastKeepAliveAt = 0s; }; } // namespace service diff --git a/llarp/service/sendcontext.hpp b/llarp/service/sendcontext.hpp index dee9cb4eb..cc0ab4a69 100644 --- a/llarp/service/sendcontext.hpp +++ b/llarp/service/sendcontext.hpp @@ -45,7 +45,7 @@ namespace llarp llarp_time_t lastGoodSend = 0s; const llarp_time_t createdAt; llarp_time_t sendTimeout = path::build_timeout; - llarp_time_t connectTimeout = path::build_timeout; + llarp_time_t connectTimeout = path::build_timeout * 2; llarp_time_t shiftTimeout = (path::build_timeout * 5) / 2; llarp_time_t estimatedRTT = 0s; bool markedBad = false; diff --git a/llarp/util/bencode.hpp b/llarp/util/bencode.hpp index cfb49c849..7ccabdcab 100644 --- a/llarp/util/bencode.hpp +++ b/llarp/util/bencode.hpp @@ -75,7 +75,7 @@ namespace llarp { if (!item.BDecode(buf)) { - llarp::LogWarnTag("llarp/bencode.hpp", "failed to decode key ", k, " for entry in dict"); + llarp::LogWarn("failed to decode key ", k, " for entry in dict"); return false; } @@ -94,7 +94,7 @@ namespace llarp uint64_t read_i; if (!bencode_read_integer(buf, &read_i)) { - llarp::LogWarnTag("llarp/BEncode.hpp", "failed to decode key ", k, " for integer in dict"); + llarp::LogWarn("failed to decode key ", k, " for integer in dict"); return false; } @@ -210,8 +210,7 @@ namespace llarp return true; if (sink.DecodeKey(*key, buffer)) return true; - llarp::LogWarnTag( - "llarp/bencode.hpp", "undefined key '", *key->cur, "' for entry in dict"); + llarp::LogWarn("undefined key '", *key->cur, "' for entry in dict"); return false; }, diff --git a/llarp/util/fs.hpp b/llarp/util/fs.hpp index 3973f3540..c62c0766e 100644 --- a/llarp/util/fs.hpp +++ b/llarp/util/fs.hpp @@ -1,12 +1,7 @@ #pragma once #include - -#if defined(WIN32) || defined(_WIN32) -#define PATH_SEP "\\" -#else -#define PATH_SEP "/" -#endif +#include #ifdef USE_GHC_FILESYSTEM #include @@ -61,36 +56,31 @@ namespace llarp return std::make_optional(pathname, mode); } - using PathVisitor = std::function; - using PathIter = std::function; - - static PathIter IterDir = [](const fs::path& path, PathVisitor visit) { -#ifdef _MSC_VER - for (auto& p : fs::directory_iterator(path)) - { - if (!visit(p.path())) - { - break; - } - } -#else + template + static void + IterDir(const fs::path& path, PathVisitor visit) + { DIR* d = opendir(path.string().c_str()); if (d == nullptr) return; struct dirent* ent = nullptr; + std::set entries; do { ent = readdir(d); - if (!ent) + if (not ent) break; if (ent->d_name[0] == '.') continue; - fs::path p = path / fs::path(ent->d_name); - if (!visit(p)) - break; + entries.emplace(path / fs::path{ent->d_name}); } while (ent); closedir(d); -#endif + + for (const auto& p : entries) + { + if (not visit(p)) + return; + } }; } // namespace util } // namespace llarp diff --git a/llarp/util/logging/android_logger.cpp b/llarp/util/logging/android_logger.cpp index c9d9de01f..3cf9343cb 100644 --- a/llarp/util/logging/android_logger.cpp +++ b/llarp/util/logging/android_logger.cpp @@ -8,7 +8,8 @@ namespace llarp { void AndroidLogStream::PreLog( - std::stringstream& ss, LogLevel lvl, const char* fname, int lineno, const std::string&) const + std::stringstream& ss, LogLevel lvl, std::string_view fname, int lineno, const std::string&) + const { switch (lvl) { @@ -43,7 +44,7 @@ namespace llarp {} void - AndroidLogStream::Print(LogLevel lvl, const char* tag, const std::string& msg) + AndroidLogStream::Print(LogLevel lvl, std::string_view tag, const std::string& msg) { std::string str("lokinet|"); str += tag; @@ -62,6 +63,8 @@ namespace llarp case eLogError: __android_log_write(ANDROID_LOG_ERROR, str.c_str(), msg.c_str()); return; + default: + return; } } // namespace llarp diff --git a/llarp/util/logging/android_logger.hpp b/llarp/util/logging/android_logger.hpp index 15345776e..e42989910 100644 --- a/llarp/util/logging/android_logger.hpp +++ b/llarp/util/logging/android_logger.hpp @@ -12,12 +12,12 @@ namespace llarp PreLog( std::stringstream& s, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const override; void - Print(LogLevel lvl, const char* filename, const std::string& msg) override; + Print(LogLevel lvl, std::string_view filename, const std::string& msg) override; void PostLog(std::stringstream&) const override; diff --git a/llarp/util/logging/file_logger.cpp b/llarp/util/logging/file_logger.cpp index 229b9c148..c41d092e8 100644 --- a/llarp/util/logging/file_logger.cpp +++ b/llarp/util/logging/file_logger.cpp @@ -65,18 +65,18 @@ namespace llarp FileLogStream::PreLog( std::stringstream& ss, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const { ss << "[" << LogLevelToString(lvl) << "] "; ss << "[" << nodename << "]" - << "(" << thread_id_string() << ") " << log_timestamp() << " " << fname << ":" << lineno + << "(" << thread_id_string() << ") " << log_timestamp() << " " << filename << ":" << lineno << "\t"; } void - FileLogStream::Print(LogLevel, const char*, const std::string& msg) + FileLogStream::Print(LogLevel, std::string_view, const std::string& msg) { m_Lines.pushBack(msg); } @@ -84,12 +84,12 @@ namespace llarp void FileLogStream::AppendLog( LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename, const std::string msg) { - ILogStream::AppendLog(lvl, fname, lineno, nodename, msg); + ILogStream::AppendLog(lvl, filename, lineno, nodename, msg); Tick(llarp::time_now_ms()); } diff --git a/llarp/util/logging/file_logger.hpp b/llarp/util/logging/file_logger.hpp index 7b6bfbd49..07af96102 100644 --- a/llarp/util/logging/file_logger.hpp +++ b/llarp/util/logging/file_logger.hpp @@ -23,12 +23,12 @@ namespace llarp PreLog( std::stringstream& out, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const override; void - Print(LogLevel, const char*, const std::string& msg) override; + Print(LogLevel, std::string_view filename, const std::string& msg) override; void Tick(llarp_time_t now) override; @@ -39,7 +39,7 @@ namespace llarp void AppendLog( LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename, const std::string msg) override; diff --git a/llarp/util/logging/json_logger.cpp b/llarp/util/logging/json_logger.cpp deleted file mode 100644 index 119e910f3..000000000 --- a/llarp/util/logging/json_logger.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "json_logger.hpp" -#include - -namespace llarp -{ - void - JSONLogStream::AppendLog( - LogLevel lvl, - const char* fname, - int lineno, - const std::string& nodename, - const std::string msg) - { - json::Object obj; - obj["time"] = to_json(llarp::time_now_ms()); - obj["nickname"] = nodename; - obj["file"] = std::string(fname); - obj["line"] = lineno; - obj["level"] = LogLevelToString(lvl); - obj["message"] = msg; - m_Lines.pushBack(obj.dump()); - } - -} // namespace llarp diff --git a/llarp/util/logging/json_logger.hpp b/llarp/util/logging/json_logger.hpp deleted file mode 100644 index af0476b6f..000000000 --- a/llarp/util/logging/json_logger.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef LLARP_UTIL_JSON_LOGGER -#define LLARP_UTIL_JSON_LOGGER - -#include "file_logger.hpp" - -namespace llarp -{ - struct JSONLogStream : public FileLogStream - { - JSONLogStream( - std::function disk, - FILE* f, - llarp_time_t flushInterval, - bool closeFile) - : FileLogStream(std::move(disk), f, flushInterval, closeFile) - {} - - void - AppendLog( - LogLevel lvl, - const char* fname, - int lineno, - const std::string& nodename, - const std::string msg) override; - }; -} // namespace llarp - -#endif diff --git a/llarp/util/logging/logger.cpp b/llarp/util/logging/logger.cpp index 4730e32b3..3357ab291 100644 --- a/llarp/util/logging/logger.cpp +++ b/llarp/util/logging/logger.cpp @@ -2,7 +2,6 @@ #include "ostream_logger.hpp" #include "logger_syslog.hpp" #include "file_logger.hpp" -#include "json_logger.hpp" #if defined(_WIN32) #include "win32_logger.hpp" #endif @@ -36,8 +35,6 @@ namespace llarp return LogType::Unknown; else if (str == "file") return LogType::File; - else if (str == "json") - return LogType::Json; else if (str == "syslog") return LogType::Syslog; @@ -111,7 +108,7 @@ namespace llarp { logfile = stdout; } - else + else if (type != LogType::Syslog) { logfile = ::fopen(file.c_str(), "a"); if (not logfile) @@ -141,26 +138,10 @@ namespace llarp } break; - case LogType::Json: - LogInfo("Switching logger to JSON with file: ", file); - std::cout << std::flush; - - LogContext::Instance().logStream = - std::make_unique(io, logfile, 100ms, logfile != stdout); - break; case LogType::Syslog: - if (logfile) - { - // TODO: this logic should be handled in Config - // TODO: this won't even work because of default value for 'file' (== "stdout") - ::fclose(logfile); - throw std::invalid_argument("Cannot mix log type=syslog and file=*"); - } #if defined(_WIN32) throw std::runtime_error("syslog not supported on win32"); #else - LogInfo("Switching logger to syslog"); - std::cout << std::flush; LogContext::Instance().logStream = std::make_unique(); #endif break; diff --git a/llarp/util/logging/logger.hpp b/llarp/util/logging/logger.hpp index 599242147..fd5b6ef60 100644 --- a/llarp/util/logging/logger.hpp +++ b/llarp/util/logging/logger.hpp @@ -1,9 +1,11 @@ #pragma once #include +#include #include #include "logstream.hpp" #include "logger_internal.hpp" +#include "source_location.hpp" namespace llarp { @@ -11,7 +13,6 @@ namespace llarp { Unknown = 0, File, - Json, Syslog, }; LogType @@ -77,52 +78,91 @@ namespace llarp LogLevel GetLogLevel(); - /** internal */ - template - inline static void - _log(LogLevel lvl, const char* fname, int lineno, TArgs&&... args) noexcept + namespace { - auto& log = LogContext::Instance(); - if (log.curLevel > lvl || log.logStream == nullptr) - return; - std::ostringstream ss; - if constexpr (sizeof...(args) > 0) - LogAppend(ss, std::forward(args)...); - log.logStream->AppendLog(lvl, fname, lineno, log.nodeName, ss.str()); - } + /** internal */ + template + inline static void + _log(LogLevel lvl, const slns::source_location& location, TArgs&&... args) noexcept + { + auto& log = LogContext::Instance(); + if (log.curLevel > lvl || log.logStream == nullptr) + return; + std::ostringstream ss; + if constexpr (sizeof...(args) > 0) + LogAppend(ss, std::forward(args)...); + log.logStream->AppendLog( + lvl, + strip_prefix(location.file_name(), SOURCE_ROOT), + location.line(), + log.nodeName, + ss.str()); + } + } // namespace - inline void - _log_noop() noexcept - {} + template + struct LogTrace + { + LogTrace(T... args, const slns::source_location& location = slns::source_location::current()) + { +#ifdef NDEBUG + ((void)args, ...); + (void)location; +#else + _log(eLogTrace, location, std::forward(args)...); +#endif + } + }; + + template + LogTrace(T&&...) -> LogTrace; + + template + struct LogDebug + { + LogDebug(T... args, const slns::source_location& location = slns::source_location::current()) + { + _log(eLogDebug, location, std::forward(args)...); + } + }; + + template + LogDebug(T&&...) -> LogDebug; + + template + struct LogInfo + { + LogInfo(T... args, const slns::source_location& location = slns::source_location::current()) + { + _log(eLogInfo, location, std::forward(args)...); + } + }; + + template + LogInfo(T&&...) -> LogInfo; + + template + struct LogWarn + { + LogWarn(T... args, const slns::source_location& location = slns::source_location::current()) + { + _log(eLogWarn, location, std::forward(args)...); + } + }; + + template + LogWarn(T&&...) -> LogWarn; + + template + struct LogError + { + LogError(T... args, const slns::source_location& location = slns::source_location::current()) + { + _log(eLogError, location, std::forward(args)...); + } + }; + + template + LogError(T&&...) -> LogError; } // namespace llarp - -#define LogDebug(...) _log(llarp::eLogDebug, LOG_TAG, __LINE__, __VA_ARGS__) -#define LogInfo(...) _log(llarp::eLogInfo, LOG_TAG, __LINE__, __VA_ARGS__) -#define LogWarn(...) _log(llarp::eLogWarn, LOG_TAG, __LINE__, __VA_ARGS__) -#define LogError(...) _log(llarp::eLogError, LOG_TAG, __LINE__, __VA_ARGS__) - -#define LogDebugTag(tag, ...) _log(llarp::eLogDebug, tag, __LINE__, __VA_ARGS__) -#define LogInfoTag(tag, ...) _log(llarp::eLogInfo, tag, __LINE__, __VA_ARGS__) -#define LogWarnTag(tag, ...) _log(llarp::eLogWarn, tag, __LINE__, __VA_ARGS__) -#define LogErrorTag(tag, ...) _log(llarp::eLogError, tag, __LINE__, __VA_ARGS__) - -#define LogDebugExplicit(tag, line, ...) _log(llarp::eLogDebug, tag, line, __VA_ARGS__) -#define LogInfoExplicit(tag, line, ...) _log(llarp::eLogInfo, tag, line __VA_ARGS__) -#define LogWarnExplicit(tag, line, ...) _log(llarp::eLogWarn, tag, line, __VA_ARGS__) -#define LogErrorExplicit(tag, line, ...) _log(llarp::eLogError, tag, line, __VA_ARGS__) - -// null-op Trace logging if this is a release build -#ifdef NDEBUG -#define LogTrace(...) _log_noop() -#define LogTraceTag(tag, ...) _log_noop() -#define LogTraceExplicit(tag, line, ...) _log_noop() -#else -#define LogTrace(...) _log(llarp::eLogTrace, LOG_TAG, __LINE__, __VA_ARGS__) -#define LogTraceTag(tag, ...) _log(llarp::eLogTrace, tag, __LINE__, __VA_ARGS__) -#define LogTraceExplicit(tag, line, ...) _log(llarp::eLogTrace, tag, line, __VA_ARGS__) -#endif - -#ifndef LOG_TAG -#define LOG_TAG "default" -#endif diff --git a/llarp/util/logging/logger_syslog.hpp b/llarp/util/logging/logger_syslog.hpp index 71d436451..dee7523de 100644 --- a/llarp/util/logging/logger_syslog.hpp +++ b/llarp/util/logging/logger_syslog.hpp @@ -11,12 +11,12 @@ namespace llarp PreLog( std::stringstream& s, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const override; void - Print(LogLevel lvl, const char* tag, const std::string& msg) override; + Print(LogLevel lvl, std::string_view tag, const std::string& msg) override; void PostLog(std::stringstream& ss) const override; diff --git a/llarp/util/logging/logstream.hpp b/llarp/util/logging/logstream.hpp index e7b0767a4..d5e00d90d 100644 --- a/llarp/util/logging/logstream.hpp +++ b/llarp/util/logging/logstream.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace llarp { @@ -18,12 +19,12 @@ namespace llarp PreLog( std::stringstream& out, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const = 0; virtual void - Print(LogLevel lvl, const char* filename, const std::string& msg) = 0; + Print(LogLevel lvl, std::string_view filename, const std::string& msg) = 0; virtual void PostLog(std::stringstream& out) const = 0; @@ -31,16 +32,16 @@ namespace llarp virtual void AppendLog( LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename, const std::string msg) { std::stringstream ss; - PreLog(ss, lvl, fname, lineno, nodename); + PreLog(ss, lvl, filename, lineno, nodename); ss << msg; PostLog(ss); - Print(lvl, fname, ss.str()); + Print(lvl, filename, ss.str()); } /// A blocking call to flush to disk. Should only be called in rare circumstances. diff --git a/llarp/util/logging/ostream_logger.cpp b/llarp/util/logging/ostream_logger.cpp index 2b81fbc7f..15078e870 100644 --- a/llarp/util/logging/ostream_logger.cpp +++ b/llarp/util/logging/ostream_logger.cpp @@ -11,7 +11,7 @@ namespace llarp OStreamLogStream::PreLog( std::stringstream& ss, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const { @@ -38,7 +38,7 @@ namespace llarp } ss << "[" << LogLevelToString(lvl) << "] "; ss << "[" << nodename << "]" - << "(" << thread_id_string() << ") " << log_timestamp() << " " << fname << ":" << lineno + << "(" << thread_id_string() << ") " << log_timestamp() << " " << filename << ":" << lineno << "\t"; } @@ -51,7 +51,7 @@ namespace llarp } void - OStreamLogStream::Print(LogLevel, const char*, const std::string& msg) + OStreamLogStream::Print(LogLevel, std::string_view, const std::string& msg) { m_Out << msg << std::flush; } diff --git a/llarp/util/logging/ostream_logger.hpp b/llarp/util/logging/ostream_logger.hpp index fa92ab988..5961447e4 100644 --- a/llarp/util/logging/ostream_logger.hpp +++ b/llarp/util/logging/ostream_logger.hpp @@ -15,12 +15,12 @@ namespace llarp PreLog( std::stringstream& s, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const override; virtual void - Print(LogLevel lvl, const char* tag, const std::string& msg) override; + Print(LogLevel lvl, std::string_view tag, const std::string& msg) override; void PostLog(std::stringstream& ss) const override; diff --git a/llarp/util/logging/source_location.hpp b/llarp/util/logging/source_location.hpp new file mode 100644 index 000000000..35f5cc7fc --- /dev/null +++ b/llarp/util/logging/source_location.hpp @@ -0,0 +1,53 @@ +#pragma once + +#ifdef __cpp_lib_source_location +#include +namespace slns = std; +#else +namespace slns +{ + struct source_location + { + public: + static constexpr source_location + current( + const char* fileName = __builtin_FILE(), + const char* functionName = __builtin_FUNCTION(), + const uint_least32_t lineNumber = __builtin_LINE()) noexcept + { + return source_location{fileName, functionName, lineNumber}; + } + + source_location(const source_location&) = default; + source_location(source_location&&) = default; + + constexpr const char* + file_name() const noexcept + { + return fileName; + } + + constexpr const char* + function_name() const noexcept + { + return functionName; + } + + constexpr uint_least32_t + line() const noexcept + { + return lineNumber; + } + + private: + constexpr explicit source_location( + const char* fileName, const char* functionName, const uint_least32_t lineNumber) noexcept + : fileName(fileName), functionName(functionName), lineNumber(lineNumber) + {} + + const char* const fileName; + const char* const functionName; + const uint_least32_t lineNumber; + }; +} // namespace slns +#endif diff --git a/llarp/util/logging/syslog_logger.cpp b/llarp/util/logging/syslog_logger.cpp index 4c98fe0d9..feb124806 100644 --- a/llarp/util/logging/syslog_logger.cpp +++ b/llarp/util/logging/syslog_logger.cpp @@ -10,18 +10,18 @@ namespace llarp SysLogStream::PreLog( std::stringstream& ss, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const { ss << "[" << LogLevelToString(lvl) << "] "; ss << "[" << nodename << "]" - << "(" << thread_id_string() << ") " << log_timestamp() << " " << fname << ":" << lineno + << "(" << thread_id_string() << ") " << log_timestamp() << " " << filename << ":" << lineno << "\t"; } void - SysLogStream::Print(LogLevel lvl, const char*, const std::string& msg) + SysLogStream::Print(LogLevel lvl, std::string_view, const std::string& msg) { switch (lvl) { diff --git a/llarp/util/logging/win32_logger.cpp b/llarp/util/logging/win32_logger.cpp index ee155bb30..2e0448c63 100644 --- a/llarp/util/logging/win32_logger.cpp +++ b/llarp/util/logging/win32_logger.cpp @@ -27,7 +27,7 @@ namespace llarp Win32LogStream::PreLog( std::stringstream& ss, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const { @@ -54,11 +54,11 @@ namespace llarp break; } ss << "[" << nodename << "]" - << "(" << thread_id_string() << ") " << log_timestamp() << " " << fname << ":" << lineno + << "(" << thread_id_string() << ") " << log_timestamp() << " " << filename << ":" << lineno << "\t"; } else - OStreamLogStream::PreLog(ss, lvl, fname, lineno, nodename); + OStreamLogStream::PreLog(ss, lvl, filename, lineno, nodename); } void @@ -71,7 +71,7 @@ namespace llarp } void - Win32LogStream::Print(LogLevel lvl, const char*, const std::string& msg) + Win32LogStream::Print(LogLevel lvl, std::string_view, const std::string& msg) { if (!isConsoleModern) { diff --git a/llarp/util/logging/win32_logger.hpp b/llarp/util/logging/win32_logger.hpp index df9e99427..2be5e5609 100644 --- a/llarp/util/logging/win32_logger.hpp +++ b/llarp/util/logging/win32_logger.hpp @@ -14,7 +14,7 @@ namespace llarp PreLog( std::stringstream& s, LogLevel lvl, - const char* fname, + std::string_view filename, int lineno, const std::string& nodename) const override; @@ -24,7 +24,7 @@ namespace llarp void Tick(llarp_time_t) override{}; void - Print(LogLevel lvl, const char*, const std::string& msg) override; + Print(LogLevel lvl, std::string_view, const std::string& msg) override; private: std::ostream& m_Out; diff --git a/llarp/util/str.hpp b/llarp/util/str.hpp index 2fdebe838..c90781c9f 100644 --- a/llarp/util/str.hpp +++ b/llarp/util/str.hpp @@ -70,6 +70,15 @@ namespace llarp return str.size() >= suffix.size() && str.substr(str.size() - suffix.size()) == suffix; } + /// removes a prefix from a string if it exists + inline std::string_view + strip_prefix(std::string_view str, std::string_view prefix) + { + if (starts_with(str, prefix)) + return str.substr(prefix.size()); + return str; + } + /// Splits a string on some delimiter string and returns a vector of string_view's pointing into /// the pieces of the original string. The pieces are valid only as long as the original string /// remains valid. Leading and trailing empty substrings are not removed. If delim is empty you diff --git a/llarp/vpn/linux.hpp b/llarp/vpn/linux.hpp index 5401ef10a..0f47636e9 100644 --- a/llarp/vpn/linux.hpp +++ b/llarp/vpn/linux.hpp @@ -57,7 +57,6 @@ namespace llarp::vpn control.ioctl(SIOCGIFINDEX, &ifr); const int ifindex = ifr.ifr_ifindex; - IOCTL control6{AF_INET6}; for (const auto& ifaddr : m_Info.addrs) { if (ifaddr.fam == AF_INET) @@ -78,9 +77,9 @@ namespace llarp::vpn ifr6.ifindex = ifindex; try { - control6.ioctl(SIOCSIFADDR, &ifr6); + IOCTL{AF_INET6}.ioctl(SIOCSIFADDR, &ifr6); } - catch (permission_error& ex) + catch (std::exception& ex) { LogError("we are not allowed to use IPv6 on this system: ", ex.what()); } diff --git a/llarp/vpn/win32.hpp b/llarp/vpn/win32.hpp index 06e2c8297..9ecd15e79 100644 --- a/llarp/vpn/win32.hpp +++ b/llarp/vpn/win32.hpp @@ -205,7 +205,7 @@ namespace llarp::vpn NetSH(std::string commands) { commands = NetSHCommand() + " interface IPv6 " + commands; - LogInfo(commands); + LogInfo("exec: ", commands); ::system(commands.c_str()); } @@ -500,7 +500,7 @@ namespace llarp::vpn void Execute(std::string cmd) const { - LogInfo(cmd); + llarp::LogInfo("exec: ", cmd); ::system(cmd.c_str()); } diff --git a/pybind/CMakeLists.txt b/pybind/CMakeLists.txt index a8706ff50..c2b46ce6e 100644 --- a/pybind/CMakeLists.txt +++ b/pybind/CMakeLists.txt @@ -18,4 +18,4 @@ pybind11_add_module(pyllarp MODULE ) target_link_libraries(pyllarp PUBLIC liblokinet) target_include_directories(pyllarp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - +add_log_tag(pyllarp) diff --git a/readme.md b/readme.md index 42b339e53..bd4e7a722 100644 --- a/readme.md +++ b/readme.md @@ -26,6 +26,7 @@ Build requirements: * libcurl (for lokinet-bootstrap) * libunbound * libzmq +* cppzmq * sqlite3 ### Linux @@ -42,12 +43,17 @@ You can install these using: If you are not on a platform supported by the debian packages or if you want to build a dev build, this is the most "portable" way to do it: - $ sudo apt install build-essential cmake git libcap-dev pkg-config automake libtool + $ sudo apt install build-essential cmake git libcap-dev pkg-config automake libtool libuv1-dev libsodium-dev libzmq3-dev libcurl4-openssl-dev libevent-dev nettle-dev libunbound-dev libsqlite3-dev $ git clone --recursive https://github.com/oxen-io/lokinet $ cd lokinet $ mkdir build $ cd build - $ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON + $ cmake .. -DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release + $ make -j$(nproc) + +If you dont want to do a static build install the dependancies and run: + + $ cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF $ make -j$(nproc) install: @@ -56,13 +62,9 @@ install: ### macOS -You can get the latest stable macos relase from https://lokinet.org/ or check the releases page on github. +Lokinet ~~is~~ will be available on the Apple App store. -alternatively you can build from source, make sure you have cmake, libuv and xcode command line tools installed: - - $ git clone --recursive https://github.com/oxen-io/lokinet - $ cd lokinet - $ ./contrib/mac.sh -DCODESIGN_KEY='insert your key identity here' -DCODESIGN_TEAM_ID='team id here' +Source code compilation of Lokinet by end users is not supported or permitted by apple on their platforms, see [this](contrib/macos/README.txt) for more information. If you find this disagreeable consider using a platform that permits compiling from source. ### Windows @@ -77,7 +79,7 @@ additional build requirements: setup: - $ sudo apt install build-essential cmake git pkg-config mingw-w64 nsis ninja-build + $ sudo apt install build-essential cmake git pkg-config mingw-w64 nsis cpack automake libtool building: @@ -85,30 +87,6 @@ building: $ cd lokinet $ ./contrib/windows.sh -### Solaris 2.10+ - -NOTE: Oracle Solaris users need to download/compile the TAP driver from http://www.whiteboard.ne.jp/~admin2/tuntap/ - -The generated binaries _may_ work on Solaris 2.10 or earlier, you're on your own. (Recommended: `-static-libstdc++ -static-libgcc`, and the TAP driver if not already installed on the target system.) - -Building on a v2.10 or earlier system is unsupported, and may not even work; recent GCC releases have progressively dropped support for older system releases. - -build: - - $ sudo pkg install build-essential gcc8 wget tuntap cmake (optional: ninja ccache - from omnios extra) (OmniOS CE) - $ sudo pkg install base-developer-utilities developer-gnu developer-studio-utilities gcc-7 wget cmake (Oracle Solaris, see note) - $ sudo pkg install build-essential wget gcc-8 documentation/tuntap header-tun tun (optional: ninja ccache) (all other SunOS) - $ git clone --recursive https://github.com/oxen-io/lokinet - $ cd lokinet - $ mkdir build - $ cd build - $ cmake .. - $ make -j$(nproc) - -install: - - $ sudo make install - ### FreeBSD build: @@ -131,24 +109,16 @@ install (root): When running from debian package the following steps are not needed as it is already ready to use. -## Create default config - -to configure as client: - - $ lokinet -g - $ lokinet-bootstrap - -to configure as relay: - - $ lokinet -r -g - $ lokinet-bootstrap - - -## Running on Linux +## Running on Linux (without debs) **DO NOT RUN AS ROOT**, run as normal user. -to run, after you create default config: +set up the initial configs: + + $ lokinet -g + $ lokinet-bootstrap + +after you create default config, run it: $ lokinet diff --git a/readme_es.md b/readme_es.md index f71dee8f8..29b333f50 100644 --- a/readme_es.md +++ b/readme_es.md @@ -73,6 +73,7 @@ Requerimientos de compilación: * libsodium >= 1.0.18 * libunbound * libzmq +* cppzmq * sqlite3 ### Linux diff --git a/readme_ru.md b/readme_ru.md index 73652328d..dde90a6e7 100644 --- a/readme_ru.md +++ b/readme_ru.md @@ -64,6 +64,7 @@ Lokinet - реализация LLARP (протокол анонимной мар * libsodium >= 1.0.18 * libunbound * libzmq +* cppzmq * sqlite3 ### Linux diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 11c05aa5d..0c6c43870 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,7 +53,7 @@ add_executable(testAll target_link_libraries(testAll PUBLIC liblokinet Catch2::Catch2) target_include_directories(testAll PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - +add_log_tag(testAll) if(WIN32) target_sources(testAll PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/win32/test.rc") target_link_libraries(testAll PUBLIC ws2_32 iphlpapi shlwapi) diff --git a/test/Catch2 b/test/Catch2 index 81d52c4a5..dba29b60d 160000 --- a/test/Catch2 +++ b/test/Catch2 @@ -1 +1 @@ -Subproject commit 81d52c4a5ffc1e527ce158c7570aa94dadc8c002 +Subproject commit dba29b60d639bf8d206a9a12c223e6ed4284fb13 diff --git a/test/router/test_llarp_router_version.cpp b/test/router/test_llarp_router_version.cpp index 01adc3cdf..6230b2161 100644 --- a/test/router/test_llarp_router_version.cpp +++ b/test/router/test_llarp_router_version.cpp @@ -57,7 +57,7 @@ TEST_CASE("BEncode", "[RouterVersion]") CHECK(v1235.BEncode(&buf)); std::string s((const char*)buf.begin(), (buf.end() - buf.begin())); - LogInfo("bencoded: ", buf.begin()); + llarp::LogInfo("bencoded: ", buf.begin()); CHECK_THAT((const char*)buf.begin(), Equals("li5ei1ei2ei3ee")); }