Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
247 commits
Select commit Hold shift + click to select a range
9219024
[WIP] Started working on libQuic functions
mpretty-cyro Mar 14, 2024
57be9b9
Test to ensure libQuic is linked when running unit tests
mpretty-cyro Mar 14, 2024
df9438d
Fixed an incorrect function definition
mpretty-cyro Mar 14, 2024
2f9aaa2
Added changes from bindle-static-deps PR
mpretty-cyro Mar 15, 2024
f88ac87
[WIP] Latest tweaks, still have linker errors...
mpretty-cyro Mar 18, 2024
7386ad3
Added a call to test_onionreq.cpp to ensure it calls some libQuic met…
mpretty-cyro Mar 18, 2024
0b48055
Tweaks to libQuic to get iOS build linking correctly
mpretty-cyro Mar 19, 2024
6dab3b9
Started working on quic-based onion request functions
mpretty-cyro Mar 22, 2024
a3ec4c2
Fixed up a bunch of libQuic onion routing issues
mpretty-cyro Mar 27, 2024
30adf76
Fixed support for non-JSON response body
mpretty-cyro Mar 27, 2024
4e79b25
Updated the error handling to better handle 421 errors (auto retry)
mpretty-cyro Mar 28, 2024
a8c4987
Fixed file uploads and requests with query params
mpretty-cyro Apr 2, 2024
7b50848
Fixed a couple of bugs and added some unit tests
mpretty-cyro Apr 4, 2024
aeb86c2
Updated to the latest libquic commit
mpretty-cyro Apr 4, 2024
cbc37c8
Fix link dependency recursion for interface libraries
jagerman Apr 5, 2024
5cdc346
Bump to latest libquic with xcode/ios build updates
jagerman Apr 5, 2024
0e192e3
Ran formatter and fixed test build (not sure we want the change though)
mpretty-cyro Apr 5, 2024
93c5727
Added an if statement around the check custom target
mpretty-cyro Apr 5, 2024
b5737a9
Ran the formatter
mpretty-cyro Apr 6, 2024
e727de2
Added a couple of basic standard network request unit tests
mpretty-cyro Apr 7, 2024
edfbd20
Drop old "lokinet-ci-" docker image prefix
mpretty-cyro Apr 7, 2024
fd6838e
Added gnutls-bin to the default deps
mpretty-cyro Apr 7, 2024
e7249fd
More tweaks to the default deps trying to fix CI builds
mpretty-cyro Apr 7, 2024
6084fe6
Fix warnings and ran formatter
mpretty-cyro Apr 8, 2024
ec0332b
Tweaked the onionreq builder to fix more warnings
mpretty-cyro Apr 8, 2024
8cebd18
Changes to resolve warnings in CI builds
mpretty-cyro Apr 9, 2024
c0536ff
Additional CI error fixes and attempting to suppress Catch2 warnings
mpretty-cyro Apr 9, 2024
67921bd
Bump to c++20
jagerman Apr 9, 2024
48f0676
Find and link to nettle
jagerman Apr 9, 2024
5b8880c
Bump libquic
jagerman Apr 9, 2024
fc12125
Disable shared libs for llvm build
jagerman Apr 9, 2024
5728829
Bump nlohmann-json to latest
jagerman Apr 9, 2024
7b067a3
Move some apple jobs to om2g CI
jagerman Apr 9, 2024
43eae3a
Add some linux builds; fix bionic
jagerman Apr 9, 2024
11a0804
drone job name lipstick
jagerman Apr 9, 2024
1683e58
bullseye backports
jagerman Apr 9, 2024
94fa3ad
Add ngtcp2 CI dep
jagerman Apr 9, 2024
f23bf01
make oxen repo default
jagerman Apr 9, 2024
3c7a9f1
fix libngtcp2-dev package name and depend on crypto package
jagerman Apr 9, 2024
019c1e9
Add test image deps
jagerman Apr 10, 2024
d7ac1e2
more dep fixing
jagerman Apr 10, 2024
3549438
libquic bump
jagerman Apr 10, 2024
3aea8a5
Remove bionic; disable win-x86
jagerman Apr 10, 2024
6c78690
libquic bump
jagerman Apr 10, 2024
ffe6211
use CHECK(thing) and CHECK_FALSE(thing) instead of == true/false
jagerman Apr 10, 2024
13b6731
libquic bump
jagerman Apr 10, 2024
e734a5c
Reworked network to be instance-based
mpretty-cyro Apr 12, 2024
d523633
Merge branch 'more-libquic' into libquic
mpretty-cyro Apr 12, 2024
1c4667b
Added a function to replace the secret key used for the network
mpretty-cyro Apr 12, 2024
7651967
Fixed up lambda variable capture, ip formatting
mpretty-cyro Apr 15, 2024
2bf8291
Updated to the latest stable libQuic commit
mpretty-cyro Apr 15, 2024
d598b2e
Ran the formatter and fixed a weird namespace mistake
mpretty-cyro Apr 15, 2024
0829d2b
Switch to libquic `stable` branch && bump required system lib version
jagerman Apr 15, 2024
3aa5385
Fix oxen::logging dependencies
jagerman Apr 15, 2024
b065609
Remove duplicate Windows build
jagerman Apr 15, 2024
3358960
Removed backported starts_with and ends_with
mpretty-cyro Apr 17, 2024
d61746d
Implemented the snode pool cache logic, PR comments
mpretty-cyro Apr 23, 2024
e3bfd89
Resolved remaining PR comments and minor tweaks
mpretty-cyro Apr 24, 2024
cc2d8fc
Used 'RemoteAddress' instead of a custom service_node
mpretty-cyro Apr 26, 2024
587588e
Ran the formatter and fixed some CI build errors
mpretty-cyro Apr 26, 2024
aee7ea6
Fixed more CI warnings
mpretty-cyro Apr 26, 2024
f76bc9e
More tweaks to resolve CI errors (warnings)
mpretty-cyro Apr 28, 2024
5dbf1ac
Further tweaks for CI errors
mpretty-cyro Apr 28, 2024
efb5263
Additional tweaks for CI warnings
mpretty-cyro Apr 28, 2024
6d54d8d
Missed the 'snode destination' onion request call in the previous commit
mpretty-cyro Apr 28, 2024
fdc2a1f
Pointing at the latest dev libQuic
mpretty-cyro Apr 29, 2024
0ae1c77
Reverted to a previous `dev` commit
mpretty-cyro Apr 29, 2024
6c86cc0
Added a function to retrieve the current old hashes without pushing
mpretty-cyro Apr 29, 2024
aae9ab6
Use oxen-encoding via libquic
jagerman Apr 30, 2024
67eb146
oxenc 1.1.0 compatibility
jagerman Apr 30, 2024
dad4311
Tweaked 'with_path' behaviour, added ability to reset/create endpoint
mpretty-cyro May 1, 2024
c7c68fb
Fixed the get_endpoint and paths changed callback memory
mpretty-cyro May 2, 2024
6dc24d2
Ran the formatter
mpretty-cyro May 2, 2024
e49e379
Fixed a build error
mpretty-cyro May 2, 2024
0bacafa
Fixed more issues found by the CI
mpretty-cyro May 2, 2024
31bf2ba
Ran the linter, bubble up path building errors
mpretty-cyro May 2, 2024
4494ebe
Bubble up snode pool errors
mpretty-cyro May 2, 2024
56e75ac
Tweaks to try and fix the CI test failures
mpretty-cyro May 2, 2024
0b6400d
remove comment for removed argument
jagerman May 7, 2024
c75357d
Replace callback logger; de-header oxen-logging and spdlog
jagerman May 7, 2024
e3a824e
Mildly simplify hash() implementation
jagerman May 7, 2024
c0cd3ee
Renamed the C API for the logger functions, fixed build errors
mpretty-cyro May 8, 2024
6c4ea3c
Fixed an issue where the network status wouldn't get updated in some …
mpretty-cyro May 8, 2024
4636134
logging: add level controls; add tests
jagerman May 8, 2024
a97e510
C network API doc tweaks & typedef
jagerman May 8, 2024
5f24da2
Remove unneeded specific values
jagerman May 8, 2024
64e996d
Re-join disk writing thread during destruction
jagerman May 8, 2024
99dab99
`#include` cleanups
jagerman May 8, 2024
b41b469
Minor API doc wording tweaks
jagerman May 8, 2024
5578583
Replace crappy config logger with oxen-logging
jagerman May 8, 2024
8d3adff
Change unmerged_index() to optional<size_t>
jagerman May 8, 2024
afa6d75
Fix flakey oxen-logging source dir stripping
jagerman May 9, 2024
9439323
Add fix for test case premature timeout
jagerman May 9, 2024
a8012aa
Use libquic's (relatively new) string_view-accepting opt::alpns
jagerman May 9, 2024
c8f0c83
More input validity checks
jagerman May 9, 2024
0a70ba1
Drop `oxen::` prefix from various things
jagerman May 9, 2024
5492941
Remove custom comparison for Address compare
jagerman May 9, 2024
091b58f
PR comments and logger testing
mpretty-cyro May 9, 2024
4e4b399
Unbreak compilation
jagerman May 9, 2024
9d001e9
Add missing test file
jagerman May 9, 2024
6744a7d
Added a function to manually trigger a log for debugging purposes
mpretty-cyro May 9, 2024
269126e
Split out sodium utils into a dedicated header
jagerman May 9, 2024
1784e0d
Add file helpers; push more std::filesystem::path
jagerman May 9, 2024
610965b
Build fix
mpretty-cyro May 10, 2024
ac50ef4
Fixed an issue when merging the current config into itself
mpretty-cyro May 10, 2024
469a72c
Ran formatter, catch exceptions thrown when loading cache, disable 'o…
mpretty-cyro May 10, 2024
60b3021
Combined the snode_pool and build_paths loopers
mpretty-cyro May 10, 2024
f4bca74
Combined the path building and snode pool logic
mpretty-cyro May 10, 2024
163a2fe
Set badbits but not failbit after opening
jagerman May 10, 2024
6e89b4b
Bump to latest libquic & oxen-logging
jagerman May 10, 2024
0dea82b
Add hack to hide broken log path with xcode 15
jagerman May 10, 2024
b36c727
Fix Loop variable initialization
jagerman May 10, 2024
ebb6188
Updated the unit tests for Apple builds (file path differs)
mpretty-cyro May 12, 2024
6695f83
Silly autocomplete mistake
mpretty-cyro May 12, 2024
a335598
Testing debian test failure 1
mpretty-cyro May 13, 2024
0c30c54
Testing debian test failure 2
mpretty-cyro May 13, 2024
3eeb56d
Testing debian test failure 3
mpretty-cyro May 13, 2024
a92f800
Testing debian test failure 4
mpretty-cyro May 13, 2024
9bf1ff6
Testing debian test failure 5
mpretty-cyro May 13, 2024
6992d1f
Testing debian test failure 6
mpretty-cyro May 13, 2024
d083294
Testing debian test failure 7
mpretty-cyro May 13, 2024
49a76c7
Testing debian test failure 8
mpretty-cyro May 13, 2024
5605edc
Ensured network status changes run in the network looper
mpretty-cyro May 13, 2024
9961c01
Testing debian test failure 9
mpretty-cyro May 13, 2024
845134d
Testing debian test failure 10
mpretty-cyro May 13, 2024
39ecc58
Testing debian test failure 11
mpretty-cyro May 13, 2024
f92caaa
Testing debian test failure 12 (Try std::moving `info` everywhere)
mpretty-cyro May 13, 2024
052c593
Reverted the previous change, added check to fix logging test
mpretty-cyro May 13, 2024
d252eef
Added a preprocessor macro to identify the release build for tests
mpretty-cyro May 13, 2024
ad21e73
Another tweak to logging test
mpretty-cyro May 13, 2024
d113e77
Made a number of changes based on iOS crash logs
mpretty-cyro May 22, 2024
b66e54b
Removed a couple of debug logs
mpretty-cyro May 23, 2024
d0b03ec
Made a few changes to fix some race conditions in network recovery
mpretty-cyro May 31, 2024
8b4477a
Wrapped a few throwing functions in try/catches in the C API
mpretty-cyro Jun 1, 2024
a391147
Fixing CI errors
mpretty-cyro Jun 2, 2024
a734015
Updated the C API config error handling logic
mpretty-cyro Jun 3, 2024
ea1b1df
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jun 3, 2024
b20b0ff
Updated get_connection_info vars to be shared_ptrs to prevent bg crash
mpretty-cyro Jun 3, 2024
0c4d178
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jun 3, 2024
70a39f6
Updated to the latest libQuic
mpretty-cyro Jun 5, 2024
7023026
Added separate paths for uploading/downloading files, fixed a few bugs
mpretty-cyro Jun 7, 2024
68d732a
Fixed bugs which recovering connections and error handling
mpretty-cyro Jun 11, 2024
714230c
Fixed the broken tests
mpretty-cyro Jun 11, 2024
d219096
Looking to fix CI errors
mpretty-cyro Jun 12, 2024
9a867d5
A couple more bug fixes and added auth for versioning API call
mpretty-cyro Jun 17, 2024
fdfd9db
Added a bunch of trace logs to help better debug network issues
mpretty-cyro Jun 18, 2024
c61333f
Added back the 'ENABLE_ONIONREQ' flag
mpretty-cyro Jun 24, 2024
c9a98db
Fixed an issue where bad nodes might not get dropped in some cases
mpretty-cyro Jun 24, 2024
d4b2c66
Merge remote-tracking branch 'origin/dev' into libquic
Bilb Jun 27, 2024
3ad5920
Removed the path "recovery" logic (just rebuild instead)
mpretty-cyro Jun 28, 2024
dfcd3ae
Reverted the removal of the path "recovery" logic
mpretty-cyro Jul 1, 2024
18e7fb8
fix build
Bilb Jun 27, 2024
cffdbde
fix: dirty fix TO BE REMOVED to make needs_dump true when need to dump
Bilb Jul 4, 2024
c0cf732
Wrapped a few more functions in the exception wrapper
mpretty-cyro Jul 5, 2024
2163461
Added custom handling for a HTML 400 error
mpretty-cyro Jul 15, 2024
449c86d
Optimisations to the path building logic
mpretty-cyro Jul 17, 2024
8d944ab
Delete C++ object in network_free
jagerman Jul 17, 2024
c829255
Fixed an issue in the C++ to C conversion of a service node
mpretty-cyro Jul 19, 2024
13c2f35
Added a version check for the final path node and a couple other fixes
mpretty-cyro Jul 23, 2024
38c9fad
Merge remote-tracking branch 'origin/prioritise-updated-final-node' i…
mpretty-cyro Jul 26, 2024
7f5e302
Fixed a bug with the version check API auth generation
mpretty-cyro Jul 26, 2024
94cf7e3
Merge pull request #1 from Bilb/fix/build-without-onionreq
mpretty-cyro Jul 26, 2024
38c55de
Additional invite/promotion state and missing C functions
mpretty-cyro Jul 17, 2024
06c4709
Renamed a couple of functions, updated docs, fixed 'promotion_x' funcs
mpretty-cyro Jul 17, 2024
64fa7fa
Fix C free functions
jagerman Jul 17, 2024
ad32b75
Small docs change
mpretty-cyro Jul 17, 2024
b5b06b9
Ran the formatter -_-
mpretty-cyro Jul 18, 2024
a05a5be
Added 'set_{x}_truncated' functions so clients have non-throwing vers…
mpretty-cyro Jul 4, 2024
caab7a8
Ran the formatter
mpretty-cyro Jul 5, 2024
e956d9d
Added a utf8_truncate function and use it when truncating user content
mpretty-cyro Jul 17, 2024
a15533e
Added some tests for the new utf8 truncation logic
mpretty-cyro Jul 18, 2024
d3a2eca
feat: moved community url max length and qs_pubkey to cpp header
yougotwill Jul 24, 2024
94d53ba
allow protobuf to come from the system lib
jagerman Jul 25, 2024
84f258b
Added missing headers
mpretty-cyro Jun 17, 2024
7e20d43
Added new sodium_array header changes
mpretty-cyro Jun 17, 2024
7664449
Addressed PR comments
mpretty-cyro Jul 23, 2024
6a6c9d8
Added a missing import
mpretty-cyro Jul 24, 2024
e452022
Updated the docs to be correct, and explicit about a unix timestamp
mpretty-cyro Jul 24, 2024
659b408
Avoid reuse of cleared_uc64 data
jagerman Jul 25, 2024
9d1b1f7
Fixed a few issues resulting from merges
mpretty-cyro Jul 26, 2024
d6147ef
Fixed merge bug, removed extra timeout threshold, needs_dump fix
mpretty-cyro Jul 27, 2024
23c943d
Fixed a few bugs
mpretty-cyro Jul 31, 2024
59a4de4
Compilation error/warning fixes
jagerman Aug 2, 2024
f0016f5
Removed some duplicate code
mpretty-cyro Aug 2, 2024
0f79e97
Removed the 'paths_and_pool_loop' and refactored the path build logic
mpretty-cyro Aug 6, 2024
bf0076d
PR feedback tweaks round 1
mpretty-cyro Aug 6, 2024
bdbdb17
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Aug 6, 2024
367ab1f
Attempt to fix a couple of CI build issues
mpretty-cyro Aug 6, 2024
7467ee0
Fixed another CI error
mpretty-cyro Aug 6, 2024
bd1ecec
Added a bunch of network unit tests, fixed some warnings
mpretty-cyro Aug 7, 2024
638616d
Fixed one of the broken tests
mpretty-cyro Aug 7, 2024
b368c47
Drop 'not found' nodes immediately, additional PR feedback tweaks
mpretty-cyro Aug 8, 2024
2966cc3
Split the resume_queues function and fixed broken tests
mpretty-cyro Aug 13, 2024
bdfa6fd
Updated libquic submodule
mpretty-cyro Aug 13, 2024
fd218a9
Fixed a bug and the broken tests
mpretty-cyro Aug 14, 2024
3650fdc
Fixed a couple of bugs
mpretty-cyro Aug 15, 2024
1967646
Fixed a build error
mpretty-cyro Aug 15, 2024
ecba02b
Fixed a few bugs found when testing
mpretty-cyro Aug 15, 2024
cc539e3
Updated decrypt_ons_response to support decrypting legacy ONS values
mpretty-cyro Aug 19, 2024
116256a
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 19, 2024
3e584f8
Updated logic to keep dropped paths around until their requests finish
mpretty-cyro Aug 20, 2024
0ce9762
Fixed a bug with the C API ONS lookup function
mpretty-cyro Aug 21, 2024
de6f226
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 21, 2024
8c3bd7e
Ran formatter, fixed array size issue
mpretty-cyro Aug 21, 2024
3798669
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 21, 2024
faec15a
Fixed issue breaking tests when testnet is busted, fixed some CI warn…
mpretty-cyro Aug 21, 2024
ba7919d
Exposes functions to clear the oxen::log sinks
mpretty-cyro Aug 21, 2024
af0ab99
Updated the docs for legacy group decrypt function to reduce misuse
mpretty-cyro Aug 23, 2024
2bf8c81
Reverted 64-byte legacy group secret key decryption (only need 32 bytes)
mpretty-cyro Aug 27, 2024
de7d8a6
Fixed an incorrect size for the curve25519 secret key
mpretty-cyro Aug 29, 2024
12df14a
Updated libQuic and cleaned up 'wrap_exceptions' usage
mpretty-cyro Sep 4, 2024
e1a76eb
Added a function to compute a message hash
mpretty-cyro Sep 5, 2024
ac34aa2
Added code to calculate swarms locally instead of fetching
mpretty-cyro Sep 6, 2024
c3aa3b9
Added a timeout mechanism which takes the path build time into account
mpretty-cyro Sep 6, 2024
1d20f5e
Improvements to attachment upload/download behaviours
mpretty-cyro Sep 6, 2024
789f9f6
Expose response headers in network request functions
mpretty-cyro Sep 9, 2024
1188aaf
Tweaks to try to fix CI errors
mpretty-cyro Sep 9, 2024
2f81c69
Another tweak for CI errors
mpretty-cyro Sep 9, 2024
6bc86ad
Further tweaks to make CI happy
mpretty-cyro Sep 9, 2024
6a1ab51
More CI platform specific tweaks
mpretty-cyro Sep 9, 2024
12ed513
Another tweak for CI test build issues
mpretty-cyro Sep 9, 2024
f3f273c
Fixed a cache refresh bug, logging tweaks, CI build tweaks
mpretty-cyro Sep 10, 2024
c057cd9
Fixed a bug with onion_path pending requests func and logging tweaks
mpretty-cyro Sep 12, 2024
f19df11
Reverted change causing test crashes on CI, tweak for 32-bit CI error
mpretty-cyro Sep 12, 2024
776bac0
Fixed up the iOS build script
mpretty-cyro Sep 20, 2024
e0316db
Merge branch 'fix/group-member-status-bug' into libquic
mpretty-cyro Oct 2, 2024
10f15ae
Added a function to retrieve the current snode cache size
mpretty-cyro Oct 7, 2024
bc0a2a6
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 22, 2024
4f5a4a8
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 25, 2024
5058514
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 26, 2024
106c12d
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Dec 10, 2024
774985d
Merge remote-tracking branch 'origin/feature/local_members_sending_st…
mpretty-cyro Dec 17, 2024
ce94486
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jan 6, 2025
bf7c010
Fixed an incorrect variable
mpretty-cyro Jan 9, 2025
b57c8a5
Added a bugfix to prevent removing the current hash incorrectly and r…
mpretty-cyro Jan 19, 2025
9746807
Applied some old PR feedback changes
mpretty-cyro Feb 6, 2025
20c8240
Added a missing default value to the new Builder constructor
mpretty-cyro Feb 6, 2025
9935bbe
Fixed a couple of issues with the `random_base32` function
mpretty-cyro Feb 10, 2025
287f117
CI build error fixes #1
mpretty-cyro Feb 10, 2025
53394ee
Fixed the logging tests on macOS ARM64
mpretty-cyro Feb 13, 2025
4651fe1
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Feb 13, 2025
7289475
Removed an unneeded _old_hashes.erase
mpretty-cyro Feb 14, 2025
e22f8bb
Updated the clang format version
mpretty-cyro Feb 14, 2025
6e9aa20
Changed the byte limit for the groups description to 600
mpretty-cyro Feb 18, 2025
1ce161d
Updated the 'drone-format-verify.sh' to also use clang-format-17
mpretty-cyro Feb 18, 2025
1e92a9e
Reduced the GroupKeys padding from 75 members to 45 to fit in a PN
mpretty-cyro Feb 21, 2025
82be3ae
Seems like the logging differences might be specific to the clang ver…
mpretty-cyro Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SpacesInAngles: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: c++17
Standard: c++20
UseTab: Never
SortIncludes: true
ColumnLimit: 100
Expand Down
4 changes: 3 additions & 1 deletion .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local submodules = {

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

local libngtcp2_deps = ['libgnutls28-dev', 'libprotobuf-dev'];
local libngtcp2_deps = ['libgnutls28-dev', 'libprotobuf-dev', 'libngtcp2-dev', 'libngtcp2-crypto-gnutls-dev'];

local default_deps_nocxx = [
'nlohmann-json3-dev',
Expand Down Expand Up @@ -375,12 +375,14 @@ local static_build(name,
'libsession-util-windows-x64-TAG.zip',
deps=['g++-mingw-w64-x86-64-posix'],
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-x86-64-toolchain.cmake'),
/* currently broken:
static_build('Static Windows x86',
docker_base + 'debian-win32-cross',
'libsession-util-windows-x86-TAG.zip',
deps=['g++-mingw-w64-i686-posix'],
allow_fail=true,
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-i686-toolchain.cmake'),
*/
debian_pipeline(
'Static Android',
docker_base + 'android',
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/compile_commands.json
/.cache/
/.vscode/
*.DS_Store
.DS_STORE
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "external/oxen-encoding"]
path = external/oxen-encoding
url = https://github.com/session-foundation/oxen-encoding.git
[submodule "external/libsodium-internal"]
path = external/libsodium-internal
url = https://github.com/session-foundation/libsodium-internal.git
Expand All @@ -16,6 +13,9 @@
[submodule "external/nlohmann-json"]
path = external/nlohmann-json
url = https://github.com/nlohmann/json.git
[submodule "external/oxen-libquic"]
path = external/oxen-libquic
url = https://github.com/oxen-io/oxen-libquic.git
[submodule "external/protobuf"]
path = external/protobuf
url = https://github.com/protocolbuffers/protobuf.git
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14...3.23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "macOS deployment target (Apple clang only)")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "macOS deployment target (Apple clang only)")

set(LANGS C CXX)
find_program(CCACHE_PROGRAM ccache)
Expand All @@ -16,7 +16,6 @@ if(CCACHE_PROGRAM)
endforeach()
endif()


project(libsession-util
VERSION 1.2.0
DESCRIPTION "Session client utility library"
Expand All @@ -41,7 +40,7 @@ else()
endif()


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -81,7 +80,7 @@ option(STATIC_LIBSTD "Statically link libstdc++/libgcc" ${default_static_libstd}

option(USE_LTO "Use Link-Time Optimization" ${use_lto_default})

# Provide this as an option for now because GMP and iOS are sometimes unhappy with each other.
# Provide this as an option for now because GMP and Desktop are sometimes unhappy with each other.
option(ENABLE_ONIONREQ "Build with onion request functionality" ON)

if(USE_LTO)
Expand Down Expand Up @@ -118,6 +117,21 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)


add_subdirectory(external)

if(ENABLE_ONIONREQ)
if(NOT TARGET nettle::nettle)
if(BUILD_STATIC_DEPS)
message(FATAL_ERROR "Internal error: nettle::nettle target (expected via libquic BUILD_STATIC_DEPS) not found")
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(NETTLE REQUIRED IMPORTED_TARGET nettle)
add_library(nettle INTERFACE)
target_link_libraries(nettle INTERFACE PkgConfig::NETTLE)
add_library(nettle::nettle ALIAS nettle)
endif()
endif()
endif()

add_subdirectory(src)
add_subdirectory(proto)

Expand Down
28 changes: 25 additions & 3 deletions cmake/AddStaticBundleLib.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@

set(LIBSESSION_STATIC_BUNDLE_LIBS "" CACHE INTERNAL "list of libs to go into the static bundle lib")

function(_libsession_static_bundle_append tgt)
list(APPEND LIBSESSION_STATIC_BUNDLE_LIBS "${tgt}")
set(LIBSESSION_STATIC_BUNDLE_LIBS "${LIBSESSION_STATIC_BUNDLE_LIBS}" CACHE INTERNAL "")
endfunction()

# Call as:
#
# libsession_static_bundle(target [target2 ...])
#
# to append the given target(s) to the list of libraries that will be combined to make the static
# bundled libsession-util.a.
function(libsession_static_bundle)
list(APPEND LIBSESSION_STATIC_BUNDLE_LIBS "${ARGN}")
list(REMOVE_DUPLICATES LIBSESSION_STATIC_BUNDLE_LIBS)
set(LIBSESSION_STATIC_BUNDLE_LIBS "${LIBSESSION_STATIC_BUNDLE_LIBS}" CACHE INTERNAL "")
foreach(tgt IN LISTS ARGN)
if(TARGET "${tgt}" AND NOT "${tgt}" IN_LIST LIBSESSION_STATIC_BUNDLE_LIBS)
get_target_property(tgt_type ${tgt} TYPE)

if(tgt_type STREQUAL STATIC_LIBRARY)
message(STATUS "Adding ${tgt} to libsession-util bundled library list")
_libsession_static_bundle_append("${tgt}")
endif()

if(tgt_type STREQUAL INTERFACE_LIBRARY)
get_target_property(tgt_link_deps ${tgt} INTERFACE_LINK_LIBRARIES)
else()
get_target_property(tgt_link_deps ${tgt} LINK_LIBRARIES)
endif()

if(tgt_link_deps)
libsession_static_bundle(${tgt_link_deps})
endif()
endif()
endforeach()
endfunction()
5 changes: 4 additions & 1 deletion cmake/GenVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ else()
OUTPUT_VARIABLE git_tag
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(git_tag)
if(git_tag AND git_tag MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+$")
message(STATUS "${git_commit} is tagged (${git_tag}); tagging version as 'release'")
set(vfull "v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(PROJECT_VERSION_TAG "release")

if (NOT git_tag STREQUAL "${vfull}")
message(FATAL_ERROR "This commit is tagged, but the tag (${git_tag}) does not match the project version (${vfull})!")
endif()
elseif(git_tag)
message(WARNING "Did not recognize git tag (${git_tag}) for ${git_commit}; tagging with commit hash")
set(PROJECT_VERSION_TAG "${git_commit}")
else()
message(STATUS "Did not find a git tag for ${git_commit}; tagging version with the commit hash")
set(PROJECT_VERSION_TAG "${git_commit}")
Expand Down
41 changes: 0 additions & 41 deletions cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@

set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads")

set(GMP_VERSION 6.3.0 CACHE STRING "gmp version")
set(GMP_MIRROR ${LOCAL_MIRROR} https://gmplib.org/download/gmp
CACHE STRING "gmp mirror(s)")
set(GMP_SOURCE gmp-${GMP_VERSION}.tar.xz)
set(GMP_HASH SHA512=e85a0dab5195889948a3462189f0e0598d331d3457612e2d3350799dba2e244316d256f8161df5219538eb003e4b5343f989aaa00f96321559063ed8c8f29fd2
CACHE STRING "gmp source hash")

set(NETTLE_VERSION 3.9.1 CACHE STRING "nettle version")
set(NETTLE_MIRROR ${LOCAL_MIRROR} https://ftp.gnu.org/gnu/nettle
CACHE STRING "nettle mirror(s)")
set(NETTLE_SOURCE nettle-${NETTLE_VERSION}.tar.gz)
set(NETTLE_HASH SHA512=5939c4b43cf9ff6c6272245b85f123c81f8f4e37089fa4f39a00a570016d837f6e706a33226e4bbfc531b02a55b2756ff312461225ed88de338a73069e031ced
CACHE STRING "nettle source hash")


include(ExternalProject)

set(DEPS_DESTDIR ${CMAKE_BINARY_DIR}/static-deps)
Expand Down Expand Up @@ -230,32 +215,6 @@ elseif(gmp_build_host STREQUAL "")
set(gmp_build_host "--build=${CMAKE_LIBRARY_ARCHITECTURE}")
endif()

if(ENABLE_ONIONREQ)
build_external(gmp
CONFIGURE_COMMAND ./configure ${gmp_build_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}${apple_cflags_arch}" "CXXFLAGS=${deps_CXXFLAGS}${apple_cxxflags_arch}"
"LDFLAGS=${apple_ldflags_arch}" ${cross_rc} CC_FOR_BUILD=cc CPP_FOR_BUILD=cpp
)
add_static_target(gmp gmp_external libgmp.a)

build_external(nettle
CONFIGURE_COMMAND ./configure ${gmp_build_host} --disable-shared --prefix=${DEPS_DESTDIR} --libdir=${DEPS_DESTDIR}/lib
--with-pic --disable-openssl
"CC=${deps_cc}" "CXX=${deps_cxx}"
"CFLAGS=${deps_CFLAGS}${apple_cflags_arch}" "CXXFLAGS=${deps_CXXFLAGS}${apple_cxxflags_arch}"
"CPPFLAGS=-I${DEPS_DESTDIR}/include"
"LDFLAGS=-L${DEPS_DESTDIR}/lib${apple_ldflags_arch}"

DEPENDS gmp_external
BUILD_BYPRODUCTS
${DEPS_DESTDIR}/lib/libnettle.a
${DEPS_DESTDIR}/lib/libhogweed.a
${DEPS_DESTDIR}/include/nettle/version.h
)
add_static_target(nettle nettle_external libnettle.a gmp)
add_static_target(hogweed nettle_external libhogweed.a nettle)
endif()

link_libraries(-static-libstdc++)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
link_libraries(-static-libgcc)
Expand Down
41 changes: 31 additions & 10 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(SUBMODULE_CHECK)
message(STATUS "Checking submodules")
check_submodule(ios-cmake)
check_submodule(libsodium-internal)
check_submodule(oxen-encoding)
check_submodule(oxen-libquic external/oxen-logging external/oxen-encoding)
check_submodule(nlohmann-json)
check_submodule(zstd)
check_submodule(protobuf)
Expand All @@ -37,7 +37,7 @@ if(NOT BUILD_STATIC_DEPS AND NOT FORCE_ALL_SUBMODULES)
find_package(PkgConfig REQUIRED)
endif()

macro(system_or_submodule BIGNAME smallname pkgconf subdir)
macro(libsession_system_or_submodule BIGNAME smallname pkgconf subdir)
option(FORCE_${BIGNAME}_SUBMODULE "force using ${smallname} submodule" OFF)
if(NOT BUILD_STATIC_DEPS AND NOT FORCE_${BIGNAME}_SUBMODULE AND NOT FORCE_ALL_SUBMODULES)
pkg_check_modules(${BIGNAME} ${pkgconf} IMPORTED_TARGET GLOBAL)
Expand All @@ -57,6 +57,9 @@ macro(system_or_submodule BIGNAME smallname pkgconf subdir)
if(TARGET ${smallname} AND NOT TARGET ${smallname}::${smallname})
add_library(${smallname}::${smallname} ALIAS ${smallname})
endif()
if(BUILD_STATIC_DEPS AND STATIC_BUNDLE)
libsession_static_bundle(${smallname}::${smallname})
endif()
endmacro()


Expand All @@ -65,11 +68,6 @@ set(cross_host "")
set(cross_rc "")
if(CMAKE_CROSSCOMPILING)
if(APPLE_TARGET_TRIPLE)
if(PLATFORM MATCHES "OS64" OR PLATFORM MATCHES "SIMULATORARM64")
set(APPLE_TARGET_TRIPLE aarch64-apple-ios)
elseif(PLATFORM MATCHES "SIMULATOR64")
set(APPLE_TARGET_TRIPLE x86_64-apple-ios)
endif()
set(cross_host "--host=${APPLE_TARGET_TRIPLE}")
elseif(ANDROID)
if(CMAKE_ANDROID_ARCH_ABI MATCHES x86_64)
Expand Down Expand Up @@ -102,8 +100,31 @@ if(CMAKE_CROSSCOMPILING)
endif()
endif()

set(LIBQUIC_BUILD_TESTS OFF CACHE BOOL "")
if(ENABLE_ONIONREQ)
libsession_system_or_submodule(OXENQUIC quic liboxenquic>=1.1.0 oxen-libquic)
endif()

if(NOT TARGET oxenc::oxenc)
# The oxenc target will already exist if we load libquic above via submodule
set(OXENC_BUILD_TESTS OFF CACHE BOOL "")
set(OXENC_BUILD_DOCS OFF CACHE BOOL "")
libsession_system_or_submodule(OXENC oxenc liboxenc>=1.1.0 oxen-libquic/external/oxen-encoding)
endif()

system_or_submodule(OXENC oxenc liboxenc>=1.0.10 oxen-encoding)
if(NOT TARGET oxen::logging)
add_subdirectory(oxen-libquic/external/oxen-logging)
endif()

oxen_logging_add_source_dir("${PROJECT_SOURCE_DIR}")

# Apple xcode 15 has a completely broken std::source_location; we can't fix it, but at least we can
# hack up the source locations to hide the path that it uses (which is the useless path to
# oxen/log.hpp where the info/critical/etc. bodies are).
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
message(WARNING "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is broken: filenames in logging statements will not display properly")
oxen_logging_add_source_dir("${CMAKE_CURRENT_SOURCE_DIR}/oxen-libquic/external/oxen-logging/include/oxen")
endif()


if(CMAKE_C_COMPILER_LAUNCHER)
Expand Down Expand Up @@ -143,7 +164,7 @@ set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER "module" CACHE STRING "" FORCE)
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "")
set(protobuf_BUILD_PROTOBUF_BINARIES ON CACHE BOOL "" FORCE)
system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
libsession_system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
if(TARGET PkgConfig::PROTOBUF_LITE AND NOT TARGET protobuf::libprotobuf-lite)
add_library(protobuf::libprotobuf-lite ALIAS PkgConfig::PROTOBUF_LITE)
endif()
Expand Down Expand Up @@ -172,4 +193,4 @@ libsession_static_bundle(libzstd_static)

set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install ON CACHE INTERNAL "") # Required to export targets that we use
system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
libsession_system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
1 change: 0 additions & 1 deletion external/oxen-encoding
Submodule oxen-encoding deleted from a7de63
1 change: 1 addition & 0 deletions external/oxen-libquic
Submodule oxen-libquic added at 79d3f8
15 changes: 6 additions & 9 deletions include/session/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ class ConfigMessage {
std::optional<std::array<unsigned char, 64>> verified_signature_;

// This will be set during construction from configs based on the merge result:
// -1 means we had to merge one or more configs together into a new merged config
// >= 0 indicates the index of the config we used if we did not merge (i.e. there was only one
// nullopt means we had to merge one or more configs together into a new merged config
// If set to a value then the value is the index of the config we used (i.e. there was only one
// config, or there were multiple but one of them referenced all the others).
int unmerged_ = -1;
std::optional<size_t> unmerged_;

public:
constexpr static int DEFAULT_DIFF_LAGS = 5;
Expand Down Expand Up @@ -203,13 +203,13 @@ class ConfigMessage {
/// After loading multiple config files this flag indicates whether or not we had to produce a
/// new, merged configuration message (true) or did not need to merge (false). (For config
/// messages that were not loaded from serialized data this is always true).
bool merged() const { return unmerged_ == -1; }
bool merged() const { return !unmerged_; }

/// After loading multiple config files this field contains the index of the single config we
/// used if we didn't need to merge (that is: there was only one config or one config that
/// superceded all the others). If we had to merge (or this wasn't loaded from serialized
/// data), this will return -1.
int unmerged_index() const { return unmerged_; }
/// data), this will return std::nullopt.
const std::optional<size_t>& unmerged_index() const { return unmerged_; }

/// Read-only access to the optional verified signature if this message contained a valid,
/// verified signature when it was parsed. Returns nullopt otherwise (e.g. not loaded from
Expand Down Expand Up @@ -364,8 +364,6 @@ class MutableConfigMessage : public ConfigMessage {
/// - `dict` -- a `bt_dict_consumer` positioned at or before the "~" key where the signature is
/// expected. (If the bt_dict_consumer has already consumed the "~" key then this call will fail
/// as if the signature was missing).
/// - `config_msg` -- the full config message; this must be a view of the same data in memory that
/// `dict` is parsing (i.e. it cannot be a copy).
/// - `verifier` -- a callback to invoke to verify the signature of the message. If the callback is
/// empty then the signature will be ignored (it is neither required nor verified).
/// - `verified_signature` is a pointer to a std::optional array of signature data; if this is
Expand All @@ -381,7 +379,6 @@ class MutableConfigMessage : public ConfigMessage {
/// - throws on failure
void verify_config_sig(
oxenc::bt_dict_consumer dict,
ustring_view config_msg,
const ConfigMessage::verify_callable& verifier,
std::optional<std::array<unsigned char, 64>>* verified_signature = nullptr,
bool trust_signature = false);
Expand Down
Loading