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

final fixups before 0.9.9 tag
This commit is contained in:
majestrate 2022-05-30 17:49:49 -04:00 committed by GitHub
commit 229e1277fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 184 additions and 188 deletions

View File

@ -40,7 +40,7 @@ local debian_pipeline(name,
extra_cmds=[],
jobs=6,
tests=true,
loki_repo=false,
oxen_repo=false,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
@ -61,7 +61,7 @@ local debian_pipeline(name,
apt_get_quiet + ' update',
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',
'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',
@ -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
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',
type: 'docker',
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: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'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',
'echo deb http://deb.oxen.io $${distro} main >/etc/apt/sources.list.d/oxen.list',
] else []) + [
@ -338,7 +338,7 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
docker_base + 'ubuntu-bionic',
deps=['g++-8'] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8',
loki_repo=true),
oxen_repo=true),
// ARM builds (ARM64 and armhf)
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'],
lto=true,
tests=false,
oxen_repo=true,
cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
'-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ' +
'-DCMAKE_CXX_FLAGS="-march=x86-64 -mtune=haswell" ' +

View File

@ -25,7 +25,7 @@ endif()
project(lokinet
VERSION 0.9.8
VERSION 0.9.9
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES ${LANGS})
@ -35,14 +35,7 @@ if(APPLE)
set(LOKINET_APPLE_BUILD 0)
endif()
set(RELEASE_MOTTO "A Series of Tubes" 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()
set(RELEASE_MOTTO "Gluten Free Edition" CACHE STRING "Release motto")
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)
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()
if(OXENC_FOUND)
@ -204,7 +197,7 @@ endif()
option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF)
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()
if(OXENMQ_FOUND)
add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ)

View File

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

View File

@ -5,31 +5,31 @@
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_SOURCE openssl-${OPENSSL_VERSION}.tar.gz)
set(OPENSSL_HASH SHA256=f89199be8b23ca45fc7cb9f1d8d3ee67312318286ad030f5316aca6462db6c96
set(OPENSSL_HASH SHA256=9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f
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}")
set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG}
CACHE STRING "expat download mirror(s)")
set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz)
set(EXPAT_HASH SHA256=b5d25d6e373351c2ed19b562b4732d01d2589ac8c8e9e7962d8df1207cc311b8
set(EXPAT_HASH SHA256=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25
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_SOURCE unbound-${UNBOUND_VERSION}.tar.gz)
set(UNBOUND_HASH SHA256=6ef91cbf02d5299eab39328c0857393de7b4885a2fe7233ddfe3c124ff5a89c8
set(UNBOUND_HASH SHA256=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f
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
CACHE STRING "sqlite3 download mirror(s)")
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")
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
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
CACHE STRING "curl mirror(s)")
set(CURL_SOURCE curl-${CURL_VERSION}.tar.xz)
set(CURL_HASH SHA256=a067b688d1645183febc31309ec1f3cdce9213d02136b6a6de3d50f69c95a7d3
set(CURL_HASH SHA256=2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4
CACHE STRING "curl source hash")
include(ExternalProject)

View File

@ -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")
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}")
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(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
${genversion_args}
"-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"${GIT_INDEX_FILE}")
else()
message(STATUS "Git was not found! Setting version to to nogit")
set(VERSIONTAG "nogit")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
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)

View File

@ -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_DEFINES "RequestExecutionLevel admin")
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
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Lokinet.lnk' '$INSTDIR\\\\share\\\\gui\\\\lokinet-gui.exe'"
)
set(CPACK_NSIS_DELETE_ICONS_EXTRA
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Lokinet.lnk'"
)
function(read_nsis_file filename outvar)
file(STRINGS "${filename}" _outvar)
list(TRANSFORM _outvar REPLACE "\\\\" "\\\\\\\\")
list(JOIN _outvar "\\n" out)
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)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified")

View File

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

View File

@ -49,7 +49,7 @@ endif()
foreach(exe ${exetargets})
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 ws2_32 iphlpapi)
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

View File

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

View File

@ -1,27 +1,16 @@
#include <constants/version.hpp>
#include <constants/version.h>
#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
{
// clang-format off
const std::array<uint16_t, 3> VERSION{{LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}};
const std::array<uint64_t, 4> ROUTER_VERSION{{LLARP_PROTO_VERSION, LLARP_VERSION_MAJOR, LLARP_VERSION_MINOR, LLARP_VERSION_PATCH}};
const char* const VERSION_STR = LLARP_VERSION_STR;
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::constants::proto_version, @lokinet_VERSION_MAJOR@, @lokinet_VERSION_MINOR@, @lokinet_VERSION_PATCH@}};
const char* const VERSION_STR = "@lokinet_VERSION_MAJOR@.@lokinet_VERSION_MINOR@.@lokinet_VERSION_PATCH@";
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 DEFAULT_NETID = LLARP_DEFAULT_NETID;
const char* const RELEASE_MOTTO = "@RELEASE_MOTTO@";
const char* const DEFAULT_NETID = "lokinet";
// clang-format on
} // namespace llarp

View File

@ -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

View File

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

View File

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

View File

@ -73,7 +73,7 @@ namespace llarp
return bencode_read_integer(val, &txid);
}
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 read;

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ namespace llarp
{
if (!bencode_read_integer(buf, &version))
return false;
return version == LLARP_PROTO_VERSION;
return version == llarp::constants::proto_version;
}
// bad key
return false;
@ -54,7 +54,7 @@ namespace llarp
return false;
// 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 bencode_end(buf);

View File

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

View File

@ -43,9 +43,10 @@ namespace llarp
{
if (!bencode_read_integer(buf, &version))
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;
}
llarp::LogDebug("LIM version ", version);
@ -86,7 +87,7 @@ namespace llarp
if (!rc.BEncode(buf))
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;
if (!bencode_write_bytestring(buf, "z", 1))

View File

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

View File

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

View File

@ -29,7 +29,7 @@ namespace llarp
return BEncodeReadArray(frames, buf);
}
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 read;
@ -54,7 +54,7 @@ namespace llarp
if (!BEncodeWriteDictArray("c", frames, buf))
return false;
// 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 bencode_end(buf);
@ -102,9 +102,10 @@ namespace llarp
if (!BEncodeWriteDictEntry("u", *nextRC, buf))
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;
if (work && !BEncodeWriteDictEntry("w", *work, buf))
if (work and not BEncodeWriteDictEntry("w", *work, buf))
return false;
return bencode_end(buf);
@ -135,7 +136,8 @@ namespace llarp
nextRC = std::make_unique<RouterContact>();
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;
if (*key == "w")
{

View File

@ -80,7 +80,7 @@ namespace llarp
}
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;
}
@ -115,7 +115,7 @@ namespace llarp
if (!BEncodeWriteDictInt("s", status, buf))
return false;
// 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 bencode_end(buf);
@ -190,7 +190,7 @@ namespace llarp
LR_StatusRecord record;
record.status = newStatus;
record.version = LLARP_PROTO_VERSION;
record.version = llarp::constants::proto_version;
llarp_buffer_t buf(frame.data(), frame.size());
buf.cur = buf.base + EncryptedFrameOverheadSize;
@ -256,7 +256,8 @@ namespace llarp
LR_StatusRecord::BEncode(llarp_buffer_t* buf) const
{
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
@ -269,7 +270,8 @@ namespace llarp
if (!BEncodeMaybeReadDictInt("s", status, read, *key, buffer))
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 read;

View File

@ -105,7 +105,7 @@ namespace llarp
{
if (!bencode_read_integer(buf, &i))
return false;
return i == LLARP_PROTO_VERSION;
return i == llarp::constants::proto_version;
}
// bad key
@ -149,7 +149,7 @@ namespace llarp
return false;
/** 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;
/** end */
return bencode_end(buff);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ namespace llarp
private:
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&

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -191,7 +191,7 @@ namespace llarp
return false;
if (!BEncodeMaybeReadDictEntry("T", T, read, key, val))
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;
if (!BEncodeMaybeReadDictEntry("Z", Z, read, key, val))
return false;

View File

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

View File

@ -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

View File

@ -6,19 +6,16 @@
//
// 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
#include <winresrc.h>
#endif
/////////////////////////////////////////////////////////////////////////////
// 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)
#ifdef _WIN32
LANGUAGE 1033,1
@ -56,8 +53,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION LLARP_VERSION
PRODUCTVERSION LLARP_VERSION
FILEVERSION lokinet_VERSION
PRODUCTVERSION lokinet_VERSION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x3L
@ -72,15 +69,15 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "includes relay/exit functionality, such code is highly experimental on non-Linux targets"
VALUE "CompanyName", "Loki Foundation"
VALUE "FileDescription", "LokiNET daemon for Microsoft® Windows® NT™"
VALUE "FileVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG)
VALUE "InternalName", "llarpd"
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 "OriginalFilename", "llarpd.exe"
VALUE "Comments", "This comment has invoked its 5th ammendment constitutional right to remain silent"
VALUE "CompanyName", "OPTF"
VALUE "FileDescription", "LokiNET daemon for Windows"
VALUE "FileVersion", "@lokinet_VERSION@"
VALUE "InternalName", "lokinet"
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", "@lokinet_EXE_NAME@"
VALUE "ProductName", "LokiNET for Windows"
VALUE "ProductVersion", VERSION_STRING(LLARP_VERSION_TRIPLET, LLARP_RELEASE_MOTTO, VERSIONTAG)
VALUE "ProductVersion", "@lokinet_VERSION@"
END
END
BLOCK "VarFileInfo"

View File

@ -24,14 +24,14 @@ TEST_CASE("Compatibility when protocol unequal", "[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));
}
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(llarp::emptyRouterVersion.IsEmpty());
@ -39,7 +39,7 @@ TEST_CASE("IsEmpty", "[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());
version.Clear();

View File

@ -28,6 +28,6 @@ TEST_CASE_METHOD(LlarpTest<>, "Sign-verify")
CHECK(msg.Sign(alice));
CHECK(msg.Verify());
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());
}

View File

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

View File

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

View File

@ -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

View File

@ -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'

View File

@ -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