Merge pull request #1923 from majestrate/replace-llarp-proto-verison-macros-2022-05-26

final fixups before 0.9.9 tag
pull/1924/head
majestrate 2 years ago committed by GitHub
commit 229e1277fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,7 +40,7 @@ local debian_pipeline(name,
extra_cmds=[], extra_cmds=[],
jobs=6, jobs=6,
tests=true, tests=true,
loki_repo=false, oxen_repo=false,
allow_fail=false) = { allow_fail=false) = {
kind: 'pipeline', kind: 'pipeline',
type: 'docker', type: 'docker',
@ -61,7 +61,7 @@ local debian_pipeline(name,
apt_get_quiet + ' update', apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata', apt_get_quiet + ' install -y eatmydata',
] + ( ] + (
if loki_repo then [ if oxen_repo then [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release', 'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d', 'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list', 'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
@ -180,7 +180,7 @@ local linux_cross_pipeline(name,
}; };
// Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch // Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch
local deb_builder(image, distro, distro_branch, arch='amd64', loki_repo=true) = { local deb_builder(image, distro, distro_branch, arch='amd64', oxen_repo=true) = {
kind: 'pipeline', kind: 'pipeline',
type: 'docker', type: 'docker',
name: 'DEB (' + distro + (if arch == 'amd64' then '' else '/' + arch) + ')', name: 'DEB (' + distro + (if arch == 'amd64' then '' else '/' + arch) + ')',
@ -197,7 +197,7 @@ local deb_builder(image, distro, distro_branch, arch='amd64', loki_repo=true) =
commands: [ commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"', 'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections', 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
] + (if loki_repo then [ ] + (if oxen_repo then [
'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d', 'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $${distro} main >/etc/apt/sources.list.d/oxen.list', 'echo deb http://deb.oxen.io $${distro} main >/etc/apt/sources.list.d/oxen.list',
] else []) + [ ] else []) + [
@ -338,7 +338,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
docker_base + 'ubuntu-bionic', docker_base + 'ubuntu-bionic',
deps=['g++-8'] + default_deps_nocxx, deps=['g++-8'] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8', cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8',
loki_repo=true), oxen_repo=true),
// ARM builds (ARM64 and armhf) // ARM builds (ARM64 and armhf)
debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64', jobs=4), debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64', jobs=4),
@ -366,6 +366,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
deps=['g++-8', 'python3-dev', 'automake', 'libtool'], deps=['g++-8', 'python3-dev', 'automake', 'libtool'],
lto=true, lto=true,
tests=false, tests=false,
oxen_repo=true,
cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' + cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
'-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ' + '-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ' +
'-DCMAKE_CXX_FLAGS="-march=x86-64 -mtune=haswell" ' + '-DCMAKE_CXX_FLAGS="-march=x86-64 -mtune=haswell" ' +

@ -25,7 +25,7 @@ endif()
project(lokinet project(lokinet
VERSION 0.9.8 VERSION 0.9.9
DESCRIPTION "lokinet - IP packet onion router" DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES ${LANGS}) LANGUAGES ${LANGS})
@ -35,14 +35,7 @@ if(APPLE)
set(LOKINET_APPLE_BUILD 0) set(LOKINET_APPLE_BUILD 0)
endif() endif()
set(RELEASE_MOTTO "A Series of Tubes" CACHE STRING "Release motto") set(RELEASE_MOTTO "Gluten Free Edition" CACHE STRING "Release motto")
add_definitions(-DLLARP_VERSION_MAJOR=${lokinet_VERSION_MAJOR})
add_definitions(-DLLARP_VERSION_MINOR=${lokinet_VERSION_MINOR})
add_definitions(-DLLARP_VERSION_PATCH=${lokinet_VERSION_PATCH})
if(RELEASE_MOTTO AND CMAKE_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]")
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
@ -184,7 +177,7 @@ endif()
option(FORCE_OXENC_SUBMODULE "force using oxen-encoding submodule" OFF) option(FORCE_OXENC_SUBMODULE "force using oxen-encoding submodule" OFF)
if(NOT FORCE_OXENC_SUBMODULE) if(NOT FORCE_OXENC_SUBMODULE)
pkg_check_modules(OXENC liboxenc>=1.0.2 IMPORTED_TARGET) pkg_check_modules(OXENC liboxenc>=1.0.3 IMPORTED_TARGET)
endif() endif()
if(OXENC_FOUND) if(OXENC_FOUND)
@ -204,7 +197,7 @@ endif()
option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF) option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF)
if(NOT FORCE_OXENMQ_SUBMODULE) if(NOT FORCE_OXENMQ_SUBMODULE)
pkg_check_modules(OXENMQ liboxenmq>=1.2.4 IMPORTED_TARGET) pkg_check_modules(OXENMQ liboxenmq>=1.2.12 IMPORTED_TARGET)
endif() endif()
if(OXENMQ_FOUND) if(OXENMQ_FOUND)
add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ) add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ)

@ -57,4 +57,4 @@ else()
endif() endif()
endif() endif()
configure_file("${SRC}" "${DEST}") configure_file("${SRC}" "${DEST}" @ONLY)

@ -5,31 +5,31 @@
set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads") set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads")
set(OPENSSL_VERSION 1.1.1m CACHE STRING "openssl version") set(OPENSSL_VERSION 1.1.1o CACHE STRING "openssl version")
set(OPENSSL_MIRROR ${LOCAL_MIRROR} https://www.openssl.org/source CACHE STRING "openssl download mirror(s)") set(OPENSSL_MIRROR ${LOCAL_MIRROR} https://www.openssl.org/source CACHE STRING "openssl download mirror(s)")
set(OPENSSL_SOURCE openssl-${OPENSSL_VERSION}.tar.gz) set(OPENSSL_SOURCE openssl-${OPENSSL_VERSION}.tar.gz)
set(OPENSSL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96 set(OPENSSL_HASH SHA256=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f
CACHE STRING "openssl source hash") CACHE STRING "openssl source hash")
set(EXPAT_VERSION 2.4.4 CACHE STRING "expat version") set(EXPAT_VERSION 2.4.8 CACHE STRING "expat version")
string(REPLACE "." "_" EXPAT_TAG "R_${EXPAT_VERSION}") string(REPLACE "." "_" EXPAT_TAG "R_${EXPAT_VERSION}")
set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG} set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG}
CACHE STRING "expat download mirror(s)") CACHE STRING "expat download mirror(s)")
set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz) set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz)
set(EXPAT_HASH SHA256=b5d25d6e373351c2ed19b562b4732d01d2589ac8c8e9e7962d8df1207cc311b8 set(EXPAT_HASH SHA256=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25
CACHE STRING "expat source hash") CACHE STRING "expat source hash")
set(UNBOUND_VERSION 1.14.0 CACHE STRING "unbound version") set(UNBOUND_VERSION 1.15.0 CACHE STRING "unbound version")
set(UNBOUND_MIRROR ${LOCAL_MIRROR} https://nlnetlabs.nl/downloads/unbound CACHE STRING "unbound download mirror(s)") set(UNBOUND_MIRROR ${LOCAL_MIRROR} https://nlnetlabs.nl/downloads/unbound CACHE STRING "unbound download mirror(s)")
set(UNBOUND_SOURCE unbound-${UNBOUND_VERSION}.tar.gz) set(UNBOUND_SOURCE unbound-${UNBOUND_VERSION}.tar.gz)
set(UNBOUND_HASH SHA256=6ef91cbf02d5299eab39328c0857393de7b4885a2fe7233ddfe3c124ff5a89c8 set(UNBOUND_HASH SHA256=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f
CACHE STRING "unbound source hash") CACHE STRING "unbound source hash")
set(SQLITE3_VERSION 3370200 CACHE STRING "sqlite3 version") set(SQLITE3_VERSION 3380500 CACHE STRING "sqlite3 version")
set(SQLITE3_MIRROR ${LOCAL_MIRROR} https://www.sqlite.org/2022 set(SQLITE3_MIRROR ${LOCAL_MIRROR} https://www.sqlite.org/2022
CACHE STRING "sqlite3 download mirror(s)") CACHE STRING "sqlite3 download mirror(s)")
set(SQLITE3_SOURCE sqlite-autoconf-${SQLITE3_VERSION}.tar.gz) set(SQLITE3_SOURCE sqlite-autoconf-${SQLITE3_VERSION}.tar.gz)
set(SQLITE3_HASH SHA3_256=3764f471d188ef4e7a70a120f6cb80014dc50bb5fa53406b566508390a32e745 set(SQLITE3_HASH SHA3_256=ab649fea76f49a6ec7f907f001d87b8bd76dec0679c783e3992284c5a882a98c
CACHE STRING "sqlite3 source hash") CACHE STRING "sqlite3 source hash")
set(SODIUM_VERSION 1.0.18 CACHE STRING "libsodium version") set(SODIUM_VERSION 1.0.18 CACHE STRING "libsodium version")
@ -62,11 +62,11 @@ set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_HASH SHA256=91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9 set(ZLIB_HASH SHA256=91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
CACHE STRING "zlib source hash") CACHE STRING "zlib source hash")
set(CURL_VERSION 7.81.0 CACHE STRING "curl version") set(CURL_VERSION 7.83.1 CACHE STRING "curl version")
set(CURL_MIRROR ${LOCAL_MIRROR} https://curl.haxx.se/download https://curl.askapache.com set(CURL_MIRROR ${LOCAL_MIRROR} https://curl.haxx.se/download https://curl.askapache.com
CACHE STRING "curl mirror(s)") CACHE STRING "curl mirror(s)")
set(CURL_SOURCE curl-${CURL_VERSION}.tar.xz) set(CURL_SOURCE curl-${CURL_VERSION}.tar.xz)
set(CURL_HASH SHA256=a067b688d1645183febc31309ec1f3cdce9213d02136b6a6de3d50f69c95a7d3 set(CURL_HASH SHA256=2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4
CACHE STRING "curl source hash") CACHE STRING "curl source hash")
include(ExternalProject) include(ExternalProject)

@ -1,22 +1,41 @@
# We do this via a custom command that re-invokes a cmake script because we need the DEPENDS on .git/index so that we will re-run it (to regenerate the commit tag in the version) whenever the current commit changes. If we used a configure_file directly here, it would only re-run when something else causes cmake to re-run.
find_package(Git QUIET) set(VERSIONTAG "${GIT_VERSION}")
set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index") set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) ) find_package(Git)
if(EXISTS "${GIT_INDEX_FILE}" AND ( GIT_FOUND OR Git_FOUND) )
message(STATUS "Found Git: ${GIT_EXECUTABLE}") message(STATUS "Found Git: ${GIT_EXECUTABLE}")
set(genversion_args "-DGIT=${GIT_EXECUTABLE}")
foreach(v lokinet_VERSION lokinet_VERSION_MAJOR lokinet_VERSION_MINOR lokinet_VERSION_PATCH RELEASE_MOTTO)
list(APPEND genversion_args "-D${v}=${${v}}")
endforeach()
add_custom_command( add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}" ${genversion_args}
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" "-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake" "-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"${GIT_INDEX_FILE}") "${GIT_INDEX_FILE}")
else() else()
message(STATUS "Git was not found! Setting version to to nogit") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
set(VERSIONTAG "nogit")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
endif() endif()
add_custom_target(genversion DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
if(WIN32)
foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap)
set(lokinet_EXE_NAME "${exe}.exe")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY)
set_property(SOURCE "${CMAKE_BINARY_DIR}/${exe}.rc" PROPERTY GENERATED 1)
endforeach()
endif()
add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
if(WIN32)
add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/lokinet.rc" "${CMAKE_BINARY_DIR}/lokinet-vpn.rc" "${CMAKE_BINARY_DIR}/lokinet-bootstrap.rc")
else()
add_custom_target(genversion_rc)
endif()
add_custom_target(genversion DEPENDS genversion_cpp genversion_rc)

@ -27,14 +27,26 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet")
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/win32-setup/lokinet.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/win32-setup/lokinet.ico")
set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin") set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ifFileExists $INSTDIR\\\\bin\\\\tuntap-install.exe 0 +2\\nExecWait '$INSTDIR\\\\bin\\\\tuntap-install.exe /S'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe --install'\\nExecWait 'sc failure lokinet reset= 60 actions= restart/1000'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe -g C:\\\\ProgramData\\\\lokinet\\\\lokinet.ini'\\nCopyFiles '$INSTDIR\\\\share\\\\bootstrap.signed' C:\\\\ProgramData\\\\lokinet\\\\bootstrap.signed\\n")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "ExecWait 'net stop lokinet'\\nExecWait 'taskkill /f /t /im lokinet-gui.exe'\\nExecWait '$INSTDIR\\\\bin\\\\lokinet.exe --remove'\\nRMDir /r /REBOOTOK C:\\\\ProgramData\\\\lokinet")
set(CPACK_NSIS_CREATE_ICONS_EXTRA function(read_nsis_file filename outvar)
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Lokinet.lnk' '$INSTDIR\\\\share\\\\gui\\\\lokinet-gui.exe'" file(STRINGS "${filename}" _outvar)
) list(TRANSFORM _outvar REPLACE "\\\\" "\\\\\\\\")
set(CPACK_NSIS_DELETE_ICONS_EXTRA list(JOIN _outvar "\\n" out)
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Lokinet.lnk'" set(${outvar} ${out} PARENT_SCOPE)
) endfunction()
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_preinstall.nsis" _extra_preinstall)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_install.nsis" _extra_install)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_uninstall.nsis" _extra_uninstall)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_create_icons.nsis" _extra_create_icons)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_delete_icons.nsis" _extra_delete_icons)
set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "${_extra_preinstall}")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${_extra_install}")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${_extra_uninstall}")
set(CPACK_NSIS_CREATE_ICONS_EXTRA "${_extra_create_icons}")
set(CPACK_NSIS_DELETE_ICONS_EXTRA "${_extra_delete_icons}")
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified") list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified")

@ -17,7 +17,7 @@ cmake \
-DBUILD_PACKAGE=ON \ -DBUILD_PACKAGE=ON \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \ -DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=ON \ -DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \ -DWITH_TESTS=OFF \
-DNATIVE_BUILD=OFF \ -DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \ -DSTATIC_LINK=ON \

@ -49,7 +49,7 @@ endif()
foreach(exe ${exetargets}) foreach(exe ${exetargets})
if(WIN32 AND NOT MSVC_VERSION) if(WIN32 AND NOT MSVC_VERSION)
target_sources(${exe} PRIVATE ../llarp/win32/version.rc) target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/${exe}.rc)
target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00) target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00)
target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi) target_link_libraries(${exe} PRIVATE ws2_32 iphlpapi)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")

@ -1 +1 @@
Subproject commit b48aef693b39a2408931c4ba25580648423c81a7 Subproject commit 79193e58fb26624d40cd2e95156f78160f2b9b3e

2
external/oxen-mq vendored

@ -1 +1 @@
Subproject commit 5c72a57eca120750ecf557ce5a668fb38242956b Subproject commit eadb37c7654150bef18497773718f15ef843734a

@ -1,13 +1,9 @@
#pragma once #pragma once
#ifndef LLARP_PROTO_VERSION namespace llarp::constants
#define LLARP_PROTO_VERSION (0) {
#endif /// current network wide protocol version
// TODO: enum class
constexpr auto proto_version = 0;
#ifndef LLARP_ETH_PROTO } // namespace llarp::constants
#define LLARP_ETH_PROTO (0xD1CE)
#endif
#ifndef LLARP_KEYFILE_VERSION
#define LLARP_KEYFILE_VERSION (1)
#endif

@ -1,27 +1,16 @@
#include <constants/version.hpp> #include <constants/version.hpp>
#include <constants/version.h>
#include <constants/proto.hpp> #include <constants/proto.hpp>
// clang-format off
#define LLARP_STRINGIFY2(val) #val
#define LLARP_STRINGIFY(val) LLARP_STRINGIFY2(val)
#define LLARP_VERSION_STR \
LLARP_STRINGIFY(LLARP_VERSION_MAJOR) \
"." LLARP_STRINGIFY(LLARP_VERSION_MINOR) "." LLARP_STRINGIFY( \
LLARP_VERSION_PATCH)
#define LLARP_VERSION_FULL LLARP_VERSION_STR "-@VERSIONTAG@"
namespace llarp namespace llarp
{ {
// clang-format off // clang-format off
const std::array<uint16_t, 3> VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; const std::array<uint16_t, 3> VERSION{{@lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}};
const std::array<uint64_t, 4> ROUTER_VERSION{{LLARP_PROTO_VERSION, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}}; const std::array<uint64_t, 4> ROUTER_VERSION{{llarp::constants::proto_version, @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}};
const char* const VERSION_STR = LLARP_VERSION_STR; const char* const VERSION_STR = "@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@";
const char* const VERSION_TAG = "@VERSIONTAG@"; const char* const VERSION_TAG = "@VERSIONTAG@";
const char* const VERSION_FULL = LLARP_NAME "-" LLARP_VERSION_STR "-@VERSIONTAG@"; const char* const VERSION_FULL = "lokinet-@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@-@VERSIONTAG@";
const char* const RELEASE_MOTTO = LLARP_RELEASE_MOTTO; const char* const RELEASE_MOTTO = "@RELEASE_MOTTO@";
const char* const DEFAULT_NETID = LLARP_DEFAULT_NETID; const char* const DEFAULT_NETID = "lokinet";
// clang-format on // clang-format on
} // namespace llarp } // namespace llarp

@ -1,24 +0,0 @@
#pragma once
// Don't include this file directly but rather go through version.hpp instead.
// This is only here so version.cpp.in and the weird archaic windows build
// recipies can use the version.
#define LLARP_NAME "lokinet"
#define LLARP_DEFAULT_NETID "lokinet"
#ifndef LLARP_RELEASE_MOTTO
#define LLARP_RELEASE_MOTTO "(dev build)"
#endif
#if defined(_WIN32) && defined(RC_INVOKED)
#define LLARP_VERSION LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH, 0
#define MAKE_TRIPLET(X, Y, Z) TRIPLET_CAT(X, ., Y, ., Z)
#define TRIPLET_CAT(X, D1, Y, D2, Z) X##D1##Y##D2##Z
#define LLARP_VERSION_TRIPLET \
MAKE_TRIPLET(LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH)
#endif

@ -34,7 +34,7 @@ namespace llarp
Key_t From; Key_t From;
PathID_t pathID; PathID_t pathID;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
}; };
IMessage::Ptr_t IMessage::Ptr_t

@ -28,7 +28,7 @@ namespace llarp
if (!BEncodeMaybeReadDictInt("T", txID, read, k, val)) if (!BEncodeMaybeReadDictInt("T", txID, read, k, val))
return false; return false;
if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, k, val)) if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, k, val))
return false; return false;
return read; return read;
@ -66,7 +66,7 @@ namespace llarp
if (!BEncodeWriteDictInt("T", txID, buf)) if (!BEncodeWriteDictInt("T", txID, buf))
return false; return false;
// protocol version // protocol version
if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf))
return false; return false;
return bencode_end(buf); return bencode_end(buf);

@ -73,7 +73,7 @@ namespace llarp
return bencode_read_integer(val, &txid); return bencode_read_integer(val, &txid);
} }
bool read = false; bool read = false;
if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, key, val)) if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, key, val))
return false; return false;
return read; return read;

@ -30,7 +30,7 @@ namespace llarp
/// gossip message /// gossip message
GotRouterMessage(const RouterContact rc) : IMessage({}), foundRCs({rc}), txid(0) GotRouterMessage(const RouterContact rc) : IMessage({}), foundRCs({rc}), txid(0)
{ {
version = LLARP_PROTO_VERSION; version = llarp::constants::proto_version;
} }
GotRouterMessage(const GotRouterMessage& other) GotRouterMessage(const GotRouterMessage& other)

@ -195,7 +195,7 @@ namespace llarp
return false; return false;
if (!BEncodeWriteDictInt("T", txID, buf)) if (!BEncodeWriteDictInt("T", txID, buf))
return false; return false;
if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf))
return false; return false;
return bencode_end(buf); return bencode_end(buf);
} }

@ -11,7 +11,7 @@ namespace llarp
uint64_t proto = 0; uint64_t proto = 0;
uint64_t port = 0; uint64_t port = 0;
uint64_t drop = 0; uint64_t drop = 0;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
bool bool
BDecode(llarp_buffer_t* buf) BDecode(llarp_buffer_t* buf)

@ -24,7 +24,7 @@ namespace llarp
} }
// randomize nounce // randomize nounce
CryptoManager::instance()->randbytes(pkt.data() + HMACSIZE, TUNNONCESIZE); CryptoManager::instance()->randbytes(pkt.data() + HMACSIZE, TUNNONCESIZE);
pkt[PacketOverhead] = LLARP_PROTO_VERSION; pkt[PacketOverhead] = llarp::constants::proto_version;
pkt[PacketOverhead + 1] = cmd; pkt[PacketOverhead + 1] = cmd;
return pkt; return pkt;
} }
@ -653,10 +653,13 @@ namespace llarp
LogError("failed to decrypt session data from ", m_RemoteAddr); LogError("failed to decrypt session data from ", m_RemoteAddr);
continue; continue;
} }
if (pkt[PacketOverhead] != LLARP_PROTO_VERSION) if (pkt[PacketOverhead] != llarp::constants::proto_version)
{ {
LogError( LogError(
"protocol version mismatch ", int(pkt[PacketOverhead]), " != ", LLARP_PROTO_VERSION); "protocol version mismatch ",
int(pkt[PacketOverhead]),
" != ",
llarp::constants::proto_version);
itr = msgs.erase(itr); itr = msgs.erase(itr);
continue; continue;
} }

@ -20,7 +20,7 @@ namespace llarp
{ {
if (!bencode_read_integer(buf, &version)) if (!bencode_read_integer(buf, &version))
return false; return false;
return version == LLARP_PROTO_VERSION; return version == llarp::constants::proto_version;
} }
// bad key // bad key
return false; return false;
@ -54,7 +54,7 @@ namespace llarp
return false; return false;
// protocol version // protocol version
if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version))
return false; return false;
return bencode_end(buf); return bencode_end(buf);

@ -69,7 +69,7 @@ namespace llarp
DataDiscardMessage(const PathID_t& dst, uint64_t s) : P(dst) DataDiscardMessage(const PathID_t& dst, uint64_t s) : P(dst)
{ {
S = s; S = s;
version = LLARP_PROTO_VERSION; version = llarp::constants::proto_version;
} }
void void

@ -43,9 +43,10 @@ namespace llarp
{ {
if (!bencode_read_integer(buf, &version)) if (!bencode_read_integer(buf, &version))
return false; return false;
if (version != LLARP_PROTO_VERSION) if (version != llarp::constants::proto_version)
{ {
llarp::LogWarn("llarp protocol version mismatch ", version, " != ", LLARP_PROTO_VERSION); llarp::LogWarn(
"llarp protocol version mismatch ", version, " != ", llarp::constants::proto_version);
return false; return false;
} }
llarp::LogDebug("LIM version ", version); llarp::LogDebug("LIM version ", version);
@ -86,7 +87,7 @@ namespace llarp
if (!rc.BEncode(buf)) if (!rc.BEncode(buf))
return false; return false;
if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version))
return false; return false;
if (!bencode_write_bytestring(buf, "z", 1)) if (!bencode_write_bytestring(buf, "z", 1))

@ -17,7 +17,7 @@ namespace llarp
{ {
/// who did this message come from or is going to /// who did this message come from or is going to
ILinkSession* session = nullptr; ILinkSession* session = nullptr;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
PathID_t pathid; PathID_t pathid;

@ -25,7 +25,7 @@ namespace llarp
if (!BEncodeWriteDictEntry("p", pathid, buf)) if (!BEncodeWriteDictEntry("p", pathid, buf))
return false; return false;
if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf))
return false; return false;
if (!BEncodeWriteDictEntry("x", X, buf)) if (!BEncodeWriteDictEntry("x", X, buf))
return false; return false;
@ -40,7 +40,7 @@ namespace llarp
bool read = false; bool read = false;
if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf)) if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf))
return false; return false;
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf))
return false; return false;
if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf)) if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf))
return false; return false;
@ -79,7 +79,7 @@ namespace llarp
if (!BEncodeWriteDictEntry("p", pathid, buf)) if (!BEncodeWriteDictEntry("p", pathid, buf))
return false; return false;
if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf))
return false; return false;
if (!BEncodeWriteDictEntry("x", X, buf)) if (!BEncodeWriteDictEntry("x", X, buf))
return false; return false;
@ -94,7 +94,7 @@ namespace llarp
bool read = false; bool read = false;
if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf)) if (!BEncodeMaybeReadDictEntry("p", pathid, read, key, buf))
return false; return false;
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf))
return false; return false;
if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf)) if (!BEncodeMaybeReadDictEntry("x", X, read, key, buf))
return false; return false;

@ -29,7 +29,7 @@ namespace llarp
return BEncodeReadArray(frames, buf); return BEncodeReadArray(frames, buf);
} }
bool read = false; bool read = false;
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf))
return false; return false;
return read; return read;
@ -54,7 +54,7 @@ namespace llarp
if (!BEncodeWriteDictArray("c", frames, buf)) if (!BEncodeWriteDictArray("c", frames, buf))
return false; return false;
// version // version
if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version))
return false; return false;
return bencode_end(buf); return bencode_end(buf);
@ -102,9 +102,10 @@ namespace llarp
if (!BEncodeWriteDictEntry("u", *nextRC, buf)) if (!BEncodeWriteDictEntry("u", *nextRC, buf))
return false; return false;
} }
if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION))
if (not bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version))
return false; return false;
if (work && !BEncodeWriteDictEntry("w", *work, buf)) if (work and not BEncodeWriteDictEntry("w", *work, buf))
return false; return false;
return bencode_end(buf); return bencode_end(buf);
@ -135,7 +136,8 @@ namespace llarp
nextRC = std::make_unique<RouterContact>(); nextRC = std::make_unique<RouterContact>();
return nextRC->BDecode(buffer); return nextRC->BDecode(buffer);
} }
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, *key, buffer)) if (!BEncodeMaybeVerifyVersion(
"v", version, llarp::constants::proto_version, read, *key, buffer))
return false; return false;
if (*key == "w") if (*key == "w")
{ {

@ -80,7 +80,7 @@ namespace llarp
} }
else if (key == "v") else if (key == "v")
{ {
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, key, buf)) if (!BEncodeMaybeVerifyVersion("v", version, llarp::constants::proto_version, read, key, buf))
{ {
return false; return false;
} }
@ -115,7 +115,7 @@ namespace llarp
if (!BEncodeWriteDictInt("s", status, buf)) if (!BEncodeWriteDictInt("s", status, buf))
return false; return false;
// version // version
if (!bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION)) if (!bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version))
return false; return false;
return bencode_end(buf); return bencode_end(buf);
@ -190,7 +190,7 @@ namespace llarp
LR_StatusRecord record; LR_StatusRecord record;
record.status = newStatus; record.status = newStatus;
record.version = LLARP_PROTO_VERSION; record.version = llarp::constants::proto_version;
llarp_buffer_t buf(frame.data(), frame.size()); llarp_buffer_t buf(frame.data(), frame.size());
buf.cur = buf.base + EncryptedFrameOverheadSize; buf.cur = buf.base + EncryptedFrameOverheadSize;
@ -256,7 +256,8 @@ namespace llarp
LR_StatusRecord::BEncode(llarp_buffer_t* buf) const LR_StatusRecord::BEncode(llarp_buffer_t* buf) const
{ {
return bencode_start_dict(buf) && BEncodeWriteDictInt("s", status, buf) return bencode_start_dict(buf) && BEncodeWriteDictInt("s", status, buf)
&& bencode_write_uint64_entry(buf, "v", 1, LLARP_PROTO_VERSION) && bencode_end(buf); && bencode_write_uint64_entry(buf, "v", 1, llarp::constants::proto_version)
&& bencode_end(buf);
} }
bool bool
@ -269,7 +270,8 @@ namespace llarp
if (!BEncodeMaybeReadDictInt("s", status, read, *key, buffer)) if (!BEncodeMaybeReadDictInt("s", status, read, *key, buffer))
return false; return false;
if (!BEncodeMaybeVerifyVersion("v", version, LLARP_PROTO_VERSION, read, *key, buffer)) if (!BEncodeMaybeVerifyVersion(
"v", version, llarp::constants::proto_version, read, *key, buffer))
return false; return false;
return read; return read;

@ -105,7 +105,7 @@ namespace llarp
{ {
if (!bencode_read_integer(buf, &i)) if (!bencode_read_integer(buf, &i))
return false; return false;
return i == LLARP_PROTO_VERSION; return i == llarp::constants::proto_version;
} }
// bad key // bad key
@ -149,7 +149,7 @@ namespace llarp
return false; return false;
/** version */ /** version */
if (!bencode_write_uint64_entry(buff, "v", 1, LLARP_PROTO_VERSION)) if (!bencode_write_uint64_entry(buff, "v", 1, llarp::constants::proto_version))
return false; return false;
/** end */ /** end */
return bencode_end(buff); return bencode_end(buff);

@ -27,7 +27,7 @@ namespace llarp
llarp::PubKey pubkey; llarp::PubKey pubkey;
in6_addr ip = {}; in6_addr ip = {};
uint16_t port; uint16_t port;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
bool bool
BDecode(llarp_buffer_t* buf) BDecode(llarp_buffer_t* buf)

@ -21,7 +21,7 @@ namespace llarp
IpAddress ipAddress; IpAddress ipAddress;
IpAddress netmask; IpAddress netmask;
PubKey pubkey; PubKey pubkey;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
ExitInfo() = default; ExitInfo() = default;

@ -646,7 +646,7 @@ namespace llarp
llarp_buffer_t buf(tmp); llarp_buffer_t buf(tmp);
// should help prevent bad paths with uninitialized members // should help prevent bad paths with uninitialized members
// FIXME: Why would we get uninitialized IMessages? // FIXME: Why would we get uninitialized IMessages?
if (msg.version != LLARP_PROTO_VERSION) if (msg.version != llarp::constants::proto_version)
return false; return false;
if (!msg.BEncode(&buf)) if (!msg.BEncode(&buf))
{ {

@ -68,7 +68,7 @@ namespace llarp
} }
// build record // build record
record.lifetime = path::default_lifetime; record.lifetime = path::default_lifetime;
record.version = LLARP_PROTO_VERSION; record.version = llarp::constants::proto_version;
record.txid = hop.txID; record.txid = hop.txID;
record.rxid = hop.rxID; record.rxid = hop.rxID;
record.tunnelNonce = hop.nonce; record.tunnelNonce = hop.nonce;

@ -12,7 +12,7 @@ namespace llarp
llarp_time_t timestamp = 0s; llarp_time_t timestamp = 0s;
llarp_time_t extendedLifetime = 0s; llarp_time_t extendedLifetime = 0s;
AlignedBuffer<32> nonce; AlignedBuffer<32> nonce;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
~PoW(); ~PoW();

@ -20,7 +20,7 @@ namespace llarp
uint64_t pathTimeoutCount = 0; uint64_t pathTimeoutCount = 0;
llarp_time_t lastUpdated = 0s; llarp_time_t lastUpdated = 0s;
llarp_time_t lastDecay = 0s; llarp_time_t lastDecay = 0s;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
bool bool
BEncode(llarp_buffer_t* buf) const; BEncode(llarp_buffer_t* buf) const;

@ -1210,7 +1210,7 @@ namespace llarp
// set router version if service node // set router version if service node
if (IsServiceNode()) if (IsServiceNode())
{ {
_rc.routerVersion = RouterVersion(llarp::VERSION, LLARP_PROTO_VERSION); _rc.routerVersion = RouterVersion(llarp::VERSION, llarp::constants::proto_version);
} }
_linkManager.ForEachInboundLink([&](LinkLayer_ptr link) { _linkManager.ForEachInboundLink([&](LinkLayer_ptr link) {

@ -221,7 +221,7 @@ namespace llarp
routerVersion = std::optional<RouterVersion>{}; routerVersion = std::optional<RouterVersion>{};
last_updated = 0s; last_updated = 0s;
srvRecords.clear(); srvRecords.clear();
version = LLARP_PROTO_VERSION; version = llarp::constants::proto_version;
} }
util::StatusObject util::StatusObject

@ -101,7 +101,7 @@ namespace llarp
llarp::AlignedBuffer<NICKLEN> nickname; llarp::AlignedBuffer<NICKLEN> nickname;
llarp_time_t last_updated = 0s; llarp_time_t last_updated = 0s;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
std::optional<RouterVersion> routerVersion; std::optional<RouterVersion> routerVersion;
/// should we serialize the exit info? /// should we serialize the exit info?
const static bool serializeExit = true; const static bool serializeExit = true;

@ -57,7 +57,7 @@ namespace llarp
private: private:
Version_t m_Version = {{0, 0, 0}}; Version_t m_Version = {{0, 0, 0}};
int64_t m_ProtoVersion = LLARP_PROTO_VERSION; int64_t m_ProtoVersion = llarp::constants::proto_version;
}; };
inline std::ostream& inline std::ostream&

@ -39,7 +39,7 @@ namespace llarp
return false; return false;
if (!BEncodeWriteDictInt("S", S, buf)) if (!BEncodeWriteDictInt("S", S, buf))
return false; return false;
if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf))
return false; return false;
return bencode_end(buf); return bencode_end(buf);

@ -16,7 +16,7 @@ namespace llarp
{ {
PathID_t from; PathID_t from;
uint64_t S{0}; uint64_t S{0};
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
IMessage() = default; IMessage() = default;

@ -40,7 +40,7 @@ namespace llarp
if (!BEncodeWriteDictEntry("T", T, buf)) if (!BEncodeWriteDictEntry("T", T, buf))
return false; return false;
if (!BEncodeWriteDictInt("V", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("V", llarp::constants::proto_version, buf))
return false; return false;
if (!BEncodeWriteDictEntry("Y", Y, buf)) if (!BEncodeWriteDictEntry("Y", Y, buf))
return false; return false;

@ -70,7 +70,7 @@ namespace llarp
// set sender // set sender
self->msg.sender = self->m_LocalIdentity.pub; self->msg.sender = self->m_LocalIdentity.pub;
// set version // set version
self->msg.version = LLARP_PROTO_VERSION; self->msg.version = llarp::constants::proto_version;
// encrypt and sign // encrypt and sign
if (frame->EncryptAndSign(self->msg, K, self->m_LocalIdentity)) if (frame->EncryptAndSign(self->msg, K, self->m_LocalIdentity))
self->loop->call([self, frame] { AsyncKeyExchange::Result(self, frame); }); self->loop->call([self, frame] { AsyncKeyExchange::Result(self, frame); });

@ -22,7 +22,7 @@ namespace llarp
SecretKey signkey; SecretKey signkey;
PrivateKey derivedSignKey; PrivateKey derivedSignKey;
PQKeyPair pq; PQKeyPair pq;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
VanityNonce vanity; VanityNonce vanity;
// public service info // public service info

@ -56,7 +56,7 @@ namespace llarp
return false; return false;
if (!BEncodeWriteDictEntry("s", signkey, buf)) if (!BEncodeWriteDictEntry("s", signkey, buf))
return false; return false;
if (!BEncodeWriteDictInt("v", LLARP_PROTO_VERSION, buf)) if (!BEncodeWriteDictInt("v", llarp::constants::proto_version, buf))
return false; return false;
if (!vanity.IsZero()) if (!vanity.IsZero())
{ {

@ -20,7 +20,7 @@ namespace llarp
public: public:
VanityNonce vanity; VanityNonce vanity;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
void void
RandomizeVanity() RandomizeVanity()

@ -17,7 +17,7 @@ namespace llarp
PathID_t pathID; PathID_t pathID;
llarp_time_t latency = 0s; llarp_time_t latency = 0s;
llarp_time_t expiresAt = 0s; llarp_time_t expiresAt = 0s;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
util::StatusObject util::StatusObject
ExtractStatus() const; ExtractStatus() const;

@ -49,7 +49,7 @@ namespace llarp
std::optional<net::TrafficPolicy> exitTrafficPolicy; std::optional<net::TrafficPolicy> exitTrafficPolicy;
Signature signature; Signature signature;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
bool bool
OtherIsNewer(const IntroSet& other) const OtherIsNewer(const IntroSet& other) const

@ -191,7 +191,7 @@ namespace llarp
return false; return false;
if (!BEncodeMaybeReadDictEntry("T", T, read, key, val)) if (!BEncodeMaybeReadDictEntry("T", T, read, key, val))
return false; return false;
if (!BEncodeMaybeVerifyVersion("V", version, LLARP_PROTO_VERSION, read, key, val)) if (!BEncodeMaybeVerifyVersion("V", version, llarp::constants::proto_version, read, key, val))
return false; return false;
if (!BEncodeMaybeReadDictEntry("Z", Z, read, key, val)) if (!BEncodeMaybeReadDictEntry("Z", Z, read, key, val))
return false; return false;

@ -45,7 +45,7 @@ namespace llarp
Endpoint* handler = nullptr; Endpoint* handler = nullptr;
ConvoTag tag; ConvoTag tag;
uint64_t seqno = 0; uint64_t seqno = 0;
uint64_t version = LLARP_PROTO_VERSION; uint64_t version = llarp::constants::proto_version;
/// encode metainfo for lmq endpoint auth /// encode metainfo for lmq endpoint auth
std::vector<char> std::vector<char>
@ -155,7 +155,7 @@ namespace llarp
N.Zero(); N.Zero();
Z.Zero(); Z.Zero();
R = 0; R = 0;
version = LLARP_PROTO_VERSION; version = llarp::constants::proto_version;
} }
bool bool

@ -1,15 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by version.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -6,19 +6,16 @@
// //
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource.h"
#include <constants/version.h> // clang-format off
#define lokinet_VERSION @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@, 0
#ifdef __GNUC__ // make windows rc accept this #ifdef __GNUC__ // make windows rc accept this
#include <winresrc.h> #include <winresrc.h>
#endif #endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (United States) resources // English (United States) resources
#define STRINGIZER(version) #version
#define VERSION_STRING(version, codename, revision) \
STRINGIZER(version) "-release [" STRINGIZER(codename) "] (rev-" STRINGIZER(revision) ")"
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
LANGUAGE 1033,1 LANGUAGE 1033,1
@ -56,8 +53,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION LLARP_VERSION FILEVERSION lokinet_VERSION
PRODUCTVERSION LLARP_VERSION PRODUCTVERSION lokinet_VERSION
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x3L FILEFLAGS 0x3L
@ -72,15 +69,15 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "Comments", "includes relay/exit functionality, such code is highly experimental on non-Linux targets" VALUE "Comments", "This comment has invoked its 5th ammendment constitutional right to remain silent"
VALUE "CompanyName", "Loki Foundation" VALUE "CompanyName", "OPTF"
VALUE "FileDescription", "LokiNET daemon for Microsoft® Windows® NT™" VALUE "FileDescription", "LokiNET daemon for Windows"
VALUE "FileVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG) VALUE "FileVersion", "@lokinet_VERSION@"
VALUE "InternalName", "llarpd" VALUE "InternalName", "lokinet"
VALUE "LegalCopyright", "Copyright ©2018-2020 Jeff Becker, Rick V for the Loki Foundation. All rights reserved. This software is provided under the terms of the zlib-libpng licence; see the file LICENSE for details." VALUE "LegalCopyright", "Copyright (c) 2018-2022 Jeff Becker, Rick V for the OPTF. This software is provided under the terms of the GPL3; see the file LICENSE for details."
VALUE "OriginalFilename", "llarpd.exe" VALUE "OriginalFilename", "@lokinet_EXE_NAME@"
VALUE "ProductName", "LokiNET for Windows" VALUE "ProductName", "LokiNET for Windows"
VALUE "ProductVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG) VALUE "ProductVersion", "@lokinet_VERSION@"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

@ -24,14 +24,14 @@ TEST_CASE("Compatibility when protocol unequal", "[RouterVersion]")
TEST_CASE("Empty compatibility", "[RouterVersion]") TEST_CASE("Empty compatibility", "[RouterVersion]")
{ {
llarp::RouterVersion v1({0, 0, 1}, LLARP_PROTO_VERSION); llarp::RouterVersion v1({0, 0, 1}, llarp::constants::proto_version);
CHECK_FALSE(v1.IsCompatableWith(llarp::emptyRouterVersion)); CHECK_FALSE(v1.IsCompatableWith(llarp::emptyRouterVersion));
} }
TEST_CASE("IsEmpty", "[RouterVersion]") TEST_CASE("IsEmpty", "[RouterVersion]")
{ {
llarp::RouterVersion notEmpty({0, 0, 1}, LLARP_PROTO_VERSION); llarp::RouterVersion notEmpty({0, 0, 1}, llarp::constants::proto_version);
CHECK_FALSE(notEmpty.IsEmpty()); CHECK_FALSE(notEmpty.IsEmpty());
CHECK(llarp::emptyRouterVersion.IsEmpty()); CHECK(llarp::emptyRouterVersion.IsEmpty());
@ -39,7 +39,7 @@ TEST_CASE("IsEmpty", "[RouterVersion]")
TEST_CASE("Clear", "[RouterVersion]") TEST_CASE("Clear", "[RouterVersion]")
{ {
llarp::RouterVersion version({0, 0, 1}, LLARP_PROTO_VERSION); llarp::RouterVersion version({0, 0, 1}, llarp::constants::proto_version);
CHECK_FALSE(version.IsEmpty()); CHECK_FALSE(version.IsEmpty());
version.Clear(); version.Clear();

@ -28,6 +28,6 @@ TEST_CASE_METHOD(LlarpTest<>, "Sign-verify")
CHECK(msg.Sign(alice)); CHECK(msg.Sign(alice));
CHECK(msg.Verify()); CHECK(msg.Verify());
CHECK(msg.I == PubKey{seckey_topublic(alice)}); CHECK(msg.I == PubKey{seckey_topublic(alice)});
CHECK(msg.version == LLARP_PROTO_VERSION); CHECK(msg.version == llarp::constants::proto_version);
CHECK_FALSE(msg.Z.IsZero()); CHECK_FALSE(msg.Z.IsZero());
} }

@ -0,0 +1 @@
CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe'

@ -0,0 +1 @@
CreateShortCut '$SMPROGRAMS\$STARTMENU_FOLDER\Lokinet.lnk' '$INSTDIR\share\gui\lokinet-gui.exe'

@ -0,0 +1,7 @@
ifFileExists $INSTDIR\bin\tuntap-install.exe 0 +2
ExecWait '$INSTDIR\bin\tuntap-install.exe /S'
ExecWait '$INSTDIR\bin\lokinet.exe --install'
ExecWait 'sc failure lokinet reset= 60 actions= restart/1000'
ExecWait '$INSTDIR\bin\lokinet.exe -g C:\ProgramData\lokinet\lokinet.ini'
CopyFiles '$INSTDIR\share\bootstrap.signed' C:\ProgramData\lokinet\bootstrap.signed

@ -0,0 +1,6 @@
IfFileExists $INSTDIR\bin\lokinet.exe 0 +3
ExecWait 'net stop lokinet'
ExecWait '$INSTDIR\bin\lokinet.exe --remove'
IfFileExists $INSTDIR\share\gui\lokinet.exe 0 +2
ExecWait 'taskkill /f /t /im lokinet-gui.exe'

@ -0,0 +1,5 @@
ExecWait 'net stop lokinet'
ExecWait 'taskkill /f /t /im lokinet-gui.exe'
ExecWait '$INSTDIR\bin\lokinet.exe --remove'
RMDir /r /REBOOTOK C:\ProgramData\lokinet
Loading…
Cancel
Save