Compare commits

...

2609 Commits

Author SHA1 Message Date
Jason Rhinelander 178ac1757b
Merge pull request #2199 from dr7ana/oxen-logging-bump
Oxen-logging version bump
10 months ago
dr7ana 9acac2c33e CI fixes
- oxen-logging updated to bump fmt version
- version bump oxen-logging to fix fmt version
- version bump oxen-mq to solve uniform distribution error
- misc errors introduced by above version bumps
- clang-format 14 -> 15
10 months ago
Jason Rhinelander e11f5018c2
Fix negative integer parsing 1 year ago
Jason Rhinelander a17753fddb
Merge pull request #2180 from majestrate/fix-2179-ipv6-upstream-dns-2023-05-20
libunbound ipv6 upstream dns syntax error
1 year ago
Jason Rhinelander ab606c48d4
Rename `add_braces` -> `ipv6_brackets`
"Braces" seemed misleading as usually that terms refers to `{}` rather
than `[]`, and also this only affects ipv6 addresses.
1 year ago
Jason Rhinelander 7f9b425332
Merge pull request #2182 from dr7ana/incomplete-issues
Added workflow to remove stale, incomplete issues
1 year ago
dan 0a98fb943d added workflow to remove stale issues 1 year ago
Jeff Becker fc050b3a09
fix issue #2179
when setting libunbound's upstream dns, we need to not pass in the square braces of an ipv6 address.
we also net udp handles have ipv6 address for the local ip.
1 year ago
Jason Rhinelander 559fa8aec4
Merge pull request #2173 from longyap/dev
add #include <cstdint>
1 year ago
GNU/LongYap 89c5c73be4
add #include <cstdint>
add #include <cstdint> to fix build error
1 year ago
Jason Rhinelander a294c81f0d
Python <3.11 compat fix 1 year ago
Jason Rhinelander b48e8b23ea
Merge pull request #2106 from majestrate/fix-config-comment-typo-2023-01-05
fix typo in config comments
1 year ago
majestrate 24bfbd5bc6
Merge pull request #2142 from jagerman/bencode-hex
Add automatic hex decoding to bencode-dump.py
1 year ago
Jason Rhinelander e255b87992
Add automatic hex decoding to bencode-dump.py
This allows bencode-dump.py autodetect hex input and decode it on the
fly, which is quite convenient when working with binary-containing
bencoded data strings.
1 year ago
majestrate 7d2ad5621b
Merge pull request #2139 from majestrate/fix-issue-2138-with-loop-call-2023-02-15
fix issue #2138
1 year ago
Jeff Becker d7d3a4e774
fix issue #2138
in rpc client, contention on a null lock happened.
fix this by making the sending of pings always done in the logic
thread. this is done by wrapping the lambda we made with EventLoop::make_caller()
1 year ago
Jason Rhinelander 366d0c1be9
Merge pull request #2128 from majestrate/oxend-defer-ping-2023-01-29
ping oxend after getting identity keys
1 year ago
majestrate 3de23c3eba
Merge pull request #2130 from XutaxKamay/dev
fix openwrt mips32 static build
1 year ago
Kamay Xutax 742b66c300 fix openwrt mips32 static build
libunbound needs to link against libatomic because of openssl
crypto (says EVP_sha256 missing otherwise in libunbound during build)
1 year ago
Jason Rhinelander 7fb36782dc
Merge pull request #2121 from drouhana/rpc-refactor
RPC refactor
1 year ago
dan 9bfe881a35 OMQ_Request handling logic change 1 year ago
dan b2e8cde64b working new endpoints
- added hotswap functionality
- map_exit and unmap_exit working
1 year ago
dan 0632e88de0 Make new header for json type conversions 1 year ago
Jeff Becker 02b392881b add llarp::service::Endpoint::map_exit 1 year ago
Jeff Becker 031e173f1a
ping oxend after getting identity keys
fixes #2125
1 year ago
dan d3e69fe3c5 added unmapexit and listexit endpoints 1 year ago
dan d37398a915 review comments 1 year ago
drouhana f6aa58482a
Merge branch 'dev' into rpc-refactor 1 year ago
dan 13b01c86a6 Updated RpcServer Initialization and Logic
-- Moved all RPCServer initialization logic to rpcserver constructor
    -- Fixed config logic, fxn binding to rpc address, fxn adding rpc cats
    -- router hive failed CI/CD resulting from outdated reference to rpcBindAddr
    -- ipc socket as default hidden from windows (for now)
refactored config endpoint
    - added rpc call script (contrib/omq-rpc.py)
    - added new fxns to .ini config stuff
    - added delete .ini file functionality to config endpoint
    - added edge case control for config endpoint

add commented out line in clang-form for header reorg later
1 year ago
Jeff Becker c682247f87
fix typo in config comments
lokinetN -> lokitunN
1 year ago
majestrate 7ae1a1a83b
Merge pull request #2108 from majestrate/service-refactor-2023-01-08
[internals refactor] docs and reorganize compilation units
1 year ago
Jeff Becker cd8316e287
add commented out line in clang-form for header reorg later 1 year ago
Jeff Becker 2498a085db
rearrange cmake libraries
define relations and document them.
make responsibilies clear and consice.
1 year ago
Jeff Becker 4508c59cd3
redo includes to be consistent 1 year ago
Jeff Becker 0ab050647f
overview of refactor plan and new component structure. 1 year ago
drouhana 0edfe8ff83
IPC Socket Fixes (#2111)
* Updated RpcServer Initialization and Logic

-- Moved all RPCServer initialization logic to rpcserver constructor
-- Fixed config logic, fxn binding to rpc address, fxn adding rpc cats
-- router hive failed CI/CD resulting from outdated reference to rpcBindAddr
-- ipc socket as default hidden from windows (for now)
1 year ago
majestrate 245f968d33
Merge pull request #2120 from tewinget/fix_syslog_target_arg
Fix incorrect usage of oxen-logging syslog
1 year ago
Thomas Winget fbfd70a35a Fix incorrect usage of oxen-logging syslog
Previously oxen-logging was erroneously hard-coded to use the target
"lokinet" for system logs.  Obviously this is wrong for anything else
which uses oxen-logging and the system log.  This changes our call to
add_sink to pass "lokinet" as the target rather than the config
filename, and updates oxen-logging to use that argument correctly.
1 year ago
majestrate ae9fd9a739
Merge pull request #2113 from drouhana/cli-refactor
testnet fixes
1 year ago
dan b31a266be8 testnet fixes
-- add ability to pass .ini path without --config flag
-- -r flag runs lokinet in router mode
1 year ago
drouhana a6b2172e54
Fix accepting config file as positional argument
re-add ability to pass .ini path without --config flag
1 year ago
Jason Rhinelander d1b6ccfbc3
Merge pull request #2109 from drouhana/cli-refactor
CLI Fixes
1 year ago
dan ea740ffd79 options.overwrite and options.force are redundant given refactor. they are now combined 1 year ago
dan 26beebca97 logic fix, commit to be stashed 1 year ago
dan b6991bb59a lokinet.cpp CLI and logic fixes
- added single dash to one letter flags to fix CLI incorrectconstruction error
- fixed generate file error
1 year ago
Jason Rhinelander 96c7f13744
Merge pull request #2107 from drouhana/cli-refactor
Command Line Interface Refactor
1 year ago
Jason Rhinelander 3d0fe8ecb7 Rename 'package' target on macos to 'dmg' to avoid cpack conflict
CLI11 uses cpack, which makes us fail to configure on macos because of
the 'package' target.  Renaming it to 'dmg' should avoid the conflict.
1 year ago
dan dc7f3cee22 Replace cxxopts with CLI11
- Simiplifies CLI code for future modification
- filesystem library linked in cmake check_for_std_filesystem file
1 year ago
Jason Rhinelander bf0dc52df7
Merge pull request #2104 from majestrate/openwrt-aarch64-fix-2023-01-03
add case for openwrt aarch64 in static deps
1 year ago
Jeff Becker dcd4623d2e
[win32 ci pipeline]
bookworm has no need for alternatives for mingw.

remove update-alternatives from the pipeline
1 year ago
Jeff Becker 1d84d630ea
add case for openwrt aarch64 in static deps
fixes #2103
1 year ago
Jason Rhinelander 9929445970
Fix poll_block_hash being set in the wrong place 2 years ago
Jason Rhinelander 8959e84595
Merge pull request #2079 from jagerman/bump-deps
Version bump for new release
2 years ago
Jason Rhinelander d9d3041dce
Bump version for fix release
In retrospect the last release really should have been called 0.10.0 and
this should be 0.10.1, but too late now.
2 years ago
Jason Rhinelander c3d212054a
Update deps to latest versions 2 years ago
majestrate e1f1b8b1c7
Merge pull request #2066 from jagerman/another-obsolete-bs
Remove another obsolete bootstrap
2 years ago
majestrate 9edda9f101
Merge pull request #2055 from jagerman/fix-option-names
Fix missing option names, make [lokid]:rpc required
2 years ago
majestrate 2c6e2e9472
Merge pull request #2076 from tewinget/more-verbose-logging
Fix Windows DNS issues
2 years ago
Thomas Winget 1e29465237 fix missing namespace 2 years ago
Thomas Winget c4c81cc9f8 I hate clang-format sometimes 2 years ago
Thomas Winget 3d71bbd1e4 log func should return a string instead 2 years ago
Thomas Winget d44ad497fd rvalue ref -> value 2 years ago
Thomas Winget 548ce5c3a2 invert packet direction on WINDIVERT_ADDRESS
We simply keep the WINDIVERT_ADDRESS struct given on recv, so when
using it for send we need to invert the direction (the Output bit)
2 years ago
Thomas Winget 5238c3f1a0 force windivert to recalc IP checksum 2 years ago
Thomas Winget 133cee0fd9 Remove obsolete/extraneous WouldLoop function
The DNS resolver code should not and can not be responsible for
preventing packet looping.
2 years ago
Thomas Winget a518e654c5 add much logging around dns and windivert 2 years ago
Jason Rhinelander e8d1361865
Remove another obsolete bootstrap
I found another defunct obsolete boostrap file on a few foundation
service nodes; this adds it to the list.
2 years ago
Jason Rhinelander 5345c60b30
Merge pull request #2065 from Bilb/fix-min-height-gui
fix: allow GUI window height as low as 600 for small screens
2 years ago
Audric Ackermann c57d8ef091 fix: allow GUI window height as low as 600 for small screens 2 years ago
Jason Rhinelander f9db657f64
Make Default&Required or Required&Hidden compilation failures
Default & Required makes no sense: if we have a default it makes no
sense to make it required.  The previous behaviour when this was
specified was to force an (uncommented) value in the config with the
value, but this was only used in the test suite.

Required & Hidden makes no sense either: if it's required to be
specified we definitely don't want to hide it from the generated config
file.

These are now compile-time failures.
2 years ago
Jason Rhinelander 68bb74a95d
Make [lokid]:rpc setting required in SN mode
When running as a service node we can't do anything without a lokid rpc
URL, and we don't necessarily have a good default for it.

This makes it required so that we fail with an appropriate error message
(rather than connect timeouts) if it is not specified.
2 years ago
Jason Rhinelander c8ce78315d
Fix missing option names
At some point between 0.9.9 and 0.9.10 we removed the printing of option
names when a value doesn't have a default, but this means the config is
littered with things like:

    # This option sets the greater foo value.

with no actual option name printed out when there is no default.

This fixes it by always printing the option name in such a case, just
with an empty value, e.g.:

    # This option sets the greater foo value.
    #big-foo=
2 years ago
Jason Rhinelander 7906fac4f0
Merge pull request #2053 from jagerman/mac-dmg-bg
Make dmg background retina capable
2 years ago
Jason Rhinelander 7f3cb0ff38 Make dmg background retina capable
The bg has to get encoded in a multi-format TIFF to make it work.

Also increase the vertical size a bit so that it still looks okay in
case you are a crazy person with a bunch of toolbars and other junk
cluttering up the window.
2 years ago
majestrate 4b5ab4bde3
Merge pull request #2051 from jagerman/mac-dmg-bg
Add mac .dmg background
2 years ago
Jason Rhinelander 135664ccb0 Add mac .dmg background 2 years ago
majestrate 27fd4d8faf
Merge pull request #2049 from majestrate/add-omitted-header-2022-11-08
add omitted header
2 years ago
Thomas Winget bb14a7bd09
when in rome, remove duplicate includes 2 years ago
Jeff Becker 259114b51d
add omitted header
certain files needed to include either fstream and our shim for std::filesystem.
this includes fstream into our shim and includes this shim in places
that require fstream. this is done because some toolchains (cough
cough broke af arch linux amalgums) can have weird subsets of the
requirements of C++17 that overlap, except when they dont, denoted by
unknowable undisclosed circumstances.

this issue was reported by a user in the wild, and this fixes it.
2 years ago
Jason Rhinelander 4f1f336e50
Bump openssl static build version 2 years ago
majestrate 7325878afd
Merge pull request #2048 from majestrate/simplify-ons-ready-logic-2022-11-03
simplify llarp::service::Endpoint::ReadyToDoLookup()
2 years ago
majestrate 29da2a9943
Update llarp/service/endpoint.cpp
Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2 years ago
Jeff Becker e5efe793ca
llarp::service::Endpoint::ReadyToDoLookup()
previously we had a checking style function that passes in an optional
defaulting to nullopt as a micro optimzation, this makes the code
unnessarily obtuse.

simplify this by splitting up into 2 functions,
one for getting the unique endpoints and one for checking if the
number of them is above the minimum.

add overload for ReadyToDoLookup() that checks against constant but
can do more in the future if desired to reduce the burden on future contributors.
2 years ago
Jason Rhinelander 9dfb4a389c
Update gui subproject 2 years ago
majestrate b67a70517d
Merge pull request #2046 from majestrate/fix-lokinet-vpn-2022-11-02
prevent throwing on no error in lokinet-vpn
2 years ago
Jeff Becker 0cf637178d
prevent throwing on no error in lokinet-vpn 2 years ago
Jeff Becker 0bb58b4ac0
dont hardcode keyid 2 years ago
Jeff Becker 88b5a84df3
explicitly select signing key used in source tarball signing script 2 years ago
Jeff Becker 9adf099d20
remove dead file 2 years ago
majestrate 8ec1a57dac
correct documentation
the `make format` target doesn't exist anymore as we moved it to a shell script.
2 years ago
majestrate bcaf9f886c
point to explicit link
linking to docs directory is technically not correct. we should link to the file github shows for preview which is docs/readme.md
2 years ago
majestrate 9ca0d7094e
update note about platform support
android is currently unsupported
2 years ago
majestrate 1c51bb1041
Merge pull request #2045 from majestrate/windows-service-issues
windows platform bug fixes
2 years ago
Jeff Becker d911e26b1d
remove duplicate log statement 2 years ago
Jeff Becker 3a8007cc3f
remove assert()
we_changed_our_state can accept the state we are in right now, so this
assert no longer is correct.
2 years ago
Jason Rhinelander 6a110a4f1b
RPC: fix "halt" command 2 years ago
Jason Rhinelander 3bc3ae9d84
patch unbound to fix windows shutdown crash 2 years ago
Jason Rhinelander 40348b24e1
Fix crash on unbound cleanup
We need to make a copy here because (see comment).
2 years ago
Jason Rhinelander b8678a767e
Fix crashy race condition in shutdown
Query->Cancel() will remove the Query, but that introduces a race
condition where unbound may still try to invoke the callback (with a
no-longer-valid pointer) if we do it before the ub_ctx_delete call.

Move to it afterwards so that we only cancel things that unbound didn't
2 years ago
Jeff Becker 9aa6b64c1e
use std::shared_ptr for pending queries 2 years ago
Jason Rhinelander c7a133ac9c
windivert: avoid trying to send during shutdown
Occasionally during shutdown windivert will crash because a thread tries
sending after we've called wd::shutdown, which isn't allowed.  Add an
atomic bool to prevent this.
2 years ago
Jason Rhinelander cdc4c486c4
Add more stopping signals 2 years ago
Jason Rhinelander 2b5f1ee029
Remove bad assert
We do and should be able to call this multiple times during shutdown to
signal that we are advancing through shutdown.
2 years ago
Jason Rhinelander 3d429b353a
Don't raise log level on shutdown
If already below info (e.g. debug) it should stay there; we only want to
*lower* it to info if above info.
2 years ago
Thomas Winget 9960aed45c
stop-time debug statements 2 years ago
Jeff Becker 57b77fecb3
fix crash on shutdown
we were calling llarp::Context::HandleSignal from a non mainloop
thread when running as a win32 service. this caused issues with a non
clean destruction.

call our signal handler instead of llarp::Context::HandleSignal
2 years ago
Thomas Winget dceef0b21e
remove dead dns resolver code 2 years ago
Jason Rhinelander 95c0c8a707
Improve windows running-as-a-service detection works
Get rid of the --win32-daemon hack (which was removed from the service
itself earlier in this PR, by mistake) and replace it with detection of
the error code for "not running as a service" that windows gives us back
if we try to set up service controller dispatching but aren't a service.
2 years ago
Jason Rhinelander 4ad66ac2a5
Remove unused VERSION_STR constant 2 years ago
Jason Rhinelander 5be7dbf8ec
Move log init even earlier 2 years ago
Jeff Becker 3b6cbec08e
fix typo in filename 2 years ago
Jeff Becker a16af792d2
simplify logic for disabling service manager on windows 2 years ago
majestrate 84834089d1
Update llarp/router/router.cpp
use `fmt::join` for lokinet version string in status

Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2 years ago
Jason Rhinelander 31c312ad41
Extend windows startup timeout
If wintun fails it seems to take about 15s, so extend the startup
timeout so that it can fail gracefully (and let us clean up before
exiting).

Also refactors the timeouts to chrono constants.
2 years ago
Jason Rhinelander 71bea4f0fc
Add networkReady to stats result 2 years ago
Jason Rhinelander bd5efd8149
Update gui to latest 2 years ago
Jason Rhinelander 5c12110e93
Add some more debugging 2 years ago
Jason Rhinelander 64cf268457
Fix crashes in wintun and windivert stopping
Fixes windows shutdown crashes:

- windivert wasn't handling an ERROR_NO_DATA, which it gets when
  finished handling everything after a shutdown.
- wintun ReadPacket still gets invoked after end_session is called, but
  shouldn't be.  This adds an atomic<bool> to early return.
- fixes up some settings we send for windows service manager notify
2 years ago
Jason Rhinelander 879e678771
Remove dead/redundant code
- win32_platform.cpp is dead
- win32_platform.hpp is useless

Style changes from clang-tidy warnings:
- remove `virtual` from some definitions that already have `override`
- remove virtual destructor from NetworkInterface because it already has
  a virtual destructor via the base type (and clang-tiny warns about it)
2 years ago
Jeff Becker 4103908a8d
system layer manager (llarp::sys::service_manager)
the win32 and sd_notify components provided a disjointed set of
similar high level functionality so we consolidate these duplicate
code paths into one that has the same lifecycle regardless of platform
to reduce complexity of this feature.

this new component is responsible for reporting state changes to the
system layer and optionally propagating state change to lokinet
requested by the system layer (used by windows service).
2 years ago
Jeff Becker a7f3c3595b
fix comment to reflect reality 2 years ago
Thomas Winget 7ddad87dbf some useful log statements 2 years ago
Jeff Becker 9cdfae2e42
correct windows service manager behavior.
report status to window service manager when we get and iterogate
message from the service manager.
update comments to reflect these changes.
2 years ago
Thomas Winget a9a2a115bc
debian missing yacc apparently all of a sudden 2 years ago
Thomas Winget fcc4f6050d
wait until actually stopped to tell windows we are
We should send STOP_PENDING rather than STOPPED while we aren't yet
actually stopped; STOPPED is already sent when we actually finish
stopping.

Also fixes some silly argc/argv shenanigans, I think.
2 years ago
majestrate e8055a05ad
Merge pull request #2039 from jagerman/shorter-gossip-times
Shorten gossip times in systemd status line
2 years ago
Jason Rhinelander b6924f3ef1
Replace duration/timestamp formats with functions
We're defining formats for std::chrono types, which feels wrong (because
fmt itself also has these), so just replace them with functions:

short_time_from_now(...) gives a short "in 14m12s" or "5.123s ago" time
span relative to now, given a time point.  Precision gets reduced for
larger deviations from now (e.g. "4h12m ago").

ToString(Duration_t) gives a string such as "-3h22m02.123s" for a
duration.
2 years ago
majestrate d91c82c623
Merge pull request #2038 from majestrate/bind-fix-2022-10-26
proper handling of public ips
2 years ago
Jason Rhinelander 67e002c8ee
Fix time_delta<seconds> formatting in milliseconds
The time_delta<T> was using the wrong duration type when formatting, so
was outputting millisecond precision in the systemd status string which
is pointless (and unintended).
2 years ago
Jason Rhinelander 9f10e8003e
Remove useless iterator assignments
A back_inserter doesn't change when you insert onto it.
2 years ago
majestrate 3d0bc4a76c
Merge pull request #2037 from jagerman/ico-using-rsvg-convert
Use rsvg instead of imagemagick to make windows .ico; split up windows build
2 years ago
Jeff Becker 1e5b5ca1f5
proper handling of public ips
in service node mode make sure that when overriding public ip we only
fail when using 2 different public ip.
2 years ago
Jason Rhinelander 491f452dd7
Windows prebuilt gui fixes
Currently you can't use GUI_EXE without BUILD_GUI, but BUILD_GUI also
requires the yarn command (even though it will never use it when GUI_EXE
is set).

This commit fixes it:

- Make `GUI_EXE` a windows-only top-level project options, rather than
  being guarded by `BUILD_GUI`.
- Make `BUILD_GUI` control *building* the GUI instead of bundling it.
- GUI_EXE and BUILD_GUI are now mutually exclusive.
2 years ago
Jason Rhinelander caf97b1861
Split windows into gui/main builds, main now builds on bookworm
The options we need in rsvg-convert are apparently too new for bullseye,
so split the build so that we do the gui separately (in the nodejs-lts
container) and then build lokinet in bookworm.
2 years ago
Jason Rhinelander 11e052cb39
Add rsvg-convert dep to windows readme 2 years ago
Jason Rhinelander c8aa53a456
Use rsvg instead of imagemagick to make windows .ico
imagemagick is messing up the conversion, so just avoid it entirely and
use rsvg-convert directly to do it instead.
2 years ago
Jason Rhinelander 09c05d8206
Merge pull request #2036 from jagerman/win-x64
Use Windows-y 'x64' instead of '64bit' in static upload
2 years ago
Jason Rhinelander 6be4621aea
Use Windows-y 'x64' instead of '64bit' in static upload 2 years ago
majestrate 4c9d076c10
Merge pull request #2034 from jagerman/fix-router-startup
Fix router startup
2 years ago
majestrate 359ea1a3cd
Merge pull request #2033 from jagerman/fix-conf-backcompat
Fix backwards compatible config option handler
2 years ago
Jason Rhinelander 1980ca4d59 Fix bootstrap list bad bootstrap skipping
The iterator here to skip an obsolete bootstrap wasn't properly
reassigning the iterator, so "didn't work" (though why it was hanging
for me is entirely non-obvious).

Also refactored it to simplify/clarify it a bit.
2 years ago
Jason Rhinelander a828ef3f6d Remove obsolete junk
This stuff is already set earlier, in Configure.
2 years ago
Jason Rhinelander 9f49e006e4 Debug Router::Configure; initialize logging earlier
- Move logging initialization to early in Configure rather than at the
  end of FromConfig so that we can add debug logging inside
  Configure/FromConfig/etc.

- add said debug logging to Configure/FromConfig/etc.
2 years ago
Jason Rhinelander 3131297b00
Fix backwards compatible config option handler
Without this, old config (with now-irrelevant settings) won't work in
newer lokinet, making lokinet fatal error on startup if one of the
no-longer-used options is still present.
2 years ago
majestrate e8a27d1db3
Merge pull request #2032 from tewinget/pinned_node_config_cleanup
clarify strict-connect usage and enforce minimum of 2 nodes
2 years ago
majestrate 36dbbd19bf
Merge pull request #2031 from tewinget/get_status_ready_flag
add 'networkReady' to endpoint status
2 years ago
Thomas Winget 3b6953badc clarify strict-connect usage and enforce minimum of 2 nodes 2 years ago
Thomas Winget 1231d4e6c4 add 'networkReady' to endpoint status 2 years ago
majestrate cc2bbc20ca
Merge pull request #2030 from majestrate/issue-2029-keyfile-errors-2022-10-24
llarp_buffer_t idiocy
2 years ago
Jeff Becker bd5da10885
fixes issue #2029
when read/writing a .loki privkey file we dont rewind a llarp_buffer_t
after use. this is an argument in favor of just removing that type
from the code entirely.

fixes by using 2 distinct locally scoped llarp_buffer_t, one for read,
one for write.
2 years ago
majestrate cd858a00ea
Merge pull request #2027 from jagerman/clang-format-14
Bump clang-format to 14
2 years ago
majestrate 37ddecbd20
Merge pull request #2024 from jagerman/dep-updates
Dep updates
2 years ago
majestrate bb904294b1
Merge pull request #2023 from jagerman/drone-fixes
Drone fixes
2 years ago
Jason Rhinelander d011f8fb4a
Bump clang-format to 14 2 years ago
Jason Rhinelander 02108f0504
Merge pull request #2021 from tewinget/route-metric-preference
select gateway with lowest metric
2 years ago
Jason Rhinelander f01b075d3e
Rename darwin -> macos in uploaded build file 2 years ago
Jason Rhinelander f2454285fe
Set _WIN32_WINNT in static deps
Set -D_WIN32_WINNT for static deps; unbound, in particular, needs this
as the latest version appears to rely on something only provided in
non-ancient windows to build properly.

This required moving _winver into the toolchain file so that it is
available earlier in cmake code (StaticBuild is included long before
win32.cmake), but also this seems a more appropriate place for it.
2 years ago
Jason Rhinelander 0e09539b61 CI fixes
- cd .. after the build, before running extra_cmds, because the scripts
  we invoke expect to be in the root, not in the build dir (and it's
  dirtier for the build function to not undo the `cd build` that it
  runs).
- fix unclosed parenthesis in mac static lib checker
2 years ago
Jason Rhinelander 081dfd3328 Update submodules to latest version:
cpr: 1.9.2
cxxopts: 3.0.0
ghc-filesystem: 1.5.12
nlohmann-json: 3.11.2
pybind11: 2.10.0
sqlite_orm: 1.7.1

Plus other updates need to make these work:
- cpr needs a cprver.h configured with the version (cmake code copied
  from oxen-core).
2 years ago
Jason Rhinelander 0ed3d51aa2 Update static deps to latest stable versions 2 years ago
majestrate 86c3b2f4ae
Merge pull request #2019 from jagerman/config-reformat
Config setting documentation edits
2 years ago
Thomas Winget 0c0ba29bae use first gateway, not last... 2 years ago
Jason Rhinelander c3a515da49
Config setting documentation edits
Rewords/reformats the documentation of various configuration options.
2 years ago
jeff 011bd2e84f format 2 years ago
Jeff Becker e5b7ea5f2d
dont do queries while down 2 years ago
Jeff Becker 082756c64c
cancel pending queries on down.
after calling Down() any pending queries will not be properly
canceled and results in a crash when we destruct the queries on our side.
2 years ago
Jeff Becker 306d54e285
when running as a client squelch warnings about snode status and make sure we connect out 2 years ago
majestrate 8f532dec89
Merge pull request #2015 from jagerman/oxend-rpc-updates
Oxend RPC updates
2 years ago
jeff 6813dd659c lint 2 years ago
majestrate 9176ab1157
Merge pull request #2014 from jagerman/fix-sockaddr-ordering
Fix multi-field ordering
2 years ago
majestrate 666642f906
Merge pull request #2016 from jagerman/zlib-bump
zlib version bump
2 years ago
Jason Rhinelander e143bd13cd
zlib version bump 2 years ago
Jason Rhinelander c5e787b8cb Oxend error ping + unfunded tracking
Currently (from a recent PR) we aren't pinging oxend if not active, but
that behaviour ended up being quite wrong because lokinet needs to ping
even when decommissioned or deregistered (when decommissioned we need
the ping to get commissioned again, and if not registered we need the
ping to get past the "lokinet isn't pinging" nag screen to prepare a
registration).

This considerably revises the pinging behaviour:

- We ping oxend *unless* there is a specific error with our connections
  (i.e. we *should* be establishing peer connections but don't have any)
- If we do have such an error, we send a new oxend "error" ping to
  report the error to oxend and get oxend to hold off on sending uptime
  proofs.

Along the way this also changes how we handle the current node state:
instead of just tracking deregistered/decommissioned, we now track three
states:

- LooksRegistered -- which means the SN is known to the network (but not
  necessarily active or fully staked)
- LooksFunded -- which means it is known *and* is fully funded, but not
  necessarily active
- LooksDecommissioned -- which means it is known, funded, and not
  currently active (which implies decommissioned).

The funded (or more precisely, unfunded) state is now tracked in
rc_lookup_handler in a "greenlist" -- i.e. new SNs that are so new (i.e.
"green") that they aren't even fully staked or active yet.
2 years ago
Jason Rhinelander bd869b3b07 Log demotion
Demote a couple spammy messages to trace level.
2 years ago
Jason Rhinelander 0e576ff59e Clean up oxend service node list handling
This aligns service node updating logic a bit closer to what happens in
storage server, and should make it a bit more resilient, hopefully
tracking down the (off-Github) reported issue where lokinet sometimes
doesn't see itself as active.

- Initiate a service node list update in the 30s timer lokinet ping
  timer (in case we miss a block notify for some reason); although this
  is expensive, the next point mitigates it:

- Retrieve the block hash with the SN state update, and feed it back
  into the next get_service_nodes call (as "poll_block_hash") so that
  oxend just sends back a mostly-empty response when the block hasn't
  changed, allowing both oxend and lokinet to skip nearly all of the
  work of a service node list update when the block hasn't changed since
  the last poll.  (This was already partially implemenated--we were
  already looking for "unchanged"--but without a block hash to get from
  and pass back to oxend we'd never actually get an "unchanged" result).

- Tighten up the service node list handling by moving the "unchanged"
  handling into the get_service_nodes response handler: this way the
  HandleNewServiceNodeList function is only handling the list but not
  the logic as to whether there actually is a new list or not.
2 years ago
Jason Rhinelander 36792d4337
Fix multi-field < ordering
Lots and lots of places in the code had broken < operators because they
are returning something like:

    foo < other.foo or bar < other.bar;

but this breaks both the strict weak ordering requirements that are
required for the "Compare" requirement for things like
std::map/set/priority_queue.

For example:

    a = {.foo=1, .bar=3}
    b = {.foo=3, .bar=1}

does not have an ordering over a and b (both `a < b` and `b < a` are
satisfied at the same time).

This needs to be instead something like:

    foo < other.foo or (foo == other.foo and bar < other.bar)

but that's a bit clunkier, and it is easier to use std::tie for tuple's
built-in < comparison which does the right thing:

    std::tie(foo, bar) < std::tie(other.foo, other.bar)

(Initially I noticed this in SockAddr/sockaddr_in6, but upon further
investigation this extends to the major of multi-field `operator<`'s.)

This fixes it by using std::tie (or something similar) everywhere we are
doing multi-field inequalities.
2 years ago
majestrate 54fba30516
Merge pull request #2008 from jagerman/win32-routepoker-logging
Add more logging around route poking conditions
2 years ago
Jason Rhinelander bc071231c8
Add a net::ToString() to help stringify ipaddr_t
Android, in particular, has problems with fmt's built-in variant
handling for this type for some reason.
2 years ago
Jason Rhinelander 25d73d627a
Remake non-mac icon; regenerate during build for windows
The non-mac icon was an old version with white foreground and a
completely transparent background, but this looks bad (or invisible)
depending on where you view it.  This updates it based on the macos
icon, but with a round white circle background instead of the macos
"squircle" background.

This also replaces the .ico file for the installer with one that we
build during the win32 build rather than a pregenerated one.

Bumps the gui as well to a version with the new icons in place.
2 years ago
Jason Rhinelander 768e953522
De-prioritize some windivert logging
We don't really need to log at info level for every
windivert-intercepted incoming and outgoing packet.
2 years ago
Jason Rhinelander 6f31d5108b
Windows fix: iterate over IPv4/IPv6 interfaces separately
If we get back an IPv6 address as the first gateway then we won't have
the expected IPv4 gateway that the route poker needs to operate.

This iterates through them separately so that we treat the IPv4 and IPv6
sides of an address as separate interfaces which should allow the route
poker to find the one it wants (and just skip the IPv6 one).
2 years ago
Jason Rhinelander e398b5bff8
Fix interface enumeration on posix
The last interface wouldn't be considered.
2 years ago
Jason Rhinelander fe0f916a09
DRY private range selection; add missing ranges
DRY a chunk of repeated code for finding a free private range.

Also fix it so that it will consider 10.255.0.1/16 and 192.168.255.1/24
(previously it would only check up to octet 254).
2 years ago
Jason Rhinelander d10c4b9d17
Add more logging around route poking conditions
Log why we aren't doing anything if we aren't going to do anything.
2 years ago
Jason Rhinelander 4bf80833f4
Add InterfaceInfo formatter 2 years ago
Jason Rhinelander bd8dffc730
Merge pull request #1991 from jagerman/lokinet-vpn-cleanups
Lokinet vpn cleanups
2 years ago
Jason Rhinelander ba6a3f0e80
Merge pull request #1996 from tewinget/fallback-bootstrap
Fallback bootstrap router build parameter, ignore obsolete bootstrap routers
2 years ago
Jason Rhinelander 9a2cd19eb8
Fix obsolete oxenmq/hex.h usage 2 years ago
Jason Rhinelander 6ee7306217
oxen-mq update to tagged stable release 2 years ago
Jason Rhinelander 82e2e6fb10
bake in bootstrap fallbacks at build time
also change the defailt/fallback bootstrap file for testnet to be a list
of RCs (albeit of size 1) rather than just an RC dict.
2 years ago
Thomas Winget 82c95a2486
don't ping core if active with too few peers
If running as a service node, we ping core on a regular interval to
inform it we're running and in a good state.  If we're an active
(not decommissioned or deregistered) service node and have too few
peers and thus we're not actually connected to lokinet, we should skip
that ping so core doesn't think we're ok.
2 years ago
Thomas Winget cc1bcf86fa
Fallback bootstrap router build parameter
Adds a fallback bootstrap file path parameter to CMake, specify
-DBOOTSTRAP_SYSTEM_PATH="/path/to/file" to use.

Adds a list of (currently 1) obsolete bootstrap RouterIDs to check
bootstrap RCs against.  Will not use bootstrap RCs if they're on that
list.

Log an error periodically if we appear to be an active service node but
have fewer than a set number (5) known peers.

Bumps oxen-logging version for literal _format.
2 years ago
Jason Rhinelander 20281ccc60
Clean up/simplify SN list handling 2 years ago
Jason Rhinelander ebdb37ac77
Significantly decrease decomm warning frequency
30s is insanely fast for a error level log statement and spams logs
incessantly; reduce it to repeating once every 5 minutes.
2 years ago
Jason Rhinelander d944b6542c
Merge pull request #1997 from tewinget/omq-rpc-logs
omq rpc log subscription
2 years ago
Jason Rhinelander 3276ed1d71
Bump lokinet-gui to latest
For log support, and other various changes/improvements.
2 years ago
Jason Rhinelander bac3f9dca1
fix macos assemble_gui dependency
The `sign` target on macos was not working properly -- the signing
script would run before the build is finished.  This was caused by
cmake/macos.cmake having an `if(BUILD_GUI)`, but BUILD_GUI isn't defined
as an option until cmake/gui.cmake, which hadn't been included yet where
macos.cmake was included.

This extracts just the `option(BUIL_GUI)` from gui.cmake into a separate
gui-option.cmake file that we can load earlier to fix it.

While here I also noticed the GUI_EXE setting was defined as an option,
but isn't actually a boolean value, as an option, but isn't actually a
boolean value, so fixed it by making it a `set(... CACHE FILEPATH ...)`.
2 years ago
Jason Rhinelander 9f258700b7
Lower log level for renewals to debug
Otherwise you see a lot of unnecessary subscription renewals every 30s
in the logs.
2 years ago
Jason Rhinelander dc358a6eda
macos: Fix hanging --start when Lokinet already running
If you stop/start the GUI but it doesn't exit on start, the second
--start (when lokinet is already running) waits for a state change that
doesn't come (because lokinet is already running).  This add a check for
already-running so that we exit right away in such a case.
2 years ago
Jason Rhinelander 307ae40e00
Apple: fix build failure when file already exists
The tools to create a dmg on Apple are flakey, of course, and fail in
cryptic ways if the file already exists, so purge it in the
contrib/mac.sh script.
2 years ago
Jason Rhinelander c4c5d128c3
Add ring buffer sink to macos build 2 years ago
Thomas Winget eaf30de1fd
omq rpc log subscription
respects whether RPC is enabled, removes the log sink otherwise

bumps oxen-mq and oxen-logging
2 years ago
Jason Rhinelander fc07b8a10e
Merge pull request #2005 from jagerman/profiling-bencode-refactor
file slurp/dump and profiling refactor
2 years ago
Jason Rhinelander 006394315d
Add local mirror to most jobs; build script cleanups 2 years ago
Jason Rhinelander fae527517d
Try to appease android's crappy toolchain 2 years ago
Jason Rhinelander 75e382604b
Bump required oxenc version 2 years ago
Jason Rhinelander f641c08e80
llarp/profiling: refactor to use oxenc producer/consumer
No more llarp_buffer_t here!

(I was tracking down a segfault which led me in here and it was easier
to rewrite this to use bt_dict_{consumer,producer} than to decipher all
the cursed llarp_buffer_t and bencode callback nest).
2 years ago
Jason Rhinelander d335527a70
Add binary file slurp/dump utility functions
We have basically this same bit of code in tons of places; consolidate
it into llarp::util::slurp_file/llarp::util::dump_file.

Also renames all the extra junk that crept into llarp/util/fs.hpp out of
there into llarp/util/file.hpp instead.
2 years ago
Jason Rhinelander 3891141755
Merge pull request #2004 from jagerman/mac-icon-rework
Rewrite and tweak the macos icon
2 years ago
Jason Rhinelander ca26b20b2f
Scale down the inner part of the logo a bit 2 years ago
Jason Rhinelander 6b352c7fd8
Rewrite and tweak the macos icon
The old one was way too big on mac relative to other icons.  This scales
the background down, while keeping the black logo parts the same, and
changes the rounding of the corners to match native macos apps.

This also rewrites it from scratch to use a useful coordinate system
which allows drawing all the fundamentals in much more useful units.
2 years ago
Jason Rhinelander 66c79b232a
Fix log warning 2 years ago
Jason Rhinelander ab11a8128d
lokinet-vpn: misc cleanups
- Add a function to extract a value from parsed options, to DRY out the
  code a little bit.
- Add a exit_error function to format a message to stdout and then
  return the code, to simplify the repeated print-and-return code used
  when errors occur.
- Use fmt for output formatting
- Add an error if multiple modes are specified at once
  (--up/--down/--status/--exit)
- Add error printing around unmap
2 years ago
Jason Rhinelander f8f7f20666
Rename LMQ -> OMQ 2 years ago
Jason Rhinelander 71ea4f4fa2
RPC: Relax token/range argument handling
- Accept empty string or `null` for token to mean "no token."
- Accept `null` for range to mean "default range."
- Don't use a default range (::0/0) in lokinet-vpn because this will
  fail if IPv6 ranges aren't supported on the platform (e.g. on
  Windows), and isn't necessary: if we omit it then the rpc code already
  uses ::0/0 or 0.0.0.0/0 by default, as needed.
2 years ago
Jason Rhinelander 8b321612da
Merge pull request #1969 from majestrate/wintun-windivert-2022-08-02
use wintun and windivert for windows platform bits
2 years ago
majestrate f777075893
Merge pull request #1986 from majestrate/docs-2022-09-04
restructure readme and docs
2 years ago
Jason Rhinelander 90be75d04e
Disable mips cross compile build on ci 2 years ago
Jason Rhinelander 9529553cf6
Add oxen build mirror to linux static builds 2 years ago
Jason Rhinelander 83f7e8193c
Disable installer path modification
This is not likely to be usable to many people, and people who it *is*
useful for are knowledgeable enough to modify it themselves.  Most users
get no use at all and it most likely just confuses them instead.
2 years ago
Jason Rhinelander 2709ec1930
Android build fixes for openssl 3.0.5
- ANDROID_NDK_ROOT must be set in env
- cmake should be setting `-DANDROID_API=23`
- specify the correct android API via a define when building openssl; it
  has to be in CPPFLAGS (not CFLAGS) because otherwise openssl's
  configure script doesn't notice and overrides our define with the
  latest API version.
- openssl configure puts $(ANDROID_NDK_ROOT) in the makefile, so we have
  to be sure that we put it in the environment for the build command,
  too.
2 years ago
Jason Rhinelander 616f559761
macos CI fixes
- Split up mac.sh into a configure + build scripts (like Windows).
- Don't attempt to build the 'package' target in CI: apparently you have
  to have a logged in user at the GUI in order to build a .dmg because
  being obtuse is the Apple way.
- Upload the raw Lokinet unsigned app in a .tar.xz, rather than dmg,
  because of the above.
- make mac.sh respect JOBS (pun not intended (but still good))
2 years ago
Jason Rhinelander 1f9779cdcd
Windows compilation fix 2 years ago
Jason Rhinelander b2cd9a9eec
openssl 3 build fixes
SYSTEM/MACHINE apparently doesn't work anymore and you have to pass the
system-machine value into the (cursed nasty hacky perl) configure
script.
2 years ago
Jason Rhinelander 7078ab06bc
compiler warnings cmake 3.13 compatibility fix 2 years ago
Jason Rhinelander 93c01623b0
Format fixes & fix warning in format script
- Don't escape '#' in the greps in format.sh: they warn about a spurious
  `\` in the latest grep.
- reformat
2 years ago
Jason Rhinelander ec91a6db05
ReconfigureDNS fixes, fixes macos exit mode
- ReconfigureDNS wasn't returning the old servers; made it void instead
  (the Apple code can just store a copy of the original upstream
  servers instead).
- Reconfiguring DNS reset the unbound context but didn't replace it, so
  a Down()/Up() would crash.
- Simplify Resolver() destructor to just call Down(), and make it final
  just so that no one tries to inherit from us (so that calling a
  virtual function from the destructor is safe).
- Rename CancelPendingQueries() to Down(); the former cancelled but also
  shut down the object, so the name seemed a bit misleading.
- Rename SetInternalState in Resolver_Base to ResetResolver, so that we
  aren't conflicting with ResetInternalState from Endpoint (which was a
  problem because TunEndpoint inherited from both; it could be resolved
  through the different argument type if we removed the default, but
  that seems gross).
- Make Resolver use a bare unbound context pointer rather than a
  shared_ptr; since Resolver (now) entirely manages it already we don't
  need an extra management layer, and it saves a bunch of `.get()`s.
2 years ago
Jason Rhinelander 2ccc518849
Fix apple dns, part 817 2 years ago
Jeff Becker bd09f7716d
override method 2 years ago
Jeff Becker 13d1301e08
rewire up dns reconfiguration for macos 2 years ago
Jason Rhinelander 52c6cd497f
Apple DNS fix WIP 2 years ago
Jason Rhinelander 2aae56b0e0
Apple DNS configuration fix: don't obliterate trampoline
On Apple, the network extension is outside the tunnel routing, so we
cannot have libunbound talk directly to upstream (it would leak DNS when
exit mode is enabled).  Instead unbound *always* talks to a localhost
port where we have a "dns trampoline" that takes UDP packets and shoves
them through the tunnel.

We were doing that already, but recent changes here were overwriting the
libunbound settings with.

This also moves the upstream DNS configuration part of `Up()` into its
own method.
2 years ago
Jason Rhinelander 4d920bb2e2
Fix macos
We don't have a resolver on macos, so we were running through this loop
with fails == 0 == m_Impls.size() and throwing, crashing the process.

Early return to avoid the failure and fix macos crash.
2 years ago
Jeff Becker b81ae95246
remove hunk of win32 specific code, it is dead in this codepath 2 years ago
Jason Rhinelander 27d58044c7
macos compilation fixes 2 years ago
Jason Rhinelander a82907bc6c
Set various -W flags on apple
Apple supports anything here that Clang supports and should have them
set the same as everywhere else.

Most importantly this gives apple the -Wno-deprecated-declarations flag
which has been driving me nuts on macos.

This also version-gates the -Wno-deprecated-declarations so that it
will turn on again when we bump the version beyond .10.
2 years ago
Jason Rhinelander c7597c1abd
OpenSSL 1.1.1 -> 3.0.5 2 years ago
Jeff Becker 379ac755ec
make unit tests pass
changes to how config defaults, specifically allowing defaults to be a
vector, broke unit test compilation. this makes them compile again.
2 years ago
Jason Rhinelander 291f311259
Fix linked list iteration for windows ip/gateways
We were requiring `->Next` be true, which means we skipped the last (and
often only) entry of the linked lists and so never properly found the
gateway.
2 years ago
Jason Rhinelander 9097435f64
Refactor/fix GetAdaptersAddresses
- We need to pass a flag to get Windows to include gateway info.
- Refactor it to use microsoft's recommended magic default 15000 buffer
  size and repeat in a loop a few times until it works.  Developers,
  developers, developers, developers!
2 years ago
Jason Rhinelander d1e997177d
Add missing != operator to nuint_t 2 years ago
Jason Rhinelander 613459401d
Linux route poker fixes
- don't add routes when not in exit mode
- don't call Up() from rpc code (the RouterPoker itself decides when to
  call Up())
2 years ago
Jason Rhinelander e9554c7c5e
Don't do route poking when disabled
IsEnabled() is a bit broader than just IsServiceNode, so use it instead.
2 years ago
Jason Rhinelander 45b3365002
Simplifications
- a `static` is less verbose and otherwise identical to an empty
  namespace for a single declaration like this.
- operator== on two optionals already does exactly what the `is_equal`
  lambda here is doing.
- formatting
2 years ago
Jason Rhinelander 517911b499
Fix crash on shutdown
For some (wrong) reason this chunk of code was here.  Removed it to stop
a crash on shutdown.
2 years ago
Jeff Becker 0fb639db53
idempotent dns 2 years ago
Jeff Becker 26c1336517
limit route poker 2 years ago
Jeff Becker 61f66ac1ec
fix up win32 route poker a bit 2 years ago
Jason Rhinelander 15144f193c
cleanups/simplifications 2 years ago
Jason Rhinelander 9ddf7413af
Windows DNS fixes
- windivert was being set up *before* DNS is set up, so the DNS port was
  nullopt and thus we couldn't properly identify upstream DNS traffic.
- close() doesn't close a socket on Windows, so the socket-bind-close
  approach to get a free UDP port wasn't actually closing, and thus
  unbound upstream constrained to the given port were completely
  failing.
- The unbound thread was accessing the same shared_ptr instance as the
  outer code, which isn't thread-safe; changed it to copy a weak_ptr
  into the lambda instead.
- Exclude upstream DNS traffic in the filter rather than capturing and
  reinjecting it.
2 years ago
Jason Rhinelander c470349fb3
Log upstream DNS servers when setting it up 2 years ago
Jason Rhinelander ab2177bee9
Restore Apple hax 2 years ago
Jason Rhinelander de4bce1d96
Disable upstream TCP DNS
windivert, in particular, will get filtered by this and it almost
certainly won't work.
2 years ago
Jason Rhinelander d32a37e30b
Upgrade unbound to latest stable 2 years ago
Jason Rhinelander bb85ec4595
De-inline vpn/win32.hpp 2 years ago
Jason Rhinelander 2a27698016
Fix backwards from/to in PacketSource_Wrapper
This resulted in DNS responses in Windows having reversed direction when
reinjected, and thus not arriving as expected.
2 years ago
Jason Rhinelander 7a0d4a905e
fix speeling 2 years ago
Jason Rhinelander 07231dd9e1
Fixed crash in DNS resolving
The inner lambda here wasn't keeping the `Query` (`this`) alive, so
`src` wasn't valid anymore.  This changes it to copy the `src`
shared_ptr into the lambda instead of capturing `this`, and fixes it.
2 years ago
Jason Rhinelander d4739d5d47
Fix sockaddr_len initial value 2 years ago
Jason Rhinelander b856b78de3
format 2 years ago
Jason Rhinelander 05ed9d6de0
llarp/dns logging refactor
Convert everything in llarp/dns to new-style logging.
2 years ago
Jason Rhinelander 49223a7853
bind/close to find free UDP port
The current code isn't working and gives a 0 (which then fails unbound
initialization).  This replaces it by doing a socket+bind to find a free
port then immediately closes (but passes the port we got into unbound).
2 years ago
Jason Rhinelander 9921dd6c77
Simplify dll loading via static function pointers
- Replaces RAII handling of DLLs with global function pointers.  (We
  don't unload the dll this way, but that seems unnecessary anyway).
- Simplifies code by just needing to call an init function, but not
  needing to pass around an object holding the function pointers.
- Adds a templated dll loader that takes the dll and a list of
  name/pointer pairs to load the dll and set the pointers in one shot.
2 years ago
Jeff Becker 281fbe57f7
promote log statement 2 years ago
Jason Rhinelander aee618e0d7
Fail if wintun can't retrieve its version 2 years ago
Jason Rhinelander 84ad0ab4d3
Slightly DRY thread-setting code, fix warning
There were warnings from the rc variable being unused; this DRYes it to
use the same code as linux (including the failure check on rc).
2 years ago
Jason Rhinelander 4065413977
Simplify/fix ip_header layout
ip_header wasn't 20 bytes on windows compilations for some unholy
reason.  This restructures it to avoid the template and just use two
different structs for le/be with a condition_t for the ifdef, which
resolves it (and *also* apparently avoids the need for the pack).

Also add a static_assert to check the size.

Also do the same for ipv6.
2 years ago
Jason Rhinelander 58eec9ed11
Avoid strict aliasing warning on function pointers
Cast via an ordinary function pointer rather than a function pointer
reference to avoid the warning.

Also make the pointer in `Func_t` explicit rather than implicit (deduced
into the `Func_t` type) to make it clearer what is going on here.
2 years ago
Jason Rhinelander ef4e720890
Bump cmake min to 3.13 and adopt policies up to 3.24
3.13...3.xx means "minimum is 3.13, but use any new cmake policies
introduced up to 3.xx".

There was, in particular, a policy w.r.t.  external project timestamps
causing warnings under 3.24.
2 years ago
Jason Rhinelander dd16158081
DNS: default to 127.3.2.1 & high port on Linux
Lots of tools struggle with non-default DNS port, so keep a listener on
127.3.2.1:53 (by default).

This required various changes to the config handling to hold a vector
(instead of an optional) of defaults and values, and now allows passing
in an array of defaults instead of just a single default.
2 years ago
Jeff Becker beb07bf46f
small optimizations and fixes
- Ensure ip header struct is packed
- Use fmt
- add missing header
2 years ago
Jason Rhinelander cfd80f6a17
Fix buffer_printer overflow 2 years ago
Jason Rhinelander f168b7cf72
llarp_buffer_t: rename badly named operator==
It didn't do equality, it did "does the remaining space start with the
argument" (and so the replacement in the previous commit was broken).

This renames it to avoid the confusion and restores to what it was doing
on dev.
2 years ago
Jason Rhinelander b9c9ee1ca7
Fix read problem in linux
errno is only set if read returns < 0 and won't be set to 0 if read
succeeds, so we were bailing here frequently on successful reads
(whenever errno happened to be non-0).
2 years ago
Jason Rhinelander 15443568db
Apply some lipstick to llarp_buffer_t
This class is cursed, but also broken under gcc-12.  Apply some lipstick
to get it moving again (but we really need to refactor this because it
is a mess).
2 years ago
Jeff Becker 24dcffabe5
unit tests 2 years ago
Jeff Becker 4490fdcf46
fix up CI
add jason's suggested changes for artifact upload

use lokinet-ci-nodejs-lts as base image so we can build the installer

update ci pipeline for windows to have building gui toggle-able

by default we will build the gui from this repo, but this allows it to
easily run using a custom gui asset if needed
2 years ago
Jason Rhinelander c9d928950a
C-cast to work around gross enum==int assumption in windows API 2 years ago
Jason Rhinelander 49b97f47cc
Make windows-configure.sh runnable without root/build
For when you want to set up a windows build dir, without doing the build
yet.
2 years ago
Jeff Becker a02679b87a
revise ./contrib/format.sh 2 years ago
Jeff Becker 7f27760c97
disable lokinet-bootstrap on windows builds 2 years ago
Jeff 871c3e3281
changeset for windows port
* wintun vpn platform for windows
* bundle config snippets into nsis installer for exit node, keyfile persisting, reduced hops mode.
* use wintun for vpn platform
* isolate all windows platform specific code into their own compilation units and libraries
* split up internal libraries into more specific components
* rename liblokinet.a target to liblokinet-amalgum.a to elimiate ambiguity with liblokinet.so
* DNS platform for win32
* rename llarp/ev/ev_libuv.{c,h}pp to llarp/ev/libuv.{c,h}pp as the old name was idiotic
* split up net platform into win32 and posix specific compilation units
* rename lokinet_init.c to easter_eggs.cpp as that is what they are for and it does not need to be a c compilation target
* add cmake option STRIP_SYMBOLS for seperating out debug symbols for windows builds
* intercept dns traffic on all interfaces on windows using windivert and feed it into lokinet
2 years ago
Jeff e981c9f899
tweaks for wine and yarn for gui
* allow specifying a custom yarn binary for building the gui using -DYARN= cmake option
* unset DISPLAY when calling wine because i hate popups
* do not rebuild gui when building for windows
* by setting the magical undocumented env var USE_SYSTEM_7ZA to 'true' we can have the pile of npm bullshit code use our system's local 7z binary instead of the probably not backdoored binary from npm, yes for real. i hate nodejs so god damn much you have no fucking idea
* allow providing a custom gui from a zip file via -DGUI_ZIP_FILE cmake option
2 years ago
Jeff d846bab0e1
unbreak android config loading 2 years ago
Jeff baddad9564
remove compat wrapper 2 years ago
Jeff 253d22db4f
restucture dbus parts
* move dbus into llarp/linux/dbus.hpp and llarp/linux/dbus.cpp
* provide platform abstraction for setting dns in preparation for network manager
2 years ago
Jeff 2d586145ee
wire up dns srv records 2 years ago
Jeff 74362149eb
refactor dns subsystem
we want to be able to have multiple locally bound dns sockets in lokinet so
i restructured most of the dns subsystem in order to make this easier.

specifically, we have a new structure to dns subsystem:

* dns::QueryJob_Base

base type for holding a dns query and response with virtual methods
in charge of sending a reply to whoever requested.

* dns::PacketSource_Base

base type for reading and writing dns messages to and from wherever they came from

* dns::Resolver_Base

base type for filtering and handling of dns messages asynchronously.

* dns::Server

contextualized per endpoint dns object, responsible for all dns related isms.

this change hides all impelementation details of all of the dns components.
adds some more helper functions for parsing dns and dealing with OwnedBuffer.

overall dns becomes less of a pain with this new structure. probably.
2 years ago
Jeff Becker bf2488d9e8
zero copy compare 2 years ago
Jeff Becker 1b9898aabc
restructure readme and docs 2 years ago
majestrate a8c0f76e1c
Merge pull request #1971 from majestrate/docs-and-such-2022-08-06
more docs
2 years ago
majestrate d5a2616d6f
Merge pull request #1983 from jagerman/macos-packaging
Macos packaging
2 years ago
Jason Rhinelander 2eef7c5915
Don't look for sqlite when not building peerstats 2 years ago
Jason Rhinelander 57cebe5c9f Don't build peerstats tests when peer stats disabled 2 years ago
Jason Rhinelander 955cecb21d Drone macos fixes
- fix lib check script to look at the network extension
- amend the list of intented linked libs
- upload the dmg
2 years ago
Jason Rhinelander 6e5db4f560 Set up sign target dependencies always; mark unsigned package
Even if we aren't codesigning, things like the `package` target expect
to be able to depend on `notarize` (and thus implicitly sign ->
assemble) to require a built package.

Also add a `-UNSIGNED` into the built dmg filename.
2 years ago
Jason Rhinelander ceed8e3238
Remove unused parameter names 2 years ago
Jason Rhinelander dccc86ea62 Apple icon bullshit
Apple introduced a bug in macOS 11 that they can't be arsed to fix which
breaks PNG loading into icns files by dropping the blue channel of the
last pixel, leaving a streak of yellow pixels at the bottom of the
image.

This hacks around it by setting a fully transparent, non-white (actually
yellow) pixel in the bottom-right corner of the images.

This is such inexcusable trash.
2 years ago
Jason Rhinelander 500530a336 dmg: version, and set icon
- Add the version number into the .dmg filename
- Set the lokinet icon on the .dmg.  This is done via a swift program
  because all the Apple CLI tools to do this are deprecated.
2 years ago
Jason Rhinelander 4605b49cfc Fix codesigning: reenable extension provisioning profile
The macOS PR that was merged accidentally dropped a cmake option that
result in the extension's provisioning profile not getting copied into
place (but was working locally because I was using a build dir where the
variable was still set).  This restores the option to fix the
codesigning.
2 years ago
Jason Rhinelander f5376e98c2 Lower minimum version for swift binary
CMake apparently doesn't do anything with CMAKE_OSX_DEPLOYMENT_TARGET
for swift, which results in a 12+ minimum version.  This fixes it
(albeit in a hacky way since the only apple-sanctioned way to properly
set this appears to be "use xcode").

Shame on Apple, as usual.
2 years ago
Jason Rhinelander 039d1429f5 Build an installer dmg 2 years ago
Jason Rhinelander 182f1dccb9 Fix mac.sh defaults to make a signed, notarized build 2 years ago
Jason Rhinelander 8b157c304e Remove obsolete mac packaging cruft 2 years ago
Jason Rhinelander d6fe1f1610 Update gui submodule to dev branch 2 years ago
Jeff 4c897f583c
fix up log statements
* make socket bind errors have a distinct message reported when caught using their own exception type
* omit printing banner in setup when we run from the lokinet executable (but not the liblokinet.so entry point)
2 years ago
Jeff a9abeb33cc
bump version to 0.9.10
* update release motto for 0.9.10
2 years ago
jeff 6929a02842
set up links to new docs pages 2 years ago
majestrate 256470229d
add more info
clarifiy what .loki and .snode gtld are
2 years ago
Jeff f6613c9526
wire up new docs pages
reword a few things about the links rewired.
2 years ago
Jeff f3533e9912
add initial high level usage docs 2 years ago
Jeff badf72838e
move all code directory readmes into docs/project-structure.md 2 years ago
majestrate 13c71c3626
Merge pull request #1942 from jagerman/macos-sysex
macOS system extension
2 years ago
Jason Rhinelander ab16d428cb Don't use sign target for contrib/mac.sh 2 years ago
Jason Rhinelander 2b7b1fcc79 Working signed macOS GUI build 2 years ago
Jason Rhinelander 496c1d274c Stub out the peer stats sqlite_orm code
This avoids needing to build it and include it in static builds since we
aren't currently making use of it.
2 years ago
Jason Rhinelander 8c2f4175d6 contrib/windows.sh: do a release build by default 2 years ago
jeff 181de210cd Build apple/macos GUI from lokinet project
This adds the gui as a submodule, and consolidates the GUI handling a
bit between the two platforms.
2 years ago
Jason Rhinelander 7b2b114240 Remove disabled submodule check
It's easy enough to add -DSUBMODULE_CHECK=OFF yourself if you really
won't want it, and much more useful to have it enabled as a default.
2 years ago
Jason Rhinelander c504c030cf Update mingw zmq patch
The one we were applying for closesocket breaks on some versions.
2 years ago
jeff b8896740de build gui and assemble app bundles into one singular app bundle 2 years ago
jeff 279b5710cc maker packet tunnel provider compile 2 years ago
Jason Rhinelander 5530ec3057 Handle Apple's trash servers when polling for notarization
Apple's servers have a gateway timeout a small but noticeable percentage
of the time, which was breaking the script.  Detect such Apple flakiness
and keep trying.
2 years ago
Jason Rhinelander 09372994bb macOS system extension support
Adds support for building Lokinet as a system extension, and fixes
various problems in the macos implementation found during development of
the system extension support.
2 years ago
Jeff 61d7ff3787 on apple write packets back to interface when it is for us because that does not have a route spec for the interace ip on loopback as apple finds having sensible defaults bothersome internally 2 years ago
Jason Rhinelander e97752734d Fix `platform::is_apple` value 2 years ago
Jason Rhinelander 4c39a2d395 Make sure BUILD_SHARED_LIBS is a cache variable
Otherwise cmake warns about propagation of normal variables into cache
variables when it hits the option in the oxen-mq submodule.
2 years ago
Jason Rhinelander 93421c6eaf Change permissions for system extension 2 years ago
Jason Rhinelander 49b2878209 Require explicit disabling of codesigning
Make the mac build require passing either an explicit -DCODESIGN=OFF or
the code signing identities.
2 years ago
Jeff 5dd71995c4 add lokinet.swift cli args
* add --start flag to start lokinet
* add --stop flag to stop
* by default lokinet on macos needs a flag or it will be a nop
2 years ago
majestrate c81e950d13
Merge pull request #1973 from majestrate/nodedb-logic-fix-2022-08-07
do not clear out entries that are valid from nodedb when we are a service node
2 years ago
Jeff 4341b8c684 do not clear out entries that are valid from nodedb when we are a service node.
this logic was inverted.
2 years ago
majestrate 9917daa84d
Merge pull request #1972 from majestrate/happyify-ci-pipelin-2022-08-06
fix ci pipeline
2 years ago
Jeff 8d1d1d0b57 make unit tests happy 2 years ago
Jeff 2d1645bfe1 fix up sid ci pipeline 2 years ago
Jeff 58052f5b17 macos ci fixes 2 years ago
majestrate 7a8331e79d
Merge pull request #1961 from majestrate/rc-expiration-reeanble-07-18-2022
re enable rc expiration
2 years ago
majestrate db961ac728
Merge pull request #1943 from majestrate/keygen-script-2022-06-26
simple keygen script
2 years ago
Jeff d0408a1c4e
remove invalid entries on loading nodedb 2 years ago
Jason Rhinelander f230a3f695
Add debug logging for RC removal 2 years ago
Jason Rhinelander a190c14889
Fix comment 2 years ago
Jeff cc2b4df676
kill log statements 2 years ago
Jeff 3337125110
re enable rc expiration 2 years ago
majestrate 4091fdb8bb
Merge pull request #1958 from majestrate/readmes-and-such-2022-07-16
add documentation on project structure
2 years ago
Jeff 23fd46c0db
add directory specific readmes 2 years ago
majestrate 769bc1e8df
Merge pull request #1962 from jagerman/dns-parsing-fixes
DNS message parsing fixes and cleanup
2 years ago
Jason Rhinelander 874221db70
Merge pull request #1965 from jagerman/fix-double-logging
Remove the initial sink before reconfiguring logging
2 years ago
Jason Rhinelander 884c5052a0
Merge pull request #1964 from jagerman/inbound-default-ip
Fix inbound IP handling; update [bind] docs
2 years ago
Jason Rhinelander 841abffaf5
Make outbound wildcard default to inbound IP
outbound=:1234
    outbound=0.0.0.0:1234
    outbound=
    outbound=0.0.0.0

now all default to use the inbound= IP.  (If multiple inbound= IPs are
given, we raise an exception to abort startup).

Only applies to routers (since clients don't have inbound IPs), and
eliminates potential weird edge cases with local system IP and routing
shenanigans.
2 years ago
Jason Rhinelander f0590a9672
Remove the initial sink before reconfiguring logging
Without this, the original sink set up very early in daemon/lokinet.cpp
(which goes to stderr) is still around, and so we get double logging.
2 years ago
Jason Rhinelander 2be422fcc0
Reorganize [bind] comments
The general section comments contained all the descriptions for the
inbound/outbound settings, while inbound/outbound had no comment at all.
This moves the comments around to the individual settings, plus updates
some of the wording in the section.
2 years ago
Jason Rhinelander c9f492d85a
Fix [bind]inbound IP-omitted handling
We were failing when using `inbound=:1234`, rather than looking for a
default IP.  This fixes it to still use the default IP, and change only
the default port.

Outbound behaviour should remain unchanged: i.e. `outbound=:2345` means
bind-to-wildcard-IP with a specific port.
2 years ago
Jason Rhinelander 6df83b613d
Fix log level being forced to warning
This code shouldn't be here; the log level was already set to its proper
default value via the earlier FromConfig call.
2 years ago
Jeff 3a97acfb51
this code needs to detect the first non-existing interface by name, not the first existing one. this remidies this. sorry testnet for breaking you 2 years ago
Jeff 83f648fd87
reword message 2 years ago
Jason Rhinelander 9ea82edc07
DNS message parsing fixes and cleanup
Fixes:

- tighten reserved name detection to not match fooloki.loki, but instead
  only match "foo.loki.loki" and "loki.loki" (and similar for reserved
  name "snode.loki").
- IPv6 PTR parsing was completely broken.
- Added tests for the above two issues.

Cleanups:

- Eliminate llarp::dns::Name_t typedef for std::string
- Use optional return instead of bool + output param
- Use string_views; we were doing a *lot* of string substr's during
  parsing, each of which allocates a new string.
- Use fmt instead of stringstream
- Simplify IPv4 PTR parsing
2 years ago
Jeff f222aecc79
actually use correct variable in iteration 2 years ago
majestrate 6ea97ccaf4
Merge pull request #1930 from majestrate/issue-1929-06-02-2022
redo bind section of config
2 years ago
Jeff a7cfa3ea87
use info as default log level on clients as most users have continously been confused by lack of log output with warn level as default, which i predicted would happen 2 years ago
Jeff b819ed21d2
clean up build helper scripts:
* cleanup of android build shims
* cleanup of windows build shims
2 years ago
Jeff 68148e098f
* add mockable network functions
* add unit tests with ability to pretend to be different network setups
2 years ago
majestrate 12653d4ac2
Merge pull request #1955 from jagerman/spdlog
Logging overhaul, fmt::format, and related
2 years ago
Jason Rhinelander f9371233ee
hive fmt/spdlog updates 2 years ago
Jason Rhinelander f6019210c3
oxen-logging update to handle level/type parsing exceptions 2 years ago
Jason Rhinelander 9bf1d5837a
Update oxen-logging for macos compilation 2 years ago
Jeff 8cde7c7e7a
fix win32 and android builds 2 years ago
Jason Rhinelander e094125000
gcc 8/9 fix 2 years ago
Jason Rhinelander 86fd77733e
Add missing header to fix libc++ build 2 years ago
Jason Rhinelander 784f2938f1
Use more fmt 2 years ago
Jason Rhinelander eec8244a6c
Remote util::Printer and related cruft 2 years ago
Jason Rhinelander 2f9e182b20
Avoid ctor inheritance to make diagnostics better
Using constructor inheritance DRYs the code, but unfortunately confuses
GCC as to where the proper "required from here" location is, which makes
debugging formatting errors very difficult.  Avoid it (and update
oxen-logging to avoid it there as well).
2 years ago
Jason Rhinelander c82ade2d81
Make test code work with new logging 2 years ago
Jason Rhinelander b81f7025c9
Replace logging with oxen-logger
Replaces custom logging system with spdlog-based oxen logging.  This
commit mainly replaces the backend logging with the spdlog-based system,
but doesn't (yet) convert all the existing LogWarn, etc. to use the new
format-based logging.

New logging statements will look like:

    llarp::log::warning(cat, "blah: {}", val);

where `cat` should be set up in each .cpp or cluster of .cpp files, as
described in the oxen-logging README.

As part of spdlog we get fmt, which gives us nice format strings, where
are applied generously in this commit.

Making types printable now requires two steps:
- add a ToString() method
- add this specialization:

      template <>
      constexpr inline bool llarp::IsToStringFormattable<llarp::Whatever> = true;

This will then allow the type to be printed as a "{}" value in a
fmt::format string.  This is applied to all our printable types here,
and all of the `operator<<` are removed.

This commit also:
- replaces various uses of `operator<<` to ToString()
- replaces various uses of std::stringstream with either fmt::format or
  plain std::string
- Rename some to_string and toString() methods to ToString() for
  consistency (and to work with fmt)
- Replace `stringify(...)` and `make_exception` usage with fmt::format
  (and remove stringify/make_exception from util/str.hpp).
2 years ago
Jason Rhinelander 43191ec100
Add missing header
Needed for uint_least32_t.
2 years ago
Jeff a3725284e4
simple keygen script 2 years ago
majestrate a9a9593128
Merge pull request #1938 from jagerman/no-empty-compilations
Don't build empty cpp files
2 years ago
majestrate 193ab47372
Merge pull request #1941 from jagerman/no-shellhooks
Remove dead code, cmake cleanups
2 years ago
Jason Rhinelander 81f05d63c1
Move destructor back to .cpp file
Having it there (even defaulted, like this) means endpoint.hpp doesn't
have to include endpoint_state.hpp (which it otherwise would need,
because of the std::unique_ptr<EndpointState> default deleter
requirements).
2 years ago
Jason Rhinelander c37d6ea43b
Remove shadow testing framework
Bitrotten and apparently doesn't work with libuv event loop.
2 years ago
Jason Rhinelander 0edb4435d4
Cmake cleanup: remove unneeded =1 from definitions
We only check for definedness, not truth, in the code so make the cmake
definitions agree with that.

This also avoids warnings when building on macos (because swift only
allowed defined/undefined but not values)
2 years ago
Jason Rhinelander 4a4f16e5c8
Remove dead code: netns, shell hooks
These haven't been activated in a long time and aren't worth
resuscitating.
2 years ago
Jason Rhinelander 8c3d1b3281
Don't build empty cpp files
We shouldn't be compiling these .cpp files at all on other platforms,
rather than compiling empty .cpp files (which later results in "... has
no symbols" warnings).
2 years ago
majestrate 2e0822889a
Merge pull request #1937 from jagerman/print-snode-addr-on-startup
Show router pubkey at startup
2 years ago
Jason Rhinelander 3cd699fa7f
Show router pubkey at startup 2 years ago
majestrate 85cf2dad10
Merge pull request #1926 from jagerman/tag-override
Add -DLOKINET_VERSIONTAG to override version tag
2 years ago
Jason Rhinelander 1de7b070d1
Add -DLOKINET_VERSIONTAG to override version tag
Currently I maintain a patch in the debs to do the same thing here, but
it fails to apply often enough; this change makes the behaviour
consistent with oxen-core/oxen-ss and will let me drop that patch and
just pass in the cmake option.

(Recommend ignore-whitespace for viewing the diff)
2 years ago
majestrate 10db0a0d2d
link to french readme 2 years ago
majestrate 83fe986749
add french readme
this translation was provided from a session user
2 years ago
majestrate 3ef13bab7f
Merge pull request #1931 from pebu1337/patch-1
Update error message
2 years ago
Pebu 9db192079b
Update error message
Message is paths must be >= 2 but condition is checking for < 3
2 years ago
majestrate f2d7d5eabf
Merge pull request #1925 from jagerman/system-or-submodule
Clean up system-or-submodule handling
2 years ago
Jason Rhinelander 523a8a74ca
Clean up system-or-submodule handling
Fixes a bug on older cmake linking against oxenmq (older cmake hates the
direct oxenmq::oxenmq -> PkgConfig::OXENMQ alias), and also makes it
easier to handle things like nlohmann::json (which we can use from the
system *or* submodule).

Borrowed from oxen-ss/oxen-core.
2 years ago
Jeff 4a10868f85
add additional fallback case 2 years ago
majestrate 229e1277fd
Merge pull request #1923 from majestrate/replace-llarp-proto-verison-macros-2022-05-26
final fixups before 0.9.9 tag
2 years ago
Jeff 2576b87c5d
version bump to 0.9.9 2 years ago
Jason Rhinelander 34c3b8d0de
Add oxen repo to bionic for updated cmake version
Also rename the arg from loki_repo to oxen_repo
2 years ago
Jeff 73a49f5473
do not build liblokinet in windows, exe gets too big 2 years ago
Jason Rhinelander 6a2114fa1d
Don't be dynamic for win32 rc crap 2 years ago
Jeff 1dfc2e883b
bump verions of all deps
bump submodules

Fix dynamic version generation

   - GIT_FOUND OR Git_FOUND wasn't available because we hadn't done a
     find_package(Git) yet.
   - required version variables weren't being passed through to the cmake
     script
2 years ago
Jeff 065e52ab80
move windows nsis parts for cpack into external files 2 years ago
Jeff e480e36f3d
generate windows rc for each executable target so we can set the executable name right for each one 2 years ago
Jeff f05c2ebc71
macro removals
clean up version cmake stuff

clean up generated cpp version stuff

make all the windows rc stuff get generated by cmake

bump release motto message

properly inject release motto into version
2 years ago
Jeff 1eba0f836e
replace LLARP_PROTO_VERSION macro 2 years ago
majestrate 0331db494e
Merge pull request #1905 from majestrate/connect-out-2022-04-28
connect to routers even if we are decomissioned
2 years ago
Jeff 33a2226079
footcannon prevention: check for invalid address family.
throw if we pass in a bogus af value when getting a sockaddr for all interfaces
2 years ago
Jeff 98b3860655
set source ip on service nodes for outbound link to not use all interfaces 2 years ago
Jeff 60ada470db
format systemd status as time deltas from now 2 years ago
Jeff 18e1272c76
add gossip info to systemd status
* adds next and last gossip datetimes
* adds a few things for time points, like ostream operator overloads for time point
2 years ago
Jeff 3c44a06403
publish our rc out to the network when we regenerate them 2 years ago
Jeff 5f496259b7
if we are decommissioned or deregistered, do not test other routers so we do not spam them.
disambiguiate error message to distinguish between decomissioned and deregistered.
2 years ago
Jeff 706e34c082
connect to routers even if we are decomissioned 2 years ago
majestrate d9a8710ccf
Merge pull request #1909 from majestrate/bump-ci-ubuntu-debs-2022-05-02
[chore] bump ci to make jammy debs
2 years ago
Jeff 994c6e1a21
remove focal deb build from ci 2 years ago
Jeff 0df26fe81c
bump ci to make jammy debs 2 years ago
Jeff 0d0295e2dc
remove unneeded submodule 2 years ago
majestrate 608dced827
typofix 2 years ago
majestrate f16c2ecd43
use oxenc submodule in android 2 years ago
majestrate 8529ab2c62
Merge pull request #1920 from majestrate/fixup-link-layer-state-machine-2022-05-20
state machine fix for link layer
2 years ago
Jeff a61e9636b2
state machine fix for link layer
if a pending inbound session did not complete a handshake after an unclean close from a previous session the
remote udp endpoint would remain stuck mapped as authed and thus any further attempts from the remote would
be silently dropped as it entered a stuck state in the state machine. this was happening as a small part
of the state machine was hidden in the implementation details of iwp, but instead should be in the super type
as it is logic exclusively outside the details which every dialect would have regardless of its details.

this commit will unmap the udp endpoint every time it needs to in the link layer state machine, independat of
the implementation details of the diact.
2 years ago
majestrate a149e6e384
Merge pull request #1918 from majestrate/fixup-win32-2022-05-19
fixup edge case on windows
2 years ago
Jeff 3fccb3ab0c
fixup edge case on windows
* add platform detection constexprs
* add quark for platforms without native ipv6 like windows, exit mapping cannot work with ipv6 yet
2 years ago
majestrate e3aedda4c8
Merge pull request #1917 from majestrate/ip-fixups-2022-05-18
clean up ip packet code
2 years ago
Jeff f0867832e5
alignas 2 years ago
Jeff 7396eb7f3b
bump oxenc submodule and force oxenc submodule on win32 2 years ago
Jeff 70b07bab44
clean up ip packet code 2 years ago
majestrate d30fe95f2e
use ::/0
makes us map all ranges not just ipv4 when exit mode is on by default.
2 years ago
majestrate a610dd6e50
Merge pull request #1912 from majestrate/issue-1911-fixup-oxenc-linkage
split up link order for oxenmq and oxenc
2 years ago
Jeff 9556741f6a
split up link order for oxenmq and oxenc
* lokinet uberlib needs oxenc and oxenmq
* lokinet-util only needs oxenc

fixes #1911
2 years ago
majestrate bad98b5476
Merge pull request #1907 from majestrate/link-layer-priority-2022-05-02
propagate message priority to link layer
2 years ago
Jeff 3c92568881
typo 2 years ago
Jeff d85d208156
bump libuv version with hashpin 2 years ago
Jeff 8efac67c0a
add static deps mirror to ci 2 years ago
Jeff 546aede528
add mirror for cmake static deps 2 years ago
majestrate 5b0ece3f9e
Update llarp/router/outbound_message_handler.cpp
add comment

Co-authored-by: Thomas Winget <tewinget@gmail.com>
2 years ago
majestrate 238c33f565
Update llarp/iwp/session.cpp
return

Co-authored-by: Thomas Winget <tewinget@gmail.com>
2 years ago
Jeff 26c8063fc9
convert priority queues 2 years ago
Jeff 14d75cc654
add util::ascending_priority_queue type 2 years ago
Jeff 8960ca08f3
propagate link layer message priority to link layer so it can order retransmissions with that in mind 2 years ago
majestrate a80f7e1cf6
Merge pull request #1908 from majestrate/lrsm-and-queue-flush-2022-05-02
plug LRSM infoleak and queue flushing
2 years ago
Jeff 8aa465d0ed
randomize all frames in lrsm to prevent info leak about hop length 2 years ago
Jeff 926074f7c4
add idempotent pump after sending lrcm to very make sure that it is pumped 2 years ago
majestrate da4a3e517a
Merge pull request #1903 from jagerman/oxenc-endian
Replace llarp/util/endian.hpp with oxenc/endian.h
2 years ago
Jason Rhinelander c2f8a618e0
Update to oxenc 1.0.2 2 years ago
Jason Rhinelander b09298e211
Replace llarp/util/endian.hpp with oxenc/endian.h 2 years ago
majestrate 64d6ba8a53
Merge pull request #1830 from majestrate/static-auth-codes-2021-12-26
static endpoint auth codes
2 years ago
Jeff 64684d4dd4 dont require libcrypt for cross compiled builds 2 years ago
Jeff 7a8410b375 make more platforms ignore libcrypt 2 years ago
Jeff ee12ba51d5 disable hashed auth on windows 2 years ago
Jeff 5050cd0299 add hashed password capability to endpoint auth by file 2 years ago
Jeff a51576d1ea make destructor virtual 2 years ago
Jeff a082ba4e77 add file auth for tokens 2 years ago
Jeff 9a6bfe6013 static endpoint auth codes 2 years ago
majestrate 1dfed9e061
Merge pull request #1899 from majestrate/use-new-gui-2022-04-18
windows updates
2 years ago
Jeff 1a254a4301 kill/restore ipv6 with powershell because windows is vile 2 years ago
Jeff d05518be57 use the new electron gui in windows build 2 years ago
majestrate d972b04fe0
Merge pull request #1891 from majestrate/idempotent-flush-path-builds-2022-04-12
idempotent flush queues on path builds
2 years ago
majestrate 9fd20c885b
Merge pull request #1896 from majestrate/unstuck-obctx-2022-04-17
handle edge case better
2 years ago
Jeff 9765eeee7e handle edge case better
when our path is fine but the recipiant's path on the pivot router isn't we should pivot to another router
2 years ago
majestrate dfa291fb91
Merge pull request #1894 from majestrate/cleanup-readmes-2022-04-15
remove bitrotten files
2 years ago
majestrate 293bccb6d8
Merge pull request #1893 from majestrate/issue-1892-rpc-ping-pubkey-2022-04-13
add public key in rpc ping
2 years ago
Jeff 699591b76e remove bitrotten files 2 years ago
Jeff 768ed30c05 add public key in rpc ping 2 years ago
Jeff 3fbddac464 idempotent flush queues on path builds 2 years ago
majestrate f702aacc38
add arch linux section to readme
cite current ongoing discussion thread on the aur.
2 years ago
majestrate b6a087187c
Merge pull request #1881 from majestrate/mark-dead-obctx-2022-03-31
reduce excess path builds
2 years ago
Jeff ffadcb2e93 clean up paths that are ignored and inactive 2 years ago
Jeff af041cfee4 try not to spam builds 2 years ago
majestrate 619d8d3776
Merge pull request #1877 from majestrate/path-cache-cpu-reduction-2022-03-29
Cache best paths determined by GetPathByRouter to reduce cpu usage
2 years ago
Jeff 17687e300e drone-ci image name fix, use -builder images 2 years ago
Jeff 77bf2f4af9 disable building fat liblokinet.so on bionic because lto is broken on bionoic still 2 years ago
Jeff 38a157808e Cache best paths determined by GetPathByRouter to reduce cpu usage 2 years ago
majestrate 65ef0e4bfb
Merge pull request #1849 from majestrate/dry-cross-2022-02-02
dry cross compile
2 years ago
majestrate 1fc901330c
Merge pull request #1851 from majestrate/ci-docs-generation-2022-02-04
ci docs generation
2 years ago
majestrate a71e9423bd
Merge pull request #1864 from majestrate/gutt-old-code-2022-02-27
remove old dead code
2 years ago
majestrate 3d32e3b36a
Merge pull request #1876 from majestrate/zlib-hashpin-update-2022-03-29
bump zlib hashpin
2 years ago
Jeff e2a94b44bb bump zlib hashpin 2 years ago
Jeff 7265a6c80e ci pipeline for cross compile 2 years ago
Jeff 7251944adc redo contrib/cross.sh to take cmake arguments 2 years ago
Jeff 66b7c3698e remove unneeded line from contrib/cross.sh 2 years ago
Jeff 56492c88ac dry cross compile 2 years ago
majestrate 12044af04e
Update readme.md
add note about updating alternatives in windows cross build
2 years ago
majestrate 2476d97bf5
Merge pull request #1869 from pebu1337/patch-1
Fix spelling changes
2 years ago
Pebu 1a74abca31
Fix spelling changes 2 years ago
majestrate 27d883157d
Merge pull request #1865 from majestrate/proto-fix-2022-03-06
fix wire protocol race condition
2 years ago
Jeff a76acd4956 fix wire protocol race condition
only send close packet once, before we were sending a close after we got a close causing excess log spam.
include handshake phase when checking for connection timeouts.

when we change our rc make sure to put it into nodedb too when we are a service node to prevent weirdness in dht lookups.
2 years ago
Jeff b4c4c3977a oxenc 2 years ago
Jeff 6629e8c881 cmake workarround for quark in older cmake where pkg config produces non existing targets 2 years ago
Jeff ae96458f8a remove old dead code 2 years ago
majestrate 6f46fe7e0c
Merge pull request #1862 from Bilb/fix-abort-exit-on-stop
summary status: no services means not running
2 years ago
Jeff eeb93343c0 rpc fixes for lokinet gui
only add stats for services when we have them
2 years ago
audric 41405be612 summary status: no services means not running 2 years ago
majestrate a8faffe76e
Merge pull request #1860 from Bilb/add-version-and-uptime-summary-status
add version and uptime to summary status endpoint
2 years ago
Audric Ackermann ad6d206aa6
add version and uptime to summary status endpoint 2 years ago
Jeff 0fe716e1dd more docs 2 years ago
Jeff 54f431c9e8 make doxybook2 run from PATH if installed on our system 2 years ago
Jeff 6bb438ca33 make comments with colins in them not have them in it 2 years ago
Jeff c39bd827d0 remove markdown extension that is not required 2 years ago
Jeff bebfcbdba2 move documentation builder closer to the top of the ci jobs 2 years ago
Jeff c70f1866f8 include mkdocs.yml in ci artifacts for docs 2 years ago
Jeff 283eabd1a8 use COPYONLY for the non templated configure_file targets 2 years ago
Jeff 97f4545fd5 make CI pipline generate docs with doxygen, doxybook2 and mkdocs. 2 years ago
majestrate 8a849e81df
Merge pull request #1858 from jagerman/omq-11
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
2 years ago
Jason Rhinelander d02558350a
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
- Update oxen-mq submodule to latest stable
- Add oxen-encoding submodule
- Convert all oxenmq encoding usage to oxenc
- Modernize cmake handling of oxenmq/oxenc
2 years ago
majestrate f8b6b9d34b
Merge pull request #1856 from Bilb/fix-num-path-built-summary-status
fix numPaths value in Router::ExtractSummaryStatus
2 years ago
Audric Ackermann d9467f4dee fix numPaths value in Router::ExtractSummaryStatus 2 years ago
majestrate 6cec95f0f7
Merge pull request #1857 from majestrate/upstream-dns-default-quad-nine-2022-02-15
use quad nine as default upstream dns
2 years ago
Jeff ac9fb9d479 use quad nine as default upstream dns 2 years ago
majestrate c0f47063cb
Delete llarp.png
remove unused image
2 years ago
majestrate 79662aaa9a
spruce up README more
remove dead links for docs

link all support platforms

add anchors in markdown
2 years ago
majestrate e61ca2934e
Update readme.md
fix anchor
2 years ago
majestrate 101650d742
Update readme.md
typofix
2 years ago
majestrate 09e91cce13
fix up readme
point install links to sections in readme.md
2 years ago
majestrate 257f48a166
Merge pull request #1852 from majestrate/lokinet-shared-sid-compiler-fix-2022-02-06
dont capture flow_addr, results in compiler error on sid
2 years ago
Jeff 810e3cc9c2 dont capture flow_addr, results in compiler error on sid 2 years ago
majestrate 838183e36e
Merge pull request #1748 from majestrate/liblokinet-udp-api-2021-09-19
liblokinet updates
2 years ago
majestrate fbb0ed8245
Merge pull request #1848 from majestrate/fixup-2022-02-02
fixup cross targets
2 years ago
Jeff 48559bd282 fix up ppc64le cross target 2 years ago
Jeff eae4d3cf74 fixup armhf target 2 years ago
majestrate d66364ab7c
Merge pull request #1847 from majestrate/mip64-cross-2022-01-30
update cross compiling infra
2 years ago
Jeff f543f6962d fix up ppc64le toolchain, remove suffix 2 years ago
Jeff 24811aff37 fix up contrib/cross.sh to put everything in build-cross 2 years ago
Jeff 08a9e0ad39 add cross compile helpers and update/add toolchains 2 years ago
majestrate b3068fe76d
Merge pull request #1846 from majestrate/bump-static-deps-2022-01-31
chore: bump static deps versions
2 years ago
majestrate 217c76e45b
Merge pull request #1815 from majestrate/cleanup-docs-subdir-2021-11-28
docs makeover
2 years ago
Jeff 582fdeda27 add close_reason parameter to quic::Endpoint::close_connection defaulting to emtpy string 2 years ago
Jeff 95efe8f4e5 bump ngtcp2 to v0.1.0 tag 2 years ago
Jeff 3c983e2cd7 libcurl no long users --without-libmetalink so remove the flag 2 years ago
Jeff 199055a6aa chore: bump static deps versions 2 years ago
Jeff Becker 04b23416ed do less allocations in lokinet_hex_tobase32z 2 years ago
Jeff Becker 743bc2433a resolve race condition in udp flow and packet handling 2 years ago
Jeff Becker 635f4bcd8c make it compile 2 years ago
Jeff Becker c655a21d68 typofix 2 years ago
Jeff Becker f8768488ed make pybind compile 2 years ago
Jeff Becker bf6dfaaef8 cmake fixups 2 years ago
Jeff Becker 5286d442fb updates:
* add udptest example
* fix up udp codepath in liblokinet
2 years ago
Jeff Becker b20e7bedf8 identify 2 years ago
Jeff Becker e2cd4d66cc docstring update 2 years ago
Jeff Becker 94ce7a9af7 make function pointer arguments named 2 years ago
Jeff Becker ef19111f88 dont pack struct becuase alignment 2 years ago
Jeff 97966976d0 Update CMakeLists.txt
dont depend on lokinet-shared target for sign target as we disabled it by default.
2 years ago
Jeff 82ffa2f02c Update mac.sh
disable liblokinet on mac by default in mac.sh
2 years ago
Jeff Becker 8153edbf43 dont enable apple languages when not building daemon 2 years ago
Jeff Becker 65b29a1b70 add liblokinet custom logger 2 years ago
Jeff Becker b31cac4b71 nodejs dipshittery 2 years ago
Jeff Becker 51b1d41b12 disable gost in static build 2 years ago
Jeff Becker 1feaec1169 build liblokinet on macos 2 years ago
Jeff Becker 50b8056491 enable liblokinet on macos 2 years ago
Jeff Becker f38bf2770d move WITH_BOOTSTRAP option to root project CMakeLists.txt 2 years ago
Jeff Becker f5157c31da make it compile 2 years ago
Jeff Becker b225ec1043 thread safety stuff 2 years ago
Jeff Becker ba57ab04aa wire up liblokient_udp_* 2 years ago
Jeff Becker 1c70b0f42f add lokinet_hex_to_base32z 2 years ago
Jeff Becker d3d07fe53e typofix 2 years ago
Jeff Becker e11e736ea5 typofix 2 years ago
Jeff Becker 71364da9f4 fix typos add lokinet_udp_close 2 years ago
Jeff Becker 9fb11bf3da typo fixes and clarify docs 2 years ago
Jeff Becker 9d069983b4 add WITH_BOOTSTRAP option for toggling building lokinet-bootstrap 2 years ago
Jeff Becker 13c3786067 correct function names 2 years ago
Jeff Becker bbb082931a more logging 2 years ago
Jeff Becker 66de680884 sanity check 2 years ago
Jeff Becker 8c8f97adda more logging 2 years ago
Jeff Becker 38d4cec7d1 log errors on decoding 2 years ago
Jeff Becker c5b5ff7810 typo fix 2 years ago
Jeff Becker 2428cc189e llarp::BootstrapConfig update
* make routers member a llarp::BootstrapList
2 years ago
Jeff Becker c4b1a9c074 lokinet_add_bootstrap_rc
* allow bootstrap lists to be passed in
2 years ago
Jeff Becker 00075f541b fix compile error 2 years ago
Jeff Becker 5b8ebb269c changes for liblokinet-ffi
* cmake option BUILD_DAEMON for toggling building of daemon directory
* when WITH_BOOTSTRAP is OFF dont build curl or cpr
2 years ago
Jeff Becker db7050cd2d update liblokinet udp header 2 years ago
Jeff Becker 50001da9a1 remove dead shit from header 2 years ago
Jeff Becker 433febe5c6 update liblokinet udp api header 2 years ago
Jeff Becker 5f49d3a49f update header with notes 2 years ago
majestrate 7a992c7ebc
Merge pull request #1845 from majestrate/make-github-see-we-are-gpl3-2022-01-28
make it so github sees the repo is gpl3
2 years ago
Jeff 185809907d fix typo in readme, use 3 hashes instead of 2 because it is a sub 3 section 2 years ago
Jeff 996de3d4c6 make it so github sees the repo is gpl3 2 years ago
majestrate 36925d0576
Merge pull request #1844 from majestrate/sigusr1-wire-up-thaw-2022-01-27
wire up sigusr1 to trigger a network thaw on non win32 platforms
2 years ago
Jeff fc444741f1 move constant to new header
create llarp/constants/time.hpp for time/duration constants
2 years ago
Jeff 5fac6c84d8 detect timeskip and thaw network when we think it happened. 2 years ago
Jeff 38c6d99375 wire up sigusr1 to trigger a network thaw on non win32 platforms 2 years ago
majestrate cf0e3146a2
Merge pull request #1843 from majestrate/disable-unit-tests-on-broken-gcc-2022-01-24
work around gcc lto bug
2 years ago
Jeff 7e92f36b6a disable tests by default
make ci enable tests explicitly
2 years ago
majestrate 27619f5fb4
Merge pull request #1838 from majestrate/sd_notify_extra_info-2022-01-13
redo systemd status line
2 years ago
majestrate 9d1111a0b1
Merge pull request #1839 from majestrate/disable-route-blackhole-config-2022-01-14
route poker: allow not blackholing routes.
2 years ago
Jeff b3d9cd463f route poker: allow not blackholing routes.
allow runtime configuration to disable ip blackholing.
2 years ago
Jeff 205584acdf redo systemd status line to include number of paths and endpoint count. optionally warn about low path success. 2 years ago
majestrate 53526f386a
Merge pull request #1834 from majestrate/route-poker-fix-2022-01-03
prevent segfault in route poker if Init() is not called
2 years ago
majestrate 2c44ffe85b
Update llarp/router/route_poker.cpp
Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2 years ago
majestrate 68a7174807
Merge pull request #1837 from jagerman/gentler-install-instructions
readme: point to oxen docs; mention systemctl controls
2 years ago
Jason Rhinelander b442e8a43b
readme: point to oxen docs; mention systemctl controls 2 years ago
Jeff 27ba3e044d
prevent segfault in route poker if Init() is not called 2 years ago
majestrate 9e4bd2cd44
Merge pull request #1801 from majestrate/introset-publish-spam-fix-2021-11-16
prevent introset publish spam
3 years ago
majestrate 838208217d
Merge pull request #1819 from majestrate/android-drop-x86-2021-12-05
drop x86 for android as flutter does not support it
3 years ago
majestrate 94611eda19
Merge pull request #1818 from majestrate/toggle-route-poker-2021-12-04
configurable route poker
3 years ago
majestrate 229a6c9bb9
Merge pull request #1828 from zoobab/dev
Add missing libssl-dev
3 years ago
Benjamin Henrion 409772f763
Add missing libssl-dev
Add missing libssl-dev on Ubuntu to compile it from source.
3 years ago
Jeff Becker 061aebc964
reword auto-routing config comment 3 years ago
Jeff Becker 14ffdb6639
configurable route poker
this allows you to use exit nodes without forcing routes over the interface, useful for using lokinet with an exit and selectively routing over the lokinet interface using an external socks proxy or binding to device explicitly.

* make route poker configurable, defaults to enabled but allows disabling it on runtime if desired
* add config option [network]:auto-routing to enable/disable route poker
3 years ago
majestrate 54bff69a0a
Merge pull request #1816 from majestrate/exit-pooling-2021-12-01
client side exit node pooling
3 years ago
Jeff Becker da887dc559
implement exit node pooling, allows users to use multiple exits for an address range.
mappings per ip stick to the same exit, each new ip is mapped to a random exit in the specified pool.

make exit-auth multi value
3 years ago
majestrate 64224f2344
Merge pull request #1822 from majestrate/make-windows-work-again-2021-12-07
Make windows work again
3 years ago
Jeff 776e9227fd
make serivce::Endpoint::EnsurePathToService have a default timeout as a named constant. 3 years ago
Jeff 301b19bd0f
do not send buggy reply as rpc 3 years ago
Jeff 388fc53380
match io loop event order on windows/apple to match linux.
on win32/apple reading packets from the interface does not count as an io operation.
manually trigger pump on win32/apple to pretend that it is an io event.
add platform quark function MaybeWakeUpperLayers on vpn::Interface to manaully wake up the other components on platforms that need that (ones on which packet io is not done via io events).
on non linux platforms, use uv_prepare_t instead of uv_check_t as the former triggers before blocking for io, instead of after. this better matches linux's order of operations in libuv.
3 years ago
majestrate 44c7cf5f27
Update readme.md
remove old parts about macos from readme
3 years ago
majestrate 019a9f1611
Update readme.md
remove pedantic separation in readme
3 years ago
majestrate 6af589d845
Update readme.md
correct cmake flag
3 years ago
majestrate d186a887d3
Update readme.md
remove note in readme
3 years ago
majestrate b7bbb7f40d
Update readme.md
fix readme, do not use static deps.
3 years ago
Jeff fe07665ac5
remove duplicate file 3 years ago
Jeff 9c68f64929
add deps to doxygen 3 years ago
Jeff be47299b5d
more docs 3 years ago
Jeff 4bbf5522b4
spaces 3 years ago
Jeff 479fba6bd0
add big chunks of docs 3 years ago
Jeff 2772a32907
* fix up lokinet cli help opts
* document doxygen
3 years ago
Jeff Becker 29df7bec74
remove old out of date documentation 3 years ago
Jeff e0df1875fb
drop x86 for android as flutter does not support it 3 years ago
Jeff 5890c99a81
Merge pull request #1817 from majestrate/disable-upstream-ip6-dns-2021-12-03
disable ip6 upstream dns in libunbound
3 years ago
Jeff Becker 0e2b0edaf6
when lokinet looses ip4 connectivity libunbound used to freak out and only use ip6 after such an event.
as a result dns queries stop working because we blackhole ip6 routes if exit mode is on.
this prevents this case from being hit.
3 years ago
Jeff ce8b3c83a7
Update high-level.txt
add notice to file as very out of date.
3 years ago
Jeff b23ceefc5a
Merge pull request #1812 from majestrate/log-level-demotion-11-28-2021
demote log statement levels
3 years ago
Jeff Becker ec8d990163
demote log statement levels 3 years ago
Jeff d7529dafbc
Merge pull request #1811 from majestrate/android-ci-optimize-2021-11-23
parallelize android build much better
3 years ago
Jeff Becker 8c6bf31c52
paralellize android build much better
* split up configure step and build step so that build steps goes all at once
* update ci to use new build structure for android
3 years ago
Jason Rhinelander 5de5091e8d docker CI: Fix error message 3 years ago
Jason Rhinelander d24f89192d Bump version 3 years ago
Jeff Becker 172c2dec45
create new constexpr for the staleness window for introsets and use it in publishing introsets and intro selection 3 years ago
Jason Rhinelander 189c4bfba4
Also consider last publish; eliminate unwanted condition
We don't really carry about when the last regen was attempted, but
rather about when the last publish was attempted (or succeeded).
3 years ago
Jeff Becker 8ba03de44e
match timeouts in introset selection spread with logic for publishing 3 years ago
Jeff e4514aec3d
Merge pull request #1799 from majestrate/static-ci-disable-lokinet-bootstrap-2021-11-16
disable lokinet-bootstrap in static linux ci pipeline
3 years ago
Jeff Becker e7d282993a
in static linux ci pipeline disable building lokinet-bootstrap and bundle a bootstrap.signed 3 years ago
Jeff b95e53daf9
Merge pull request #1797 from jagerman/random-optimizations
Random optimizations
3 years ago
Jason Rhinelander 5115162066 Use libuv's cached current time for `time_now()`
We are calling time_now() a huge amount, and it is a major consumer of
CPU cycles, but we don't need it: most of the time the current event
loop time is enough.
3 years ago
Jason Rhinelander b2ee003329 Optimization: eliminate unneeded shared_ptrs
We have a few cases where we're making an extra shared_ptr which we copy
into a lambda, which then results in an extra unnecessary refcount
decrement in the parent; this changes them to give an rvalue reference
to the lambda to avoid the extra incr/decr instead.

The one in Session::Pump is particularly noticeable and shows up in
profiling.
3 years ago
Jeff 3fc172f4dd
Merge pull request #1796 from jagerman/hotloop-optimization
Avoid std::function in hot pump code
3 years ago
Jason Rhinelander 7a04911b9b Avoid std::function in hot pump code
We're seeing overhead here of the std::function invocation, which we can
easily avoid in this case by not using a std::function around the
callback.
3 years ago
Jason Rhinelander f270d74441
Merge pull request #1795 from majestrate/try-reducing-cpu-usage-2021-11-09
make PumpLL idempotent to reduce cpu use a bit
3 years ago
Jason Rhinelander 09c2b31b25 Move paths pumping into PumpLL 3 years ago
Jason Rhinelander 687b54f860 Abstract & simplify logic 3 years ago
Jason Rhinelander 711038d150 Remove debug comment 3 years ago
Jason Rhinelander f63fff37a3 Remove broken test
This test isn't very useful, but also broken with the other changes on
this branch.
3 years ago
Jason Rhinelander 0fe7153f6e Fix client latency bug; De-shared_ptr IHopHandler queues
- Replace m_FlushWakeup with a call to the router's god mode pump
  method.  m_FlushWakeup apparently isn't enough to get things out, and
  we can end up with incoming packets that don't get properly handled
  right away without it.

- The shared_ptr around the ihophandler queues isn't needed and is just
  adding a layer of obfuscation; instead just exchange the list directly
  into the lambda.

- Use std::exchange rather than swap

- A couple other small code cleanups.
3 years ago
Jason Rhinelander 70553c7627 Remove hopeless flush
The TriggerPump just below this is *already* going to trigger a flush,
so the extra flush call here can't do anything useful (and in
particular, it won't clear up the queue *immediately*, which is what
this code looks like it was aimed at doing).
3 years ago
Jason Rhinelander fbc5cb0a6d Add another missing pump trigger 3 years ago
Jason Rhinelander bce7e2e56d Pump outbound context 3 years ago
Jason Rhinelander 846577a0aa Add missing inbound traffic pump trigger 3 years ago
Jason Rhinelander 8cdde74020 Simplify 3 years ago
Jason Rhinelander b3a8160c89 Pump hidden context sooner
This has to happen before pumping links because it is putting things on
links.
3 years ago
Jason Rhinelander 0924dd8862 Remove dead declaration 3 years ago
Jason Rhinelander f9395cd5dd Cleanup: avoid pointless copy of `this` pointer 3 years ago
Jason Rhinelander 9844d358e6 Fix packet delay creep
- Make the main PumpLL also pump hidden services, rather than using
  separate wakers in each TunEndpoint.  It seems there is some
  interactions that just one or the other is not enough.

- Eliminate TunEndpoint send queue -- it isn't needed as we can just
  send directly.
3 years ago
Jason Rhinelander 99b12940ad Cleanups 3 years ago
Jason Rhinelander e47d3098ac Increase plaintext queue size from 32 to 512
In testing we were sometimes hitting a full queue error, which makes
sense because the queue size seems really small.

Increase it to 512.
3 years ago
Jason Rhinelander 78cc466bf2 Rename PumpLL -> TriggerPump
And rename the actual pump implementation back to PumpLL.
3 years ago
Jason Rhinelander 031ea7aa37 Get rid of external event loop direct wakeups
If something needs to wake up the event loop it should be using an
async, as we are now with PumpLL(); but we had various code triggering a
wakeup, expecting that PumpLL gets called on every wakeup, which isn't
true anymore.
3 years ago
Jason Rhinelander 74215fc44c Fix link layer delivery race condition (fix random ping delays)
We trigger a pump immediately, but this is racey because we add to our
plaintext data in a worker thread; if the worker thread runs after the
pump then it ends up leaving plaintext to be handled, but there's no
wakeup until the next one.

This was the cause of seeing a random +1s and bunching added to ping
responses sometimes: it wasn't until the *next* ping goes through the
network that the plaintext queue gets processed, at which point it
flushes the old one and often the new one together.

The fix here gets rid of the map of sessions needing wakeups and instead
adds an atomic flag to all of them to let us figure out which ones
need to be flushed.
3 years ago
Jason Rhinelander aa1dc83459 Simplify 3 years ago
Jason Rhinelander 362fda5a56 Combine empty + pop into single call 3 years ago
Jason Rhinelander b03f3c2d79 Remove another unwanted unconditional PumpLL 3 years ago
Jason Rhinelander 9113a6b36b Triggered pumping
This redoes how/when we pump so that we should only be calling the
idempotent PumpLL() when we actually have (or may have) something to
pump.
3 years ago
Jason Rhinelander bfc6d35b33 Simplifications & C++17
- Modernize some iterator loops
- Simplify a couple places by using `if (init; ...)`
- Replace various std::binds with lambdas
3 years ago
Jason Rhinelander 41807f1763 transit hop: drop instead of flushing when full
If full happens we are going to trigger a bunch of flushes which
probably isn't very useful, so drop instead.
3 years ago
Jason Rhinelander cf5c4e7284 outbound_message_handler: skip instead of aborting on removed paths 3 years ago
Jason Rhinelander 633431be66 Make outbound message queue PumpLL again if it doesn't send all 3 years ago
Jason Rhinelander faf95cbd0a Allow a nullptr callback for event loop PumpLL 3 years ago
Jeff Becker 8a9025e234 only pump path context in idempotent pumpll 3 years ago
Jeff Becker bb86996acf make event loop pump function non idempotent 3 years ago
Jeff Becker 8744c93944 prevent 100% cpu usage on service nodes
call_soon wakes up the mainloop and is often reentrant, we dont want to
ever way up the event loop but we also want to always defer the call so
we always use the workers
3 years ago
Jeff Becker 22d4b88edc
make PumpLL idempotent to reduce cpu use a bit 3 years ago
Jason Rhinelander 1ddfb7420a
Merge pull request #1791 from majestrate/exclude-failing-from-queue-2021-10-29
exclude fully failed nodes from service node testing list
3 years ago
Jason Rhinelander 0ec50e6624 Fix comment typo 3 years ago
Jeff Becker fcba709fcb
do not requeue nodes for testing from failing queue if we do not have them marked as failing anymore 3 years ago
Jeff 60c1b69ea3
Merge pull request #1784 from jagerman/deb-docker-images
Generate CI images with much DRY-er Python dockerfile generating script
3 years ago
Jason Rhinelander e6622c1d46 Install g++-8 on bionic 3 years ago
Jason Rhinelander cd49031bd2 Fix race condition in interactive output 3 years ago
Jason Rhinelander fd81ee76af
Merge pull request #1778 from majestrate/net-range-detection-bug-2021-10-22
check for intersecting ip ranges correctly, add unit test
3 years ago
Jason Rhinelander 52f8273dc1
Merge pull request #1781 from majestrate/bump-static-deps-2021-10-25
bump libunbound static dep hashpin
3 years ago
Jason Rhinelander 0b4c56dff5 Add hacks; add --distro to rebuild just one
Bionic is broken and needs a hack to create some dumb pgm include
directory.

Add --distro cli argument so that you can rebuild just one distro.
3 years ago
Jason Rhinelander 0572713533 Fix i386 builds 3 years ago
Jason Rhinelander 09e97eef77 Make it snazzy
Shows statuses that "fill in" when run interactively.
3 years ago
Jason Rhinelander 2064ca049d Parallelize builds 3 years ago
Jason Rhinelander 9b7ec7dd50 Add --no-cache option; fix manifest generation 3 years ago
Jason Rhinelander 1c4332ad6a Replace dockerfiles with a Python script 3 years ago
Jason Rhinelander cbbee59774 Add a bunch of base CI images for building debs
Installs just the base tools (which are quite substantial), but not the
deps (which get installed as part of the build).
3 years ago
Jeff Becker b5f5d07f03
bump libunbound static dep hashpin 3 years ago
Jason Rhinelander 808c2df6cc
Merge pull request #1779 from jagerman/ci-python-deps
Add python packages to ci images
3 years ago
Jason Rhinelander f3bac4ae72 Pass DOCKER_BUILD_OPTS env var to docker build 3 years ago
Jason Rhinelander c7410660c8 Make sure we apt-get update in the build
The base image can get out of date.
3 years ago
Jason Rhinelander 78e829a03f Add python build deps to ci images 3 years ago
Jeff Becker 6c70022dcc
check for intersecting ip ranges correctly, add unit test 3 years ago
Jeff Becker 1a360c1a36
version bump to 0.9.7 3 years ago
Jason Rhinelander 410e98f4eb
Merge pull request #1775 from jagerman/parallel-submodules
Fetch CI submodules in parallel
3 years ago
Jason Rhinelander 45249422b1 Fetch CI submodules in parallel 3 years ago
Jeff dce6c1e3b6
Merge pull request #1774 from jagerman/clang-13
Docker + clang updates
3 years ago
Jason Rhinelander 7bc86ff983 Reorder pipelines to put static builds together 3 years ago
Jason Rhinelander b64a38ff2c Add missing xz-utils to buster 3 years ago
Jason Rhinelander 31d2242cc6 Disable ABI warnings on buster/armhf 3 years ago
Jason Rhinelander d27a095f1f Fix arch-specific docker repo names 3 years ago
Jason Rhinelander f71d795f1d Make sure we always pull the latest image 3 years ago
Jason Rhinelander 55356face2 No recommends 3 years ago
Jason Rhinelander 76d69a3d70 Add cached images with debhelper & related tools for deb pipelines 3 years ago
Jason Rhinelander 4351611859 Add automake, libtool, libjemalloc-dev 3 years ago
Jason Rhinelander 0a9b020555 Update Catch2 to latest to fix build on impish 3 years ago
Jason Rhinelander d64e2ae0af Reformat RUN commands to make editing easier
- split them on multiple lines
- sort the installed package deps
- don't use extra unnecessary `bash` invocation
3 years ago
Jason Rhinelander 326670b959 Docker package updates:
- add `make`
- add `patch`
3 years ago
Jason Rhinelander 47d8c95e68 CI docker multiarch
Adds multiarch docker images and starts using them.
3 years ago
Jason Rhinelander 1dccbb5814 Update deb repo dns name 3 years ago
Jason Rhinelander ca9d979361 Docker image updates
- split debian sid into base/sid/clang images
- similarly for debian stable
- add jsonnet to lint
- add `--pull` to docker build so that we always pull the latest images
  (otherwise we were building on whatever local cache we have for
  `debian:sid`, etc., which made the base image update layer much
  larger).
- don't install Recommends by default
- add libzmq3-dev
- split android into android (base) and flutter
- hard-code registry.oxen.rocks into the dockerfile stuff because that
  seems to be the only way to properly depend on other docker builds.
- update a few CI builds that should have been using our images but
  weren't.
- Update a few CI images to bullseye instead of buster

Add openssh-client (for sftp to upload builds)
3 years ago
Jason Rhinelander 6f58648161 Add libzmq3-dev; change deps into arrays
We're currently rebuilding libzmq3-dev all the time in most of the CI
jobs.
3 years ago
Jason Rhinelander 9c32058a50 Remove windows linefeeds 3 years ago
Jason Rhinelander 1526b2a2eb which => command -v; different format.sh exit codes
`which` is a debian tool that is being deprecated in favour of
posix-standard `command -v`, so which to that to avoid deprecation
warnings.

Change the exit codes of `contrib/format.sh verify` to be unique for
each formatting program.
3 years ago
Jason Rhinelander 52492c6253 make format 3 years ago
Jason Rhinelander 9b0b9fe67b Add jsonnet formatting (if jsonnet is installed) 3 years ago
Jason Rhinelander 1e22417ade Add missing deprecated copy assignment operator
Clang-13 warns (and -Werror dies) without it.
3 years ago
Jason Rhinelander 497c62b586 Update clang build to 13; add full llvm-13 build 3 years ago
Jason Rhinelander aee5dd2776
Merge pull request #1769 from majestrate/fix-sid-2021-10-13
fix debian sid compiler error
3 years ago
Jason Rhinelander 50449038b4 Another gcc-11 fix
GCC is wrongly warning that `h` is uninitialized here, but it clearly
isn't.  Work around it.
3 years ago
Jeff Becker 07fb41cfd4
fix debian sid compiler error 3 years ago
Sean e11a94c95c
RPC call for summary get_status (#1742)
* RPC call for summary get_status

* lint

* update with review notes

* further review points

* uint64_t
3 years ago
Jason Rhinelander 51016e672f
Merge pull request #1760 from majestrate/default-to-unix-socket-for-rpc-2021-10-06
catch exceptions on setup and dont abort
3 years ago
Jason Rhinelander 0768593fa5
Merge pull request #1762 from majestrate/v6-base-address-configuration-fix-2021-10-06
catch ipv6 ioctl throwing when someone runs lokinet with no ipv6
3 years ago
Jeff 1846c3e3d8
prevent bizare half open state. (#1754)
* attempt path timeout bullshittery fix

* make sure ServiceInfo always has its address set up

* do not copy intros in constuctor, ammend logging and
add assert
3 years ago
Nuc1eoN 8989910881
Add missing dep 'cppzmq' (#1764)
* Add missing dep to cppzmq
3 years ago
Jeff Becker 937d07b6ce
catch ipv6 ioctl throwing when someone runs lokinet with no ipv6 3 years ago
Jeff 40f26bb674
Merge pull request #1761 from majestrate/v6-base-address-configuration-fix-2021-10-06
resepct empty ipv6 range setting
3 years ago
Jeff Becker 5e9f9686e7
set base v6 address to nullopt when explicit empty string is provided 3 years ago
Jeff Becker 4c5b90fb03
handle exceptions on setup and config load without aborting 3 years ago
Jeff 24681fd35d
Merge pull request #1759 from majestrate/iterate-dir-in-order-2021-10-06
iterate through directory entries in lexigraphical order
3 years ago
Jeff 12bca7031b
Merge pull request #1638 from majestrate/log-refactor-source-location-2021-05-11
refactor logging to use std::source_location
3 years ago
Jeff 1d955cf28d
Update fs.hpp
style nit
3 years ago
Jeff Becker 00f81b1dac
iterate through directory entries in lexigraphical order 3 years ago
Jeff Becker d882f1a302
some compilers hated [[maybe_unused]] so use (void) when they are unused 3 years ago
Jeff Becker cf187ddffc
fix up logging, put _log into anonynous namespace, make only log trace nop in release builds 3 years ago
Jeff Becker 20814a4adc
use llarp:: prefix for LogError 3 years ago
Jeff Becker 1b06e263fb
update log statement for win32 3 years ago
Jeff Becker 2d5faccb9f
refactor for apple 3 years ago
Jeff Becker 7d07dea235
fix up gripes in source_location
* get rid of columns we dont need those
3 years ago
Jeff Becker acdb8a19a6
for some reason [[maybe_unused]] is hated by buster 32 bit x86 so we do something else
to appease that compiler.
3 years ago
Jeff Becker 18c5b43e63
use inline source_location implementation for android too 3 years ago
jeff 0546dab2e3
make source location happy on macos
* because of course apple doesn't provide any implementation (lmao) we provide one ourself
3 years ago
Jeff Becker 5c457ff486
refactor logging to use std::source_location
* use std::source_location instead of godawful macros in logging
* remove unused/absolutely haram af json logstream
* fix bug in android logger where it doesn't respect eLogNone
3 years ago
Jeff 5a5765edd5
Merge pull request #1756 from majestrate/ngtcp2-build-static-fix-2021-10-06
always build ngtcp2 as static
3 years ago
Jeff Becker d354a35869
always build ngtcp2 as static
squashme
3 years ago
Jason Rhinelander e32f7faf55
Merge pull request #1751 from majestrate/update-ngtcp2-2021-08-24
Update ngtcp2
3 years ago
Jason Rhinelander d733e37d9f
Merge pull request #1750 from majestrate/ci-update-2021-09-24
update ci to use main lokinet mobile repo
3 years ago
Jeff Becker 7d299d1c74
update ci to use main lokinet mobile repo 3 years ago
Jeff Becker 9c37e0146e
make it compile again 3 years ago
Jeff Becker ec83641ee8
update submodule 3 years ago
Jeff Becker 45b5fec314
make it compile again (squashme) 3 years ago
Jeff Becker 3c61af1de9
bump ngtcp2 submodule 3 years ago
Jeff ed271de715
make lokinet-util library static
every other lokinet internal lib is static, but liblokinet-util was not, this fixes that.
3 years ago
Jeff 9f19a3653e
Merge pull request #1741 from majestrate/systemd-resolved-dns-fix-2021-09-16
SystemD DNS fix
3 years ago
Jeff Becker d1246947f7
SystemD DNS fix:
when dns is port 53 call SetLinKDNS otherwise call SetLinkDNSEx as on older versions of systemd-resolved SetLinkDNSEx is not available.
3 years ago
Jeff cf1086e4ac
Update readme.md 3 years ago
Jeff 2fbfeb1112
Update readme.md 3 years ago
Jeff ad9bbe9290
Update readme.md 3 years ago
Jeff 3f57427bba
Update readme.md
more updates to readme, remove unmaintained parts, add and remove chunks of information.
3 years ago
Jeff 1e5f753dc9
Update readme.md
our readme sucks, make it suck a bit less
3 years ago
Jeff 2a5c601f90
Merge pull request #1738 from jagerman/fix-jemalloc-option-dupe
Remove duplicate handling of jemalloc
3 years ago
Jason Rhinelander 488ed47cda Remove duplicate handling of jemalloc
We were linking/loading it in different ways, one with cmake option
`USE_JELLOC` and the other, older version `WITH_JEMALLOC`.  This removes
the latter (which was default OFF) and keeps the former (which was added
and has been default ON since 0.9.4 or so).

Also removes the `ifdef`ed JEMALLOC code in lokinet.cpp because we don't
need it; just linking to jemalloc is enough to get the malloc/free
replacements.
3 years ago
Jeff c30538a381
Update exit-setup.md
`hops=1` is not supported anymore.
3 years ago
Jeff baa89771fb
Merge pull request #1735 from majestrate/cmake-lokinet-bootstrap-tweaks-2021-09-10
make lokinet-bootstrap target toggleable
3 years ago
Jason Rhinelander 62d7192a50 Add mainnet/testnet bootstrap files into repo
We use them everywhere now (include the debs) so it makes sense to have
them bundled here rather than needing a download during package build
(in particular for debs that's considered a bad thing).
3 years ago
Jason Rhinelander 8df5005f54
Apply suggestions from code review 3 years ago
Jeff ff71e65ae0
Merge pull request #1736 from jagerman/ngtcp2-only-lib
Redo how we build ngtcp2 lib
3 years ago
Jason Rhinelander 089fc026d8 Redo how we build ngtcp2 lib
ngtcp2's top-level CMakeLists.txt is not friendly to being used as a
subdirectory (for instance, it always adds a `check` target when cunit
is installed), so stop using it in favour of skipping directly into the
ngtcp2/lib subdir.

This requires some hackery to set up a couple of the things the
top-level cmake does, but it isn't *too* painful.
3 years ago
Jeff Becker 7e1236503c
make lokinet-bootstrap target toggleable
add cmake option to disable building lokinet-bootstrap binary
3 years ago
Jason Rhinelander dbea1f98e7
Merge pull request #1651 from majestrate/lokinet-bootstrap-help-messages-2021-05-18
add --help and -h flags to lokinet-bootstrap to show help message
3 years ago
Jason Rhinelander 6c3c523404 Update wording and wrap help message 3 years ago
Jason Rhinelander 0f8297a186 Bump dev branch version 3 years ago
Jason Rhinelander 1972cf3f27
Merge pull request #1723 from majestrate/rc-gossip-limiter-2021-08-30
limit RC gossip to 20 peers max
3 years ago
Jason Rhinelander 53b62857da Disable tests on static bionic
It's failing to link with LTO on bionic because of an internal compiler
error for some random reason, so just disable building the tests there
for now (keeping LTO on is more useful since that is also what gets used
for a static build).
3 years ago
Jeff Becker 9ad63140f2
use std::sample to grab MaxGossipPeers when populating std::unordered_set 3 years ago
Jeff Becker a739e7b532
try not to prefer outbound vs inbound link sessions
before when we get the list of router ids for gossip it was highly bias towards outbound sessions.
instead now we get a full list of link session router ids in random order, truncate them to be at most MaxGossipPeers number of keys, and then put them into an unordered set
3 years ago
Jeff Becker d91ce53da1
limit RC gossip to 20 peers max 3 years ago
Jason Rhinelander 41ba49a185
Merge pull request #1688 from majestrate/macos-network-extension-2021-05-14
Macos network extension port
3 years ago
Jeff Becker 344d0a2f2d
format 3 years ago
Jeff Becker 2ee43c2162
set ipv6 address on apple to hardcoded value 3 years ago
Jason Rhinelander c52782ab32 Add IPv6 addr/routing for macos 3 years ago
Jeff Becker b52cf97e11
override ShouldHandlePacket on android to bypass non .snode/.loki dns hooking. 3 years ago
Jason Rhinelander 7fe5ffb209 Fix IPv4 routes are disabling exit
(This was actually already working because macOS is buggy and doesn't
actually remove routes other than the default).
3 years ago
Jeff Becker 979488830e
remove unused import
lokinet.swift no longer touches internals of lokinet network extension so we remove the import for it
3 years ago
Jeff Becker 0d64de17c8
tmp commit for debugging (revert me) 3 years ago
Jeff Becker 82314a3cac
add comment about android dns 3 years ago
Jason Rhinelander 831cc23de1 Remove obsolete bigs
Removes stuff we didn't end up needing/using:
- Lokinet.modulemap
- apple bits from lokinet.cpp (we don't use lokinet.cpp at all on macos
  anymore).
- dnsproxy/extension C++ headers
- apple-specific network extension config in llarp::config::Config
3 years ago
Jason Rhinelander 12e00b7a99 Remove advertising of big crappy company 3 years ago
Jason Rhinelander 2b8ef416c3 Remove old mac installer packaging 3 years ago
Jason Rhinelander 92c7fb9872 LOKINET_VERSION -> built in lokinet_VERSION 3 years ago
Jason Rhinelander 38335f13a2 Remove debugging 3 years ago
Jason Rhinelander 8aef5d742d Re-enable LTO; target macos 10.12+ 3 years ago
Jeff Becker 10cd331863
invert logic for android dns hook 3 years ago
Jason Rhinelander f51d0a80a2
Forward-declare ub_ctx/ub_result
Avoids needing unbound.h in the search path to include the
unbound_resolver.hpp header.
3 years ago
Jeff Becker 1315dabcb9
disable language ASM, yolo 3 years ago
Jason Rhinelander 067fcf71d3
Remove dead code 3 years ago
Jason Rhinelander a7decd5ec3
Silence warnings 3 years ago
Jason Rhinelander e11efe9bc5
Reformat 3 years ago
Jason Rhinelander 9dd604820f
Unleak exit mode DNS via unbound DNS trampoline on (macOS)
When we enable/disable exit mode on this restarts the unbound DNS
responder with the DNS trampoline (or restores upstream, when disabling)
to properly route DNS requests through the tunnel (because libunbound's
direct requests don't get tunneled because unbound is inside the network
extension).
3 years ago
Jason Rhinelander 0f097450d7
Remove debug 3 years ago
Jason Rhinelander f00e78c1a3
Add DNS trampoline
This runs a DNS listener on localhost:1053 that bounces requests to the
upstream DNS through the tunnel.  The idea here is that, when we turn on
exit mode, we start libunbound bouncing the requests through the
trampoline (since if it makes direct requests they won't go through the
tunnel).

(The actual libunbound configuration is still to follow).
3 years ago
Jason Rhinelander fd759914b6
Remove unused vars 3 years ago
Jason Rhinelander e84390748d
Add RouteManager; make exit on/off work 3 years ago
Jason Rhinelander c74dcba463
Add lokinet subnet to default routes
Mac doesn't route to a tunnel's ip range by default.  WTF.
3 years ago
Jason Rhinelander 9afa95cd7a
Remove unused/empty/no longer used apple headers 3 years ago
Jason Rhinelander 3527c9cdb5
Remove more unused dns-proxy files 3 years ago
Jason Rhinelander 58da228f62
Generate a default client lokinet.ini on startup if it doesn't exist
Thus when a user goes looking for it they'll find the (commented out)
default in the right place and can edit it.

(That right place is: ~/Library/Containers/com.loki-project.lokinet.network-extension/Data/lokinet.ini)
3 years ago
Jason Rhinelander fec3598e16
Remove no-longer-used framework.mm 3 years ago
Jason Rhinelander e39c473c88
format.sh: support macports clang-format
macports names it clang-format-mp-N to avoid clashing with a
system-installed one.
3 years ago
Jason Rhinelander 2964051f0d
Remove swift version (do not squash)
Don't squash this commit so that the swift version stays around in
history in case we need to resurrect it again some day (i.e. when Apple
decides to kill off Objective-C support).
3 years ago
Jason Rhinelander 329da951b7
Apple OS interface cleanup & refactoring
- Add a C callback interface (context_wrapper.h) between lokinet and the
  objective-C code so that:
  - we can use objective-C (rather than objective-C++), which seems more
    likely to be supported by Apple into the future;
  - we minimize the amount of code that needs to be aware of the Apple
    APIs.
  - this replaces apple logger objective c++ implementation with a plain
    c++ implementation that takes a very simple C callback (provided
    from the obj-c code) to actually make the call to NSLog.

- Add various documentation to the code of what is going on.

- Send all DNS traffic to the primary IP on the tun interface.  The
  match prefixes simply don't work as advertised, and have weird shit
  (like even if you get it working for some domains, "instagram.com"
  still doesn't because of god-knows-what Apple internal politics).

- Drop the dns proxy code as we don't need it anymore.

- Don't use 9.9.9.9 for default DNS.  (We might consider the unfiltered
  9.9.9.10 as an alternative default, but if we do it should be a global
  lokinet change rather than a Mac-specific change).

- Parse a lokinet.ini in the data directory, if it exists.  (Since we
  are sandboxed, it is an app-specific "home" directory so is probably
  buried god knows where, but at least the GUI ought to be able to get
  it to let users add things to it).

- This commit also adds a swift version of the PacketTunnelProvider
  glue, which ought to work in theory, but the *tooling* for cmake is so
  underdeveloped that I couldn't find any way to actually get the damn
  thing working.  So I'm committing it here anyway (and will revert it
  away in the next commit) in case we someday want to switch to it.

-
3 years ago
Jason Rhinelander 712b5a5608
Tweak icns generation to only run when necessary 3 years ago
Jason Rhinelander 3f0b34e860
Consolidate apple-specific bits into llarp/apple 3 years ago
jeff deb0a982be
it works 3 years ago
jeff 1272a4fbe1
add dummy sign target for ci when we don't have signing keys
remove static macos from ci pipeline
3 years ago
jeff d24221e67a
make ci run ./contrib/mac.sh with no codesigning 3 years ago
jeff 7db2459469
macos sort of works now 3 years ago
Jason Rhinelander 81d27c35c1
Default CODESIGN_APPEX to CODESIGN_APP
Sometimes (e.g. dev builds) these can apparently be the same; sometimes
it seems they need to be different, because Apple.
3 years ago
Jason Rhinelander 3ab117a03b
Switch extension from a framework to an appex 3 years ago
Jason Rhinelander faf8a699a6
Set version into Info.plist, don't manually configure
cmake already treats the info plist as a file to be configured (not
merely copied) so we don't need to configure_file ourselves to a temp
file.
3 years ago
Jason Rhinelander 0bb00baacf
Various cmake build cleanups/refactors
- Added contrib/macos/README.txt with description of the cancer
  happening here.
- Add provisioningprofiles that Apple wants to make things work properly
- Made the entitlements files match the provisioningprofiles
- Remove configured entitlements files; we *can't* change any of the
  things here because they are closedly tied to the provisioningprofiles
  -- which means if someone wants to build their own Lokinet, they have
  to replace a bunch of crap and change application IDs throughout.
  This is the hostile-to-open-source Apple way.
- Remove unused old lokinet binary, as we're no longer using it on macos
- Use a POST_BUILD rather than install to copy things around into the
  right places
- Convert all the configure_file's to consistently use @ONLY
- Misc cleanups
3 years ago
jeff 5edd045c9b
add swift version bullshit file and additional bullshittery 3 years ago
jeff 0708a0d897
initial network extension code for macos
probably does not work
3 years ago
Jeff Becker 63ed5c16ed
upload bare apk as ci artifact 3 years ago
Jeff Becker 92cfa8a558
dont bundle raw jni libs 3 years ago
Jeff Becker c39225b3b9
correct lokinet flutter url 3 years ago
Jeff Becker f65ec8e79f
make ci try building the flutter apk in the android apk pipeline 3 years ago
Jason Rhinelander f3bc00bcd8
Merge pull request #1724 from majestrate/update-static-deps-2021-08-31
bump openssl static deps version for upstream security update
3 years ago
Jeff 3bcc8f99c0
Merge pull request #1726 from majestrate/dns-graceful-teardown-2021-09-01
dns refactor
3 years ago
Jeff 060c571060
Merge pull request #1727 from majestrate/android-hang-fix-2021-09-01
dont save addrmap on android as it hangs
3 years ago
Jeff cd99e5c4f4
Merge pull request #1729 from jagerman/fix-omq-deprecation
Stop using deprecated OMQ connect_remote overload
3 years ago
Jason Rhinelander a8a7ef5461 Stop using deprecated OMQ connect_remote overload 3 years ago
Jeff 0447ffc829
Merge pull request #1728 from jagerman/fix-arg-order-v2
Unbound callbacks also need arguments reversed
3 years ago
Jason Rhinelander 14c93e2b93 Unbound callbacks also need arguments reversed
PR #1725 reversed argument orders but UnboundResolver was still using
(from,to) ordering in its callbacks, which leaked through to make a
wrong order in our reply function (which simply forwards arguments).

This fixes that bug by making UnboundResolver callback argument order
consistent (i.e. using to, from) with the PacketHandler argument order.
3 years ago
Jeff Becker 0c1a3e19bd
redo dns to use event loop on non windows and threading bullshit on windows 3 years ago
Jeff Becker a4a9062f12
dont save addrmap on android as it hangs 3 years ago
Jeff c0b8c87f81
Merge pull request #1725 from jagerman/dnsinterceptor-arg-reverse
Reapply "fix dns on android" + fix argument order
3 years ago
Jason Rhinelander 3ce329d2bf Reapply "fix dns on android" + fix argument order
The reason the dns fix on android didn't work is that the DnsInterceptor
had a reversed to/from argument order for its
`SendServerMessageBufferTo` overload, and so android/mac needed the
to/from to be reversed so that the second reverse cancelled out the
first one.

Upon review, the DnsInterceptor order (to, from) is more intuitive than
the base order (from, to), so this reapplies the dns fix and swaps
everything *except* DnsInterceptor to match the (to, from) argument
order.
3 years ago
Jason Rhinelander a70035b7ec
Revert "fix dns on android"
This reverts commit dace0224ec.

This reportedly didn't fix things on Android, and most definitely breaks
macOS (with this we get a bunch of errors about expecting inbound when
we have outbound).
3 years ago
Jeff 418eb4efaa
Merge pull request #1721 from majestrate/platform-bits-2021-08-26
initial routing table platform bits refactor
3 years ago
Jeff Becker 439183bf19
bump openssl static deps version for upstream security update 3 years ago
Jeff 2e52908510
Merge pull request #1722 from jagerman/sockaddr-optimization
SockAddr string optimization
3 years ago
Jason Rhinelander 3deb55193f SockAddr string optimization
- Reduce buffer size to INET6_ADDRSTRLEN, and use a single buf rather
  than two identical ones in each branch.
- Don't pre-reserve because doing so is usually going to over-allocate,
  but also because it prevents SSO, especially for the IPv4 case which
  should fit in SSO for all IPv4 addresses.
3 years ago
Jeff Becker 6251c13d46
add NOP implementation of VPN route manager for android 3 years ago
Jeff Becker 07a58ffa6c
use vpn::NetworkInterface for add/del route via interface instead of string 3 years ago
Jeff Becker c9b9ed91c2
make add/del blackhole default to empty implementation 3 years ago
Jeff Becker e25ae7192f
introduce add/del route via interface to route manager 3 years ago
Jeff Becker 64cd2990bc
remove old routing table maniuplation code 3 years ago
Jeff Becker 9791fd62a0
initial win32 port of route manager 3 years ago
Jeff Becker 0871862452
initial routing table refactor
* move routing table manipulation to vpn platform
* add initial linux implementation of vpn platform route manipulation
3 years ago
Jeff Becker 37dde7da05
format 3 years ago
Jason Rhinelander f39084bffa
Merge pull request #1714 from jagerman/remove-broken-split
Remove unneeded split(str, char) method
3 years ago
Jason Rhinelander 1b878e348b
Merge pull request #1715 from jagerman/default-upstream-dns-port
Fix default upstream DNS not working
3 years ago
Jason Rhinelander 73f0432b28 Fix default upstream DNS not working
The default upstream DNS was being set to 1.1.1.1:0, which doesn't work.
This fixes it to also set the port so that default upstream resolution
(i.e. with an empty config) works again.
3 years ago
Jason Rhinelander 9950adf472 Remove unneeded split(str, char) method
This function had a bug in stable (fixed in dev) when `last` returns
npos, but the function also appears to basically be duplicating what the
next split version can do, so this just removes it and uses the single
more generic split(strview, strview) method.
3 years ago
Jeff ea79d1c48c
Merge pull request #1713 from jagerman/remove-unused-user-defines
Remove unused defaults.hpp
3 years ago
Jason Rhinelander f40052df85 Remove old unused lokinet-bootstrap script
We compile one now for various, but the script apparently never got
removed.
3 years ago
Jason Rhinelander ae1243e9d9 Remove unused defaults.hpp
The definitions in here aren't actually used anywhere anymore, so just
drop it.
3 years ago
Jeff ee4e73fd94
Merge pull request #1712 from jagerman/bencode-dump-stdin
bencode-dump.py: support reading from stdin
3 years ago
Jason Rhinelander 29418f7a7b bencode-dump.py: support reading from stdin
So that you can pipe bt-encoded output into it, e.g. from the
in-progress oxend bt-rpc interface.
3 years ago
Jeff f1303125a0
Merge pull request #1708 from darcys22/patch-1
Update readme.md
3 years ago
Sean 048fdad056
Update readme.md 3 years ago
Jeff a4b552a268
Merge pull request #1682 from majestrate/route-blackhole-linux-2021-06-25
[linux] route blackholing
3 years ago
Jeff Becker e96ec156ea
add / remove route blackhole so we dont leak if we crash 3 years ago
Jeff Becker dace0224ec
fix dns on android 3 years ago
Jeff Becker 4f1bd14d3c
fix issue with excessively pedantic stl on archlinux 3 years ago
Jason Rhinelander 75b4758037
Merge pull request #1693 from majestrate/inane-fixings-2021-06-30
fixes for 0.9.5
3 years ago
Jeff Becker 14cc115489
dont use constexpr 3 years ago
Jason Rhinelander ed456b0c7e Fix typo in libuv error message 3 years ago
Jeff Becker 069d9487b7
* throw exception on invalid SessionResult when transforming to SendStatus
* add case for printing unknown SessionResult
3 years ago
Jeff Becker 114c7bab62
bump up the jam, bump it up, while your feet are jumping. 3 years ago
Jeff Becker 18cb59a1b5
* make tranform function for SessionResult to SendStatus
* add case for SessionResult::EstablishFail
* clean up outbound message handler to use transform function instead of many private member functions
3 years ago
Jeff Becker 8f4c23ef47
add option to invert regex filter results 3 years ago
Jeff Becker 3893a94e07
better time formatting for future times 3 years ago
Jeff Becker 6df1d6412d
unify introset-filter and path-filter 3 years ago
Jeff Becker 264616c8ba
fix unicode char 3 years ago
Jeff Becker 63c601b0c0
fixes for lokinetmon filters 3 years ago
Jeff Becker 91f6ca9869
typofix 3 years ago
Jeff Becker 383312a74d
make filters consistent for localhost.loki 3 years ago
Jeff Becker 30848165e7
add path filter in lokinetmon 3 years ago
Jeff Becker d918e1edda
add age to outbound contexts in lokinetmon
better time foratting in lokinetmon
3 years ago
Jeff Becker e7ac0f3902
expunge outbound contexts that have not gotten inbound traffic for a long while 3 years ago
Jeff Becker 32a94c73e2
update lokinetmon
* add --introset-filter option to filter results in introset inspection mode by regex
3 years ago
Jeff Becker 75451d7124
* add establish fail enum
* dont call outbound session hooks for inbound sessions
3 years ago
Jeff Becker e3281cd026
add string representation to SessionResult 3 years ago
Jeff Becker 1d1d97b0ef
disable peer status entirely 3 years ago
Jeff Becker 2578983a09
dont give peer stats in rpc 3 years ago
Jeff Becker 20bc338eba
inbound sessions from CLIENTS should only have an elevated lifetime 3 years ago
Jeff Becker caddeef2e8
more information in logs 3 years ago
Jeff Becker 977ea3d689
* add log warn
* throw if inbound link makes outbound session
3 years ago
Jeff Becker 99379c5def
establish outbound sessions when we have no outbound session.
when we have an inbound session we still want to make an outbound session.
3 years ago
Jeff Becker cf0349c259
if we have an inbound session don't fail with NoLink 3 years ago
Jeff Becker a316f5f787
add wine as dependancy because god made windows so that man may suffer 3 years ago
Jeff Becker da985c4c44
add docker image for nodejs 3 years ago
Jeff e28e23171d
Merge pull request #1686 from tewinget/outbound_session_maker_fixes
fix minor oversight/inefficiency with already established connections
3 years ago
Jeff Becker f4fa83703f
refactor to use RouterID instead of rc.pubkey 3 years ago
Jeff Becker e78d0b5e77
update urls 3 years ago
Thomas Winget 8515fe09d4 fix minor oversight/inefficiency with already established connections 3 years ago
Jeff bff81c62e2
Merge pull request #1685 from jagerman/jemalloc
Link to jemalloc for better memory usage
3 years ago
Jason Rhinelander 4f71276928 Link to jemalloc for better memory usage 3 years ago
Jeff 94912ba21b fix up docs generation 3 years ago
Jeff Becker abd6e4c558
use weak_ptr instead of bare pointer to prevent use after free 3 years ago
Jeff Becker aa48a1de1b
lower log level 3 years ago
Jeff Becker 3ad59105ef
when an outbound context is "marked bad" we want to ignore any new paths.
before this commit when a new path was made when an outbound context marked bad lokinet would segfault.
3 years ago
Jeff c040a1510a
update deps for source build
* change package list for static dev build
* reword the line describing why one may want to do a source build
3 years ago
Jeff 058e358b5c
Merge pull request #1669 from majestrate/inbound-convo-wrong-path-fix-2021-06-14
[bugfix] make inbound convotags reply on the correct path
3 years ago
Jason Rhinelander d2dc3b8c1b Fix program name in bencode-dump.py --help 3 years ago
Jeff 0b3b65fe4e
Merge pull request #1675 from jagerman/bencode-dumper
Add bencoded file dumper
3 years ago
Jason Rhinelander 4b0a10328a Add bencoded file dumper 3 years ago
Jeff Becker 9d0dffe086
only permit 1 pending session per udp endpoint 3 years ago
Jeff Becker 67f8a7116f
if we get a discard message from the pivot discard the outbound context if the remote intro is also expired 3 years ago
Jeff Becker 0900ab88d1
publish introsets on nearest routers
fetch introset from random routers
3 years ago
Jeff Becker 872a8d8045
use exisitng convotag first instead of trying to send to directly 3 years ago
Jeff Becker ee5723ecdc
add upperbound to number of endpoints used in lns lookups 3 years ago
Jeff Becker 1c457e2858
bump version to 0.9.4 3 years ago
Jeff Becker 3393b5a5a7
make it so lookups dont time out 3 years ago
Jeff Becker b5efb8c604
rename local variable to be clear about meaning, add comment 3 years ago
Jeff Becker 1a0e6a7ac1
remove redundant check as ReadyToSend also checks IntroSent() 3 years ago
Jeff Becker d45f0f8951
value initialize introduction so that expiresAt defaults to zero 3 years ago
Jeff Becker 9f353238af
ReadyToSend also should include checking we have a path to the remote 3 years ago
Jeff Becker ae36fd42bb
remove badIntros from lokinetmon as rpc no longer has them in it 3 years ago
Jeff Becker 4b11858bb0
make clang compile, remove unused variable 3 years ago
Jeff Becker 963250c0ef
format 3 years ago
Jeff Becker 00d4942d85
more 3 years ago
Thomas Winget 7f9a60066b
make sure we have a path to the next introduction we want to use 3 years ago
Jeff Becker d9cae4a6c6
in outbound context, ShouldBuildMore intro.ExpiresSoon delta is too big and has no overlap, change it so that 3 years ago
Jeff Becker e48feb8b9a
kill outbound context when we remove our convotag 3 years ago
Jeff Becker 71d17dc2c9
format and logging
ignore outbound session auth messages
3 years ago
Jeff Becker 5c3b4090d2
dont mark inbound sessions as outbound when we get a DNS lookup for it 3 years ago
Jeff Becker b70ecade2b
correct the logic for inbound convos
send back traffic on the correct path
3 years ago
Jeff 5da3bb6c0a
Merge pull request #1656 from majestrate/issue-1655-2021-05-30
DNS fixes and features
3 years ago
Jeff 8482952cff
Merge pull request #1661 from majestrate/android-updates-2021-06-04
android updates
3 years ago
Jeff Becker 5924ca5b3f
update android ci docker jizz 3 years ago
Jeff Becker ff796cd142
if git describe fails fall back to a placeholder 3 years ago
Jeff Becker 9e65f262f9
update docker ci jizz to include flutter on android 3 years ago
Jeff Becker a0505d8e85
mitigate lto compiler bug with lto 3 years ago
Jeff Becker db5862cda8
only use @ syntax when the dns port is not port 53 3 years ago
Jeff Becker a6fbaa7c7a
add dns hosts file option for user side dns filtering 3 years ago
Jeff Becker a24b82119b
fix #1655
* make it so that we don't set up unbound resolver when we have no resolvers provided by config
* clean up dns codepath and make it use llarp::SockAddr instead of llarp::IpAddress
3 years ago
Jeff Becker 6992d98c6a
add new JNI function: LokinetDaemon DumpStatus 3 years ago
Jeff 13af82474c
Merge pull request #1673 from majestrate/no-more-ninja-2021-06-18
No more ninja
3 years ago
Jeff Becker 5c512601bf
use std::make_optional for backwards compat on older toolchains 3 years ago
Jeff Becker 2122463d98
pass VERBOSE=1 in ci jobs for full verbosity on builds 3 years ago
Jeff Becker ae186f7000
use $(MAKE) only on makefile generator 3 years ago
Jeff Becker e9a4081451
use make instead of build essential in ci so that it does not conflict with clang builds 3 years ago
Jeff Becker 6f9f527f50
ccache android builds in ci 3 years ago
Jeff Becker 0a1cc0fc90
fix android ci output path name so that it does not conflict 3 years ago
Jeff Becker 300638163b
typofix 3 years ago
Jeff Becker 79d881689d
fix windows static ci upload for windows 3 years ago
Jeff Becker b7485b4b25
* make android ABIS list configurable
* fix android ci jizz, correct typo, upload generated assets
3 years ago
Jeff Becker 5c6b0f7178
dont build shared libs when we are building static deps 3 years ago
Jeff Becker d79b9bf59a
update android ci docker image definition to include cmake and exclude gradle 3 years ago
Jeff Becker e5bc34a7b1
[buildsystem] remove use of ninja entirely
* modify contrib/window.sh now uses makefiles
* create contrib/android.sh for building shared libs for android apk
* update drone ci jizz for android
* update cmake/StaticBuild.cmake to use $(MAKE) so that builds can parallelize (super epic)
* remove android directory as it is no longer needed
3 years ago
Jeff c9b4ca85b2
[feature] optionally keep inbound convos mapped to same IP on restart (#1672)
* add option to persist address mappings between restarts using [network]:persist-addrmap-file

* make it work

* only persist address map for inbound convos

* turn persisting address map on by default

* dont load addrmap file if it has been modified last over a minute ago to prevent foot cannons fired from loading a really old version of it
3 years ago
Jeff Becker afe55f0932
fix for testing:
dont remove from failing set
3 years ago
Jeff Becker 138abaf356
version bump 3 years ago
Jeff 2d25c3cd91
Merge pull request #1663 from majestrate/latency-test-fec-fix-2021-06-09
Last minute fixes
3 years ago
Jeff Becker 5cdb1afa0d
increase timer timeout interval because 1 seconds RTT can happen but 2 seconds is pretty bad 3 years ago
Jeff Becker fab086db0c
downgrade log level 3 years ago
Jeff Becker 3142bab0ac
move setting hop to nullptr to after delivery or delivery fail 3 years ago
Jeff Becker ce7643a3aa
remove case that spams build on an outbound context 3 years ago
Jeff Becker 9a51e4d9b5
forgot to pump on wakeup 3 years ago
Jeff Becker 486cdc0949
correctly do latency test FEC
before this it would cause a posative feedback loop causing paths to fail for "no real reason"
3 years ago
Jeff 57186110f3
Merge pull request #1658 from majestrate/network-stability-fixes-2021-06-02
Network stability fixes
3 years ago
Jeff Becker c97fe4aa96
convert magic number to where it came from 3 years ago
Jeff Becker a0b8fe144a
convert to lambda 3 years ago
Jeff Becker 3594d3e211
spelling fix 3 years ago
Jeff Becker f9e0c8f50c
add idempotent wakeup for flushing instead of the dumb queue checking 3 years ago
Jeff Becker e2bdf8792b
typofix 3 years ago
Jeff Becker 7dc1061461
mark ip active on successful send 3 years ago
Jeff Becker adc6237d1c
mark exit address outbound when we add it via rpc 3 years ago
Jeff Becker 1da0a007ff
close links and remove commit 3 years ago
Jeff Becker 719dd38cf5
more shit 3 years ago
Jeff Becker 7a5dcc3eab
correctly persist link sessions 3 years ago
Jeff Becker 046e02ebe7
fixes for loopback testnet 3 years ago
Jeff Becker 5a713b0142
tweak timeouts to be a bit more sane 3 years ago
Jeff Becker ea3276333a
on path timeout look up each router, if the lookup fails then we remove it from nodedb and close any connections to it so that bad first hops are rotated off of. 3 years ago
Jeff Becker 07e29da5c0
when we map an address forever mark it as outbound 3 years ago
Jeff Becker c2722be81c
this fixes the shit wtf 3 years ago
Jeff Becker 5909ad0386
add MarkAddressOutbound to plainquic 3 years ago
Jeff Becker cce15b13c8
dont establish paths to inbound sessions to try and address state race condition 3 years ago
Jeff Becker aefab797d7
unconditional putsenderfor 3 years ago
Jeff Becker 6a3dc67e9b
nuke from orbit style router profiling for path build timeouts.
* when a path build times out, shitlist every router in the path except the first hop, this way eventually we get the nodedb pruned to only the routers that are currently actually alive, any ones we nuke that we need later we can always do lookups for.
3 years ago
Jeff Becker 1f9b8e5972
nuke invalid routers when we get a path build fail back to not resuse them in the future 3 years ago
Jeff Becker aa1c1bad0b
record reason for path fail and the full hops 3 years ago
Jeff Becker 0096bd4e35
account for path latency in introset lookups on outbound contexts 3 years ago
Jeff Becker e4ed53224c
use weak_ptr on a path to reference its parent pathset instead of a bare pointer so crashes dont happen 3 years ago
Jeff Becker 2a76a3d081
treat ignored paths like established paths when dealing with expiration 3 years ago
Jeff Becker 23aa35b825
log when we ignore a path 3 years ago
Jeff Becker c6660dd6c1
add path aligntment timeout to send and connect timeouts on outbound context to reduce the chance of timing race conditon 3 years ago
Jeff Becker a8964a6d8a
add idempotent wake up for sending messages to the network and writing packets on interfaces 3 years ago
Jeff Becker 108b8e089e
HandleTimeout can touch iterators so do all handling of lookup timeouts outside of loop iteration 3 years ago
Jeff Becker 0f1e806155
don't kill outbound context after build or lookup fails 3 years ago
Jeff Becker 1aa2146b4a
for inbound sessions, keep them alive for the default session lifetime, for outbound sessions keep alive for 5 ping intervals 3 years ago
Jeff Becker 60cc47447f
increase default session lifetime to 5 minutes for mobile client related reasons
make the default inbound session lifetime be default session lifetime + 2 ping intervals
3 years ago
Jeff Becker a7b20b79c5
add relay order to error message 3 years ago
Jeff Becker a86152e03c
decay path build limiter per path builder every tick 3 years ago
Jeff Becker 34e31ba04f
only inform failure or success of introset lookups when all lookups have returned 3 years ago
Jeff Becker 220b8837da
delay setting sentIntro by the advertised latency of the remote intro instead of static value 3 years ago
Jeff Becker c5a86a49a3
defer ready to send state until after we send a handshake 3 years ago
Jeff Becker 40a189a9a3
log drop events more 3 years ago
Jeff Becker 00257567c2
dont call null handler
if we have no path to the remote router that's fine still use it just in case we have no other convotags
3 years ago
Jeff Becker 85cd1b6863
use inbound sessions we don't have paths to in GetBestConvoTagFor just so we can give the caller SOMETHING. 3 years ago
Jeff Becker b03d17bc8e
dont change send timeout for exits from tun handler as that screws with consistency in testing.
improve log messages, provide more info
3 years ago
Jeff Becker a94c100e7b
improve log messages about expiring convotags 3 years ago
Jeff Becker 42d75b934d
remove service nodes we can't look up from the nodedb as client 3 years ago
Jeff Becker 8dd1358cc6
* tweak introset handover timeouts
* introset path haodver tweaks
* improve warn/error messages to convey more information
* dont block on queue insertion
* reset convotag on decrypt/verify fail
* add multiple ready hooks on outbound context
* lookup introsets from close routers on dht
* continue to tick dead sessions so they expire their paths
* introset spacing
* reduce lns lookup diversity requirement for speed
* add a function to send reset convotag message
* only have 1 outbound context at a time
3 years ago
Jeff Becker 9a1a022d62
add relayOrder awareness to introset lookups.
* only propgate fail when relay order is non zero as zero relay order often fails
3 years ago
Jeff Becker 5074dd5f2b
re-enable multithreading on clients but not on service nodes 3 years ago
Jeff Becker d7a51e88f5
make router tick 250ms instead of 100ms to prevent excessive log spam
limit calls to decommissioned warning to every 30s to prevent excessive log spam
3 years ago
Jeff Becker 66f6103832
far stricter profiling algorithm
* include first hop in profiling
* decay stats faster
* make fail case for path build profiling far more sensative
3 years ago
Jeff Becker 23a82c493f
* don't include failed at when we are the pivot router as that case never happens.
* mark paths as ingored instead of expired when we stop a path builder
* only remove path builder when we have no established paths
3 years ago
Jeff Becker 503db46eca
path and intro selection fixups:
* include stricter router profiling checks in path::Builder hop slection algorithm
* make intro selection function nicer by returning a std::optional instead of a bool with an "out" variable
3 years ago
Jeff Becker 174e1b247b
fix latency tests.
* do FEC for latency tests so if we fail one test it doesn't kill the entire path
* ignore FEC'd responses on latency tests
* track latency history and report the mean latency instead of just the last sample
3 years ago
Jeff Becker 691390edff
make log warning have a more accurate message when we have no path for a relay downstream message 3 years ago
Jeff Becker 97df84994e
make packet sending logic not attempt to align back to inbound sessions. 3 years ago
Jeff Becker 4994208fbc
don't cache dns result if we have an address mapped.
we want to use dns to trigger a call to EnsurePathTo
3 years ago
Jeff Becker 5e761235d6
improve log message clairity by printing the address not hex 3 years ago
Jeff Becker 4199f2f52b
fix an assert fail in gcc 11. 3 years ago
Jeff Becker 5849176f04
reduce path intro spread slices from 5 to 4.
parameterize path intro spread slices.
3 years ago
Jeff Becker 08d62e32c0
reduce path build timeout from 30s to 10s
this should help make path timeouts less insufferable.
3 years ago
Jeff Becker 9bb3711ca4
increase link layer buffer size
allows for higher amounts of traffic on the network to be pushed.
3 years ago
Jeff Becker b1d30f9803
updates to lokinetmon
* add introset inspector mode
* add required parts for introset insecptor mode to rpc introspection
3 years ago
Jeff 8da05d08cc
Merge pull request #1660 from majestrate/win32-cmake-fixes-2021-06-04
windows cmake upgrades
3 years ago
Jeff 835ba296b0
Merge pull request #1659 from majestrate/oxend-connection-reporting-2021-06-04
initial lokinet router testing
3 years ago
Jeff Becker f3deabdb96
* get_failing does not need abstract router as paramter so we remove it
* add remove_node_from_failing to remove a node by pubkey from the failing set
* if a router is deregistered we remove it from the failing set so we don't retest it
* remove a router from the failing set if we get a test success
3 years ago
Jeff Becker 046ab3d453
export functions in liblokinet for win32 dll 3 years ago
Jeff Becker 37a9bd768e
fix linking on win32 for lokinet.dll
only apply static link flags for executables
3 years ago
Jeff Becker d88ed4eee0
make windows happy by making some constexprs non static and such as windows does not LTO 3 years ago
Thomas Winget d68d39a450 make outbound session if we do not have
currently creating an outbound session will cancel if we have any session
at all with the relay.  instead, only cancel if we have an outbound session
to that relay.  this is useful for reachability testing.
3 years ago
Jeff Becker 37ab78b654
dont run router testing if we are decommissioned.
properly name function to be called LooksDecommissioned because that is different than deregistered
3 years ago
Jeff Becker 07d18b30c0
typofix 3 years ago
Jason Rhinelander 0fa39c89dc
Make format 3 years ago
Jason Rhinelander 7f41c6092c
Fix failing pks not being populated 3 years ago
Jason Rhinelander 40ad286bf4
Don't pass last hash into UpdateServiceNodeList
It's there for polling, which we aren't doing anymore; we just got the
hash from oxend's push notification, so if it pass it in then we will
always get an "unchanged" result because we're telling oxend that we
already have the data for that hash updated.

This just drops the hash completely because we don't need it anymore.
3 years ago
Jason Rhinelander cd6962f538
Avoid copying & keep router alive by moving shared_ptr 3 years ago
Jason Rhinelander 7c964800ba
Fix unintentional whitelist/greylist copying 3 years ago
Jason Rhinelander 4974ce6f98
Add warning when can't update whitelist 3 years ago
Jeff Becker ef924aea39
gossip RC when we are not deregistered so we can come back when we are decommissioned 3 years ago
Jeff Becker 95537804cd
separate white/grey list for active/decommissioned nodes.
allow sessions to decommissioned nodes but not paths.
3 years ago
Jason Rhinelander 28ba0b7533
Add logging about testing success/fail 3 years ago
Jason Rhinelander 4630c5673a
Fix use after move 3 years ago
Jeff Becker d40484deea
handle case where we already have an outbound session, inform caller about it 3 years ago
Jeff Becker c23e121139
capture by value to appease clang 11 3 years ago
Jason Rhinelander e332bbe3f3
Switch stl mt19937_64 to CSRNG 3 years ago
Jeff Becker e8af36ee91
there were some unhandled edge cases in outbound_session_maker, specifically when we are not permitted to connect to a remoute but we got its rc we silently drop the error. 3 years ago
Jeff Becker 9ad90d029d
* use weak_ptr on core rpc
* use reachability testing code lifted storage server's code
3 years ago
Jeff Becker b830eeb535
initial lokinet router testing:
* report via rpc to oxen core connection stats on success and failure
* connect to random service node by pubkey every 5 seconds for testing
3 years ago
Jeff Becker d583f8bd72
windows cmake upgrades:
* dont call lokinet-bootstrap.exe on install
* bump lokinet gui version with hashpin update
3 years ago
Jeff 5b858c6314
Merge pull request #1657 from jagerman/double-uvw
Remove double cpr submodule
3 years ago
Jason Rhinelander d90b28ce24 Remove double cpr submodule
Fix cpr being listed twice in .gitmodules and submodule check.
3 years ago
Jeff Becker 7ba15f91f3
add --help and -h flags to lokinet-bootstrap to show help message 3 years ago
Jeff Becker cbb78b5280
bump version 3 years ago
Jeff Becker f172db75c5
don't defer call to ready hook with timer call it right away because we are ready 3 years ago
Jeff Becker 432e7f2a5a
update introset if we get a discard message from a possibly expired intro 3 years ago
Jeff 307393f47e
Merge pull request #1640 from majestrate/format-verify-2021-05-12
add format verify option to contrib/format.sh
3 years ago
Jeff 22481f8d68
Merge pull request #1647 from majestrate/stability-fix-2021-05-15
last minute fixes
3 years ago
Jeff Becker 970ccfcd4e
send a keep alive to keep an idle session alive so it doesn't get removed 3 years ago
Jeff Becker 7c6bb9a24c
simplify loop and correct logic, we want to bail out of the loop on first match. 3 years ago
Jeff Becker ae97b87111
exits don't rewrite ip addresses, fix this and add note 3 years ago
Jeff Becker f1efcc29ea
mark inbound traffic as convotag active 3 years ago
Jeff 5fb457e18a
update release motto 3 years ago
Jeff 4ab2373e85
Merge pull request #1644 from majestrate/version-bump-0.9.1-2021-05-12
version bump for 0.9.1
3 years ago
Jeff bd9db35975
Merge pull request #1643 from majestrate/win32-rpc-fixups-2021-05-13
win32 fixups
3 years ago
Jason Rhinelander 07ba2f967f
Merge pull request #1642 from majestrate/remove-dead-sessions-for-real-2021-05-12
expire paths on path builder stop
3 years ago
Jeff Becker 499bb38e6f
fix route poking via rpc:
* immediately poke routes when we are told to use an exit so that packets get pushed which makes an exit path happen
* fix up cmake oddity in nsis section
3 years ago
Jeff Becker 209bcc39dd
make liblokinet target work on nsis cpack 3 years ago
Jeff Becker 8c0f448e12
add liblokinet option to nsis cpack installer 3 years ago
Jeff Becker 2458b5fd71
rpc server fixups for win32:
* RoutePoker::Enable calls RoutePoker::Up so remove additional call to RoutePoker::Up
* allow specifying null exit via rpc
3 years ago
Jeff Becker 3c2334112c
when we stop a path builder we want to expire all of their paths so they go away 3 years ago
Jeff Becker 52b9dbd793
version bump for 0.9.1 3 years ago
Jeff 7bd38a44c1
Merge pull request #1639 from majestrate/router-deregister-connect-spam-2021-05-10
prevent router connect spam when deregistered
3 years ago
Jeff Becker d066bf8576
check in pre-push git hook so I don't lose it 3 years ago
Jeff Becker 6e67f38408
add format verification to contrib/format.sh
run with ./contrib/format.sh verify
exits with 0 if we are good, exits non-zero if we are not formatted right
3 years ago
Jeff Becker 51b7566a46
if we look deregistered we will now:
* not gossip our rc
* not explore the network to prevent outbound session attempts
* not establish sessions to other service nodes
* close all open sessions we have to tell clients we don't want them
* catch exceptions flushing peerdb in disk thread
* don't connect out to non allowed routers
* simplify logic in RCLookupHandler::RemoteIsAllowed()
* add HaveReceivedWhitelist to I_RCLookupHandler base type
* add LooksDeregistered to Router type that tells us if we think we are deregistered
* don't allow building paths over us if we are deregistered
3 years ago
Jeff 696c6d1b5a
Merge pull request #1634 from majestrate/reestablish-session-timeout-fix-2021-05-08
increase session reestablish timeout
3 years ago
Jeff Becker c5350ab2c4
DefaultPathAlignmentTimeout -> PathAlignmentTimeout 3 years ago
Jeff Becker c834414b47
when we have to reestablish an outbound session use a much much higher timeout for restablishment
so it doesn't time out and get into a state that's totally screwed.

add virtual function service::Endpont::DefaultPathAlignmentTimeout() to get the timeout for path alignment
and use it for resetablishing outbound sessions
3 years ago
Jeff 50b9b5fd22
Merge pull request #1636 from majestrate/shift-off-bad-intros-2021-05-08
shift off bad intros
3 years ago
Jeff Becker 38cc130dc3
shift off bad intros when we get a discard message, this happens if the
other side's intro expires or the pivot restarts for whatever reason.
3 years ago
Jeff 0bc8d9f477
Merge pull request #1635 from majestrate/session-tx-rx-fixup-2021-05-07
only mark existing sessions as active
3 years ago
Jeff Becker 3c22e01d7c
in the event that a session is removed and then gets more traffic we would re-add the session with everything blank if there was more traffic in the same tick.
this remedies this behavior by only increment usage timestamps on sessions if they exist.
3 years ago
Jeff 0472b790a5
Merge pull request #1627 from majestrate/service-endpoint-fixups-2021-05-05
fixups in service endpont
3 years ago
Jeff Becker 6bb31468d7
don't send nx if we have an address already mapped 3 years ago
Jeff Becker d3d929efa7
fixups in service endpoint
* increase publish introset timeout so that it does not time out on the network
* remove pedantic log warn
* make sure the path we are using for replying on inbound sessions is alive
* include convotag in log message so we know wtf is going on
* appease tom's autism, improve log message text
3 years ago
Jeff d53945b011
Merge pull request #1621 from majestrate/path-ptr-leak-2021-05-02
try fixing std::shared_ptr leak with paths
3 years ago
Jeff 34eb254959
Merge pull request #1626 from majestrate/edge-limiter-2021-05-05
limit path builds across all builders
3 years ago
Jeff e2459925a8
Merge pull request #1629 from da4089/patch-1
Tyops
3 years ago
David Arnold a644b93d11
Tyops
Originally [#10](https://github.com/majestrate/llarp/pull/10)
3 years ago
Jeff ea4529af92
Merge pull request #1628 from majestrate/unfug-network-path-builds-2021-05-05
always do path tests
3 years ago
Jeff 2bb5a7ccea
Merge pull request #1622 from majestrate/stricter-profiling-2021-05-03
stricter profiling
3 years ago
Jeff Becker b1afe0f596
always do path tests
this reverts some stupid bullshit that broke 0.9.0
3 years ago
Jeff Becker ec62228149
limit path builds across all builders 3 years ago
Jeff Becker 955071ba5c
make profiling far stricter for path builds 3 years ago
Jeff 289ab9c4be
Merge pull request #1625 from majestrate/sd-block-status-2021-05-03
report block height reported by oxend in systemd status
3 years ago
Jeff 7d3812ad62
Merge pull request #1624 from majestrate/lns-cache-invalidation-2021-05-03
dont invalidate cache on lns timeout, only on explicit negative
3 years ago
Jeff Becker e916c9610c
format 3 years ago
Jeff Becker 099276c4e7
report block height reported by oxend in systemd status 3 years ago
Jeff Becker 554a44c8bf
report block height reported by oxend in systemd status 3 years ago
Jeff Becker f955bec5da
re-add parans 3 years ago
Jeff Becker 0826a557d6
use correct intro 3 years ago
Jeff Becker f108af3d8b
only use alive paths for lookups
only track usage from sessions and don't care about intro timeouts
3 years ago
Jeff Becker 0005bee196
allow more than one outbound context per endpoint for fallback in case one outbound context takes a shit 3 years ago
Jeff Becker 83e70d95e0
dont invalidate cache on lns timeout, only on explicit negative 3 years ago
Jeff 26e182955c
Merge pull request #1623 from majestrate/dont-use-non-tested-paths-2021-05-03
dont use non tested paths
3 years ago
Jeff Becker d563e3b340
if a path's latency is zero dont use it because it's not actually a zero latency path it's probably about to be failed or timed out
increase default path alignment timeout
3 years ago
Jeff Becker 397d8b01fc
try fixing std::shared_ptr leak with paths 3 years ago
Jeff d514f30eaa
Merge pull request #1620 from majestrate/default-log-level-warn-2021-05-01
make default log level warn
3 years ago
Jeff 16237466af
Merge pull request #1619 from majestrate/configurable-path-alignment-timeout-2021-05-01
make path alignment timeout configuable
3 years ago
Jeff Becker ed707eecf9
change granularity to seconds 3 years ago
Jeff 34c939dfd6
Merge pull request #1618 from majestrate/win32-installer-tun-component-2021-05-01
win32 installer fixes
3 years ago
Jeff Becker 2968caf7af
make default log level warn fixes #1593 3 years ago
Jeff Becker 54f9e1b44e
make path alignment timeout configuable
adds [network] section parameter called path-alignment-timeout that allows configring the timeout
for optional name lookup + introset lookup + aligned path build, used by tun endpoint dns, provided
as milliseconds.
3 years ago
Jeff Becker 94f24b2fde
win32 installer
* make tuntap driver its own install component so that we can optionally not install it
3 years ago
Jeff f89c3f6b21
Merge pull request #1614 from majestrate/client-tweaks-2021-04-28
Client tweaks for 0.9.1
3 years ago
Jeff Becker f9fe6f7e3b
consmetic fixes
* print names in lookup jobs instead of yyyyyy
* update syntax in construction of objects
3 years ago
Jeff Becker f2e8b5547d
compat for lokinet 0.8.x
* don't send messages back that aren't expected
3 years ago
Jeff Becker e0185bab09
don't rehash decaying hashsets that is no bueno and probably leaks like the pipes in tom's apartment 3 years ago
Jeff Becker c6320724d3
parameterize traffic alignement timeout in dns lookups 3 years ago
Jeff Becker f69ccb73a8
limit path reanimation
* wait for a limited time for dead paths to reanimate and then remove them after that forever
3 years ago
Jeff Becker b31a484bc9
fix up outbound session
* prevent introset lookup spam
* change return values to void becuase bool doesn't mean fucking shit at all
3 years ago
Jeff Becker 6b115913bc
lokinetmon updates
* add country flags to lokinetmon
* expose hop ip addresses via rpc introspection for geoip in lokinetmon
3 years ago
Jeff fdc204d3f4
Merge pull request #1617 from tewinget/document_outbound_message_handler
Fixes subtle memory leak, adds comments
3 years ago
Thomas Winget cecbddc912 Fixes subtle memory leak, adds comments
Fixes a subtle memory leak that was a result of outbound messages which
were in the shared queue (not yet sorted into a per-path queue) when a
path was removed, resulting in a ghost path queue (and thus round-robin
order entry as well).

Adds much needed documentation to the outbound message handler class.
3 years ago
Jeff ef28de8c9f
Merge pull request #1610 from majestrate/android-fixes-2021-04-26
Android fixes
3 years ago
Jeff 8a3e3a0c39
Merge pull request #1615 from jagerman/lokinet-systemd-resolved
Lokinet systemd-resolved support
3 years ago
Jason Rhinelander 7963cd0181 Fix headers & grammar for non-systemd 3 years ago
Jason Rhinelander cdc90a2296
Merge pull request #1612 from jagerman/job-limiting
Limit builds to 6 jobs (4 for arm)
3 years ago
Jason Rhinelander 1d48cd6d35 format 3 years ago
Jason Rhinelander b9363c8d21 Put systemd ifdef around the headers, too 3 years ago
Jason Rhinelander 4ef25ef679 Add systemd-resolved dynamic DNS updating
Wires up systemd support to configure DNS on startup and when
enabling/disabling exit mode.

On startup (and when turning off an exit) we tell systemd-resolved to
direct .loki and .snode lookups to lokinet (leaving other DNS traffic
alone).

On exit enabling, we reconfigure it to resolve "." (i.e. the root DNS
domain) so that all lookups come into it.
3 years ago
Jason Rhinelander 35e4e8817b Add missing getIPv6 implementation 3 years ago
Jason Rhinelander 4b4d261c02 Limit builds to 6 jobs (4 for arm)
The CI runners don't use fixed CPU cores anymore, so that they can
better allocate jobs across idle cores, but this means ninja's default
is running an insane number of parallel compilations that likely just
makes things slower.

Add 6-job limiting to match the core limits that used to be in place.
3 years ago
Jason Rhinelander 38f0c8091b
Merge pull request #1611 from majestrate/oxencore-fetch-list-if-stale-2021-04-26
limit service node list updates
3 years ago
Jeff Becker 8a74b55af3
limit calls to service node list updates for when we are synching the chain we dont spam with list updates 3 years ago
Jeff Becker 8f588c9638
remove test case 3 years ago
Jeff Becker d750f68328
prepare for ipv6 on android
* remove 21/8 from ipv4 bogon ranges as it is being sold by DoD
* start adding ipv6 bogon ranges
3 years ago
Jeff Becker 3e7137ad96
fix regression: llarp::Context::CallSafe was not deferring call on startup 3 years ago
Jeff Becker 6d12a7a712
fixes for android jni 3 years ago
Jeff 380adae39c
Merge pull request #1608 from jagerman/missing-header
Add missing <optional> header
3 years ago
Jason Rhinelander 86dcdde8d3 Add missing <optional> header
Reported by TechnicalTumbleweed as needed to fix a build.
3 years ago
Thomas Winget 277794950c
Lokinet version bump to 0.9.0 3 years ago
Jeff 537fadc9aa
Merge pull request #1605 from jagerman/v090-update-deps
Update submodules and static build deps
3 years ago
Jeff Becker 16ff8b4149
link against core foundation as a fix for static macos build 3 years ago
Jeff Becker c4dad12f2e
libunbound patch no longer needed as fixes have been upstreamed 3 years ago
Jason Rhinelander b54d608b3f Fix curl hash
Hash was for the bz2 instead of xz
3 years ago
Jeff Becker ecd41e7a31
bump libuv version to match the tarball fetched 3 years ago
Jeff ddac3b2de2
add link to demo repo
add a link to a repo full of quick lokinet 'aware' application demos in many languages.
3 years ago
Jason Rhinelander b2b0e904d7 😡 3 years ago
Jason Rhinelander 41e5cf09ed ngtcp2 compat update 3 years ago
Jason Rhinelander ed1a80170a Update submodules and static build deps
Static deps:
- expat 2.3.0
- unbound 1.13.1
- sqlite 3.35.5
- libuv 1.41.0
- curl 7.76.1

Submodules:
- ghc-filesystem 1.5.4
- ngtcp2 (latest master)
- oxenmq 1.2.5
- pybind11 2.6.2
- sqlite_orm 1.6
3 years ago
Jason Rhinelander af4ab3a7bc Remove stable old debian/ dir
Debian packaging has been on separate debian/* and ubuntu/* branches for
a long time.
3 years ago
Jeff 4273fb0208
Merge pull request #1602 from majestrate/rpc-block-notify-fix-2021-04-20
add_command instead of add_request_command
3 years ago
Jason Rhinelander 532343bfbc
Merge pull request #1601 from majestrate/deconstexpr-2021-04-19
deconstexpr ip range bogon check
3 years ago
Jeff Becker 7f93b95080
add_command instead of add_request_command 3 years ago
Jeff Becker a3d7590fc8
correct header 3 years ago
Jeff Becker 7df184eb54
pybind fixes 3 years ago
Jeff Becker 714f6b0183
macos variant fixes 3 years ago
Jason Rhinelander 73a29d3b07 Link lokinet-bootstrap against libssl as well
Just crypto apparently isn't enough, at least on some arches/distros.
3 years ago
Jason Rhinelander 869b362572 Attempt fix to work around gcc-8 warning 3 years ago
Jeff Becker 76eb2277f8
deconstexpr ip range bogon check 3 years ago
Jeff 466be39fb3
Merge pull request #1576 from jagerman/plainquic
Plainquic tunnels (WIP)
3 years ago
Jeff Becker 71391957c5
set up accept any plainquic handlers 3 years ago
Jeff Becker 83b0f25075
cleanup after rebase 3 years ago
Jeff Becker c547cd0118
fixes for lokinet-bootstrap
* use schannel on windows platforms
* load ca bundle for non windows platforms
* use geteuid for detecting root user when finding default data dir
3 years ago
Jeff Becker 3d87dbff91
bullshit for windows and openssl with CPR
* windows static cross compile is wonky af so we add some hacks to make it work
3 years ago
Jeff Becker ebdb9699c0
refactor: make lokinet-bootstrap a native executable
* pull in cpr
* tidy up windows.sh
* rename main.cpp to lokinet.cpp to satisfy my autism
* add llarp::GetDefaultBootstrap()
3 years ago
Jeff Becker f63122272d
fix some compiler errors 3 years ago
Jeff Becker b721b8d65b
finish wiring up config for #1595 3 years ago
Jeff Becker 0be62f0ad4
win32 fix
* windows does not have uint
3 years ago
Jeff Becker 37b2f0f1e3
rebrand and bump version 3 years ago
Jeff Becker fedc56e3f1
initial commit for #1595 3 years ago
Jeff Becker 545021aa3d
temp commit 3 years ago
Jeff Becker 8ae0808f97
add forgotten files 3 years ago
Jeff Becker bb7b46c43d
fixes for testnet 3 years ago
Jeff Becker 3d76e3d4bd
split up liblokinet headers 3 years ago
Jeff Becker 118bc9c2fb
formatting 3 years ago
Jeff Becker 230fb15b24
ensure dns srv data is valid after decoding 3 years ago
Jeff Becker 998923a48d
remove old deprecated files 3 years ago
Jeff Becker a7a886e670
fix infinite iteration 3 years ago
Jeff Becker 44d7fa0ab1
remove untracked file 3 years ago
Jeff Becker 4520e7fe6c
remove deprecated test 3 years ago
Jeff Becker 07eaeb681a
try fixing deadlock 3 years ago
Jeff Becker 4889b8cddf
fix up client to snode codepath 3 years ago
Jeff Becker 8b2ede5fc5
use rxid 3 years ago
Jeff Becker 1ea77e6a68
more client to snode quic fixes 3 years ago
Jeff Becker 0ee40c1720
use rxid 3 years ago
Jeff Becker e1f90e5e5a
use rx id on snode side of paths
set protocol on reply routing messages
3 years ago
Jeff Becker e058b873b6
Revert "tweak timeout parameters for link layer."
This reverts commit eef192b37aec070d624e84cedfc94f522fd0a346.
3 years ago
Jeff Becker 1677ed40f6
dont persist sessions if we failed to build 3 years ago
Jeff Becker 657c39a91c
tweak timeout parameters for link layer.
have different timeouts for service node vs client
3 years ago
Jeff Becker 6b2c311800
cover special case for 1 hop path builders 3 years ago
Jeff Becker 2e8f47a7fa
various cleanups 3 years ago
Jeff Becker b36f87a4d2
stop crashing when we send dns reply for snode on service nodes 3 years ago
Jeff Becker b01e20b4cb
add forgotten file again 3 years ago
Jeff Becker 2fa24b5eae
add untracked file 3 years ago
Jeff Becker 5eda4addc2
correctly discard invalid data on transfer traffic message 3 years ago
Jeff Becker 25e338d621
srv records
* add srv records in RCs if we have any
* add mechanism to add SRV records for plainquic exposed ports
* resign and republish rc or introset on srv record changes
3 years ago
Jeff Becker a2285730b8
reduce log level 3 years ago
Jeff Becker de1b0c9d14
add forgotten header 3 years ago
Jeff Becker 94ecf02a62
add option to run lokinet traffic only with no exit and drop all non lokinet traffic
triggered by: exit-node=null
3 years ago
Jeff Becker 2ed0ab1ca1
liblokinet and lnproxy updates
* add lokinet_status function to get the current status of the context, aka are we ready to send or not.
* catch some exceptions in lnproxy
3 years ago
Jeff Becker e005b34169
fix up some retarded bullshit
* llarp::service::NameIsValid was not checking that the tld was .loki, add this check.
* make link layer initial connection timeout 5s not the session activity timeout which happens to be 60 god damn seconds.
3 years ago
Jeff Becker 0046de3e7a
service node logic change: simplify transit hop behavior to send protocol frames directly from a path transfer message 3 years ago
Jeff Becker 3f9e51e391
more liblokinet api functions
* get/set netid
* set log level
3 years ago
Jeff Becker cf7603f20e
temp commit, closeReset -> close 3 years ago
Jeff Becker 48ce77ed1f
XXX: single threaded mode 3 years ago
Jeff Becker bac9341ae0
fix: if we have not used a session yet we only check the intro for expiration 3 years ago
Jeff Becker 2a9d041644
add readme 3 years ago
Jeff Becker 2188b443e9
more liblokinet api stuff
* add lokinet_wait_for_ready to wait until we have published introsets and such
* optionally expose ports in lnproxy
* dont save profiles by default
3 years ago
Jeff Becker 95cd275cdd
liblokinet additions:
* add lokinet_add_bootstrap_rc function for adding an rc from memory
* prevent stack overflow on error closing connection in quic
* add in memory nodedb
* refactor how convotags are set as active
* add initial stubs for endpoint statistics
* refactor time stuff to be a bit cleaner
* update lnproxy script with more arguments
3 years ago
Jeff Becker 6306876904
proper shutdown 3 years ago
Jason Rhinelander 354f0f63e5
Reduce max number of per-connection active streams to 32
This is the max number of simultaneous open connections to the same port
on the remote.  100 was fairly arbitrary and seems a bit high.
3 years ago
Jason Rhinelander 5e912600f8
Fix connection close handling
Replace stream_reset (which typically isn't called) with a stream_close
handler (which is already called whether or not it was a reset).  Most
importantly, the server side needs to extend the max bidi streams
counter during stream_close (otherwise we run out when we hit the
limit and new connections just stall).
3 years ago
Jeff Becker 8bc60a59ac
fix up liblokinet api to be more friendly to ffi
add lnproxy exmaple of use of liblokinet
3 years ago
Jeff Becker 853cc52efb
wire up liblokinet 3 years ago
Jason Rhinelander 2a809c7a30
Add trace debugging of inbound packet type 3 years ago
Jason Rhinelander 35ead9dc6b
Remove superfluous block (FIXME: squash this with earlier "FIXME") 3 years ago
Jason Rhinelander a2045cd966
Fix debug message 3 years ago
Jason Rhinelander 80d3738531
Increase null_iv to 8 bytes to avoid ngtcp2 stack corruption 3 years ago
Jeff Becker 309a899c9f
mark loopback convotags as forever
make null handler mark discard data as activity for convotag
3 years ago
Jeff Becker f310778f81
dont regenerate convotag on loopback when we have one already 3 years ago
Jeff Becker abf8d2fb17
fix loopback convotag 3 years ago
Jeff Becker 5b05d22bad
refactors
* add path sequence numbers on routing messages
* reduce log level in debug mode
* wire up loopback style sending to ourself
3 years ago
Jeff Becker f86a2daf83
fixes
* Add service::Endpoint::HasOutboundConvo
* dont mark outbound convos as inbound
* order quic packets
3 years ago
Jeff Becker 59c9e997f2
build paths faster and limit path builds at edge router instead of via a time counter for all edges 3 years ago
Jason Rhinelander ff2e79ce38
Remove superfluous log statement
The send_packet() we call here already prints the buffer.
3 years ago
Jason Rhinelander 312222e881
Properly handle ngtcp2 returning UINT64_MAX 3 years ago
Jason Rhinelander 2ea84a61f9
Replace timer->again() with stop/start()
repeat()/again() sets a repeating timer, which we don't want; stop and
start it instead so that it fires just once.
3 years ago
Jason Rhinelander 68e96a4e5d
Remove obsolete fixme
Remote addr and ecn are handled.
3 years ago
Jason Rhinelander 7982581cfd
Revisit/reduce quic logging
Demote many things to Trace.
3 years ago
Jason Rhinelander 3c630b260a
Don't install stream forwarding here
Stream forward on the client-side TCP connection gets set up within in
initial_client_data_handler (which also handles reading the initial
stream version byte).
3 years ago
Jason Rhinelander f534103971
Simplify/fix expiry timer logic
Also fix a potential transmission delay because `again()` wasn't being
called when the expiry is already passed (i.e. meaning we should run
immediately).
3 years ago
Jason Rhinelander ac34835c12
Fix/refactor stream closing
Make stream closing with expiring connections work better.  Fixes an
issue where the stream's uv_async could outlive the stream and/or
connection and segfault.
3 years ago
Jason Rhinelander 60c813d306
Schedule retransmit after blocked send
In the standalone plainquic code we triggered a retransmit when the
socket became writeable again, but that doesn't work here, so just
schedule it right away to let ngtcp2 worry about retrying.
3 years ago
Jason Rhinelander 71beae5923
Stop retransmit timer when destroying a connection
Otherwise we segfault because it outlives the Connection.
3 years ago
Jason Rhinelander 027243cbcc
Remove obsolete fixme 3 years ago
Jason Rhinelander db2344505f
Update ngtcp2 3 years ago
Jason Rhinelander 233cb86191
Sever tunnel links earlier
When we get an error on the tcp connection immediately sever the link to
the quic tunnel so that it doesn't keep trying to forward data to it.
3 years ago
Jeff Becker 73572b317b
stuff 3 years ago
Jason Rhinelander 4cea33a139
Fix Server's missing opt-out of ring buffer
For now we still steal buffers from uvw.

In the future I'd like to change that, but it's still uvw
work-in-progress to support custom data allocators, and so for now we
still steal data buffers from uvw.
3 years ago
Jason Rhinelander 99954f7501
Add some more useful debug logging 3 years ago
Jason Rhinelander b8be889291
Add missing client TCP accept/forwarding handlers
Somehow the TCP client connection accept and stream forwarding got
dropped in the quic refactor.
3 years ago
Jason Rhinelander 738f16366b
Try outbound convos if no inbound convos work (FIXME)
FIXME - eliminate this block of code that used to be an `else` before
PR'ing.
3 years ago
Jason Rhinelander 183abd58aa
Add more checks and logging
Most of the logging here is Trace level so needs a Debug build to not
get compiled away.
3 years ago
Jason Rhinelander 44fc941c32
Set port properly in server-to-client reply packets
ngtcp2 was rejecting them because we have the port when constructing,
but then it was 0 on the return packet (which ngtcp2 drops because it's
coming from an unknown/invalid path).
3 years ago
Jason Rhinelander a1a152b5c3
Disable building ngtcp2 example code 3 years ago
Jeff Becker 6bb23aa956
patch 3 years ago
Jeff Becker 3977c12da6
dont try to build untracked file 3 years ago
Jeff Becker 708e408c30
various fixups and cleanups
* wire up last of the quic stuff
* clean up udp packet generation code
* pass EndpointBase not quic tunnel for quic stuff
* add {n,h}uint16_t::FromString
* add nuint_t::FromString
* make AlignedBuffer::IsZero non constant time call for speed
3 years ago
Jeff Becker 211a051444
add quic_tester.py script for hitting rpc endpoints to test quic 3 years ago
Jeff Becker 100a953a23
make the lokinet endpoint code work
still needs the quic sides to work
3 years ago
Jeff Becker 7098f46d60
rpc endpoint for triggering quic tunnel 3 years ago
Jeff Becker 838b968d8f
re add static build for all internal lokinet libs 3 years ago
Jeff Becker c88406fb27
move lokinet-quic into the big giant amalgum of liblokinet 3 years ago
Jeff Becker 4dafe973c2
comment out member 3 years ago
Jeff Becker 883005d7db
variable is unused for now but i dont want to remove it yet 3 years ago
Jeff Becker 2360700911
add virtual default destructor to appease clang 3 years ago
Jeff Becker 8b95f9945a
fix compiler errors 3 years ago
Jeff Becker f5700c560e
try inbound paths first 3 years ago
Jeff Becker 59891d5d5f
wire up snode traffic to quic 3 years ago
Jeff Becker 58bec09232
fix compile error 3 years ago
Jason Rhinelander 752879d712
QUIC lokinet integration refactor
Refactors how quic packets get handled: the actual tunnels now live in
tunnel.hpp's TunnelManager which holds and manages all the quic<->tcp
tunnelling.  service::Endpoint now holds a TunnelManager rather than a
quic::Server.  We only need one quic server, but we need a separate quic
client instance per outgoing quic tunnel, and TunnelManager handles all
that glue now.

Adds QUIC packet handling to get to the right tunnel code.  This
required multiplexing incoming quic packets, as follows:

Adds a very small quic tunnel packet header of 4 bytes:

    [1, SPORT, ECN] for client->server packets, where SPORT is our
    source "port" (really: just a uint16_t unique quic instance
    identifier)

or

    [2, DPORT, ECN] for server->client packets where the DPORT is the SPORT
    from above.

(This also reworks ECN bits to get properly carried over lokinet.)

We don't need a destination/source port for the server-side because
there is only ever one quic server (and we know we're going to it when
the first byte of the header is 1).

Removes the config option for quic exposing ports; a full lokinet will
simply accept anything incoming on quic and tunnel it to the requested
port on the the local endpoint IP (this handler will come in a following
commit).

Replace ConvoTags with full addresses: we need to carry the port, as
well, which the ConvoTag can't give us, so change those to more general
SockAddrs from which we can extract both the ConvoTag *and* the port.

Add a pending connection queue along with new quic-side handlers to call
when a stream becomes available (TunnelManager uses this to wire up
pending incoming conns with quic streams as streams open up).

Completely get rid of tunnel_server/tunnel_client.cpp code; it is now
moved to tunnel.hpp.

Add listen()/forget() methods in TunnelManager for setting up quic
listening sockets (for liblokinet usage).

Add open()/close() methods in TunnelManager for spinning up new quic
clients for outgoing quic connections.
3 years ago
Jason Rhinelander 158ea4a951
Add isIPv4/isIPv6 to SockAddr 3 years ago
Jason Rhinelander 2ca7ef7f5f
Rename isRouter -> isSNode
The isRouter wording was quite confusing, especially in a call such as:

    router->Configure(config, opts.isRouter, nodedb)
3 years ago
Jason Rhinelander 1d6ad7284c
Fix cursed formatting 3 years ago
Jason Rhinelander d588f777c7
Fix logging of std::byte values
They were failing to compile if output because implicit integer
promotion doesn't work for std::byte's (but rather needs an explicit
std::to_integer call).
3 years ago
Jason Rhinelander e27fdf4c9a
Simplify/unify SendTo* methods
Overload them to the same name to make it easier to call and/or visit
them with either a RouterID, Address, Variant, or ConvoTag.
3 years ago
Jason Rhinelander 104f63543f
Change MaybeGetLoop to a virtual member func
Minor simplification.
3 years ago
Jeff Becker a1a1b2e2bc
remove superflous include 3 years ago
Jeff Becker a61f846d33
* add convotags to ensure path to snode
* add service::Endpoint::EnsurePathTo which gives you a std::optional<Convotag>
3 years ago
Jeff Becker fe32475cad
use more variants 3 years ago
Jeff Becker 9d483a12db
* add protocol type to snode traffic
* make path::PathSet::SendPacketToRemote know about protocol type
3 years ago
Jeff Becker e4ca7ce4de
get rid of uneeded type 3 years ago
Jeff Becker 618881e65c
update ngtcp2 address/path structs 3 years ago
Jeff Becker eb965c8323
fix link error in ngtcp2 3 years ago
Jeff Becker fc9b09bdbc
clean up address/ip management code to use std::variant and std::optional 3 years ago
Jeff Becker 1885b1cae9
more 3 years ago
Jeff Becker 4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
3 years ago
Jason Rhinelander 39d31df059
no-op LogTrace(); print chars as ints
- LogTrace() (and LogTraceTag, etc.) are now no-ops for release builds.
(hoping there are no side effects in trace logging!)
- renamed llarp::_Log to llarp::_log because _Log is a reserved keyword
- change logging code to implicitly convert 1-byte types (char, unsigned
char, uint8_t) to ints so that we print them as numeric values rather
than raw chars because, more often than not, printing a single char is
trying to log an 8-bit value.
3 years ago
Jason Rhinelander b61bd82b4b
Add llarp::buffer_printer for pretty buffer logs 3 years ago
Jason Rhinelander 818b4042e9
Migrate plainquic logging to llarp logging 3 years ago
Jason Rhinelander 5d897781ef
Replace custom random with llarp/sodium random 3 years ago
Jason Rhinelander aa0f54fa07
WIP plainquic tunnels 3 years ago
Jason Rhinelander 46c619c49f
Move external/ cmake bits into external/CMakeLists.txt
- Move uvw target to external instead of llarp/CMakeLists.txt

- Add sqlite_orm headers via interface library rather than shoving it
  into the global include search path.

- Find sqlite3 as part of the sqlite_orm target deps rather than linking
  it separately.  (Also don't link it into lokinet-util, which doesn't
  appear to actually need it).
3 years ago
Jason Rhinelander 442fa951fc
Add ngtcp2 submodule 3 years ago
Jason Rhinelander 9df6cd74c7
Add draft liblokinet TCP-over-QUIC design doc 3 years ago
Jeff Becker 8ee80bc13d
don't build liblokinet in android we have liblokinet-android for that 3 years ago
Jeff Becker 079604c6cf
get rid of deprecated vpnio code in android 3 years ago
Jeff Becker b45a268dbc
fix windows dll link-ism 3 years ago
Jeff Becker 2fa7a54e86
fix pybind layer compile errors from missing llarp.h header 3 years ago
Jeff Becker e4841917ba
redo cmake parts
* add liblokinet.so target
* make every library we build except liblokinet.so static
* wire up parts of liblokinet
3 years ago
Jeff Becker affd2e23f7
flesh out lokinet.h more 3 years ago
Jeff Becker 414c2d42e6
add lokinet.h header for liblokinet api 3 years ago
Jeff Becker e11249d158
remove llarp.h header references 3 years ago
Jeff Becker 9e2cfd90cb
remove unneeded header 3 years ago
Jeff Becker a6715a1f75
remove old vpnio bits 3 years ago
Jeff Becker c92894804c
Merge remote-tracking branch 'origin/stable' into dev 3 years ago
Jeff Becker 68826f10bb use binary mode for writing files 3 years ago
Jeff 9f2f9e0f05
Merge pull request #1598 from majestrate/cherry-pick-for-stable-2021-04-15
new logos and new lokinet-bootstrap backport for stable
3 years ago
Jeff Becker 4daebc0141
catch exception and print out error 3 years ago
Jeff Becker a0d3ab125a
throw on failed writing and port fs namespace changes from oxen-core 3 years ago
Jeff Becker 6cde9062b5
build lokinet-android target only on android 3 years ago
Jeff Becker a80d8b95b3
update lokinet-bootstrap
* compat with old shell script curl wrapper's arguments
* do lazy validation of fetched data
3 years ago
Jeff Becker 77de60af91
require openssl explicitly for lokinet-bootstrap 3 years ago
Jeff Becker 27c80a2638
add include directory for daemon directory so llarp/* includes work 3 years ago
Jeff Becker e8178a032e
lokinet-bootstrap native binary 3 years ago
Jeff Becker 3af465bb5f
rebrand and bump version 3 years ago
Jeff 6e05f7ad13
Merge pull request #1597 from majestrate/lokinet-bootstrap-native-2021-04-15
Lokinet bootstrap native binary
3 years ago
Jeff Becker 0c37cc7f60
lokinet-bootstrap native binary 3 years ago
Jeff ac7cf68dbe
Merge pull request #1596 from majestrate/rebrand-2021-04-14
rebranding assets
3 years ago
Jeff 189a746dfa
Merge pull request #1594 from majestrate/plug-leak-2021-04-12
call delivery status hook on overload
3 years ago
Jeff Becker 9e05e245e0
rebrand and bump version 3 years ago
Jeff Becker 7a1ffc2df4
* lessen replay filter window
* dont have transit hops use a replay filter
* formatting
3 years ago
Jeff Becker 9c742b36eb
call delivery status hook on overload 3 years ago
Jeff 6bd53484da
Merge pull request #1541 from majestrate/lns-consensus-2021-02-19
lns lookup consensus
3 years ago
Jeff cb2254ba46
Merge pull request #1573 from jagerman/more-code-refactors
More code refactors
3 years ago
Jeff 68aac7964a
Merge pull request #1583 from majestrate/linux-vpn-ipv6-soft-fail-2021-03-20
allow failure of setting ipv6 address
3 years ago
Jeff Becker dfa84081c9
forgot a type 3 years ago
Jeff Becker 202c9348fa
use std::variant 3 years ago
Jeff Becker b7f72601ce
move stuff to var::variant 3 years ago
Jeff Becker ba9dca6c5d
use var::variant and var::visit shims because apple is sux 3 years ago
Jeff Becker f10269b03e
remove std::visit because apple is functionally retarded and does not support it despite claiming to support c++14 3 years ago
Jeff Becker c07358f084
allow failure of setting ipv6 address when it is not allowed by kernel on linux 3 years ago
Jeff Becker aa0546563a lokimq -> oxenmq artifact
* fix dep to lokimq in macos installer gui target when doing make package, change it to oxenmq
3 years ago
Jeff Becker 6c1d18412c
seperate logic into IsDone() 3 years ago
Jeff Becker 88ddcceca4
make lookup name async return optional variant 3 years ago
Jeff Becker 4e14567d67
make Endpoint::LookupNameAsync return void 3 years ago
Jeff Becker 8e57572b37
dont reference iterator in lambda. 3 years ago
Jeff Becker 95eba18e40
cache result on success 3 years ago
Jeff Becker 7a11f3b1e3
redunant lookups for lns.
* request lns from all endpoints we have on our pathset
* make sure all snodes agree on the lns name being looked up
3 years ago
Jeff ec242447a0
Merge pull request #1581 from majestrate/ipv6-configurable-range-2021-03-18
make ipv6 range used by exit traffic configurable.
3 years ago
Jeff a9d2349a12
Merge pull request #1582 from majestrate/issue-1562-2021-03-18
fix issue #1562
3 years ago
Jeff Becker cf85ea6f2b
add warning and note in documenation of config option 3 years ago
Jeff 2860fb91b3
Merge pull request #1579 from majestrate/lokimq-oxenmq-macos-package-2021-03-17
lokimq -> oxenmq artifact
3 years ago
Jeff Becker 1acea95ced
fix issue #1562
* use csrng for std::shuffle
3 years ago
Jeff Becker b2687a53ee
dont use .value() because macos is absolutely broken, thanks apple. 3 years ago
Jeff Becker a83428297e
make ipv6 range used by exit traffic configurable.
* add ip6-range option to network section to control which range we want to use for ipv6 traffic
* make ip6-range able to disable ipv6 exits ( i dont like this but eh )
3 years ago
Jeff Becker 143c66b332
lokimq -> oxenmq artifact
* fix dep to lokimq in macos installer gui target when doing make package, change it to oxenmq
3 years ago
Jeff 8a89608516
Merge pull request #1578 from majestrate/lokimq-artifacts-2021-03-15
remove references to lokimq namespace
3 years ago
Jeff Becker 54c56a6d28
remove references to lokimq namespace
these were not found during the first passes and now that lokimq is gone from my machine this failed to compile
3 years ago
Jeff Becker ad6dcd683b
fix segfault 3 years ago
Jeff Becker 80a76c9386
fix segfault 3 years ago
Jason Rhinelander 181953b4a6 Replace ::Hash nested structs with std::hash specializations 3 years ago
Jason Rhinelander d1dadb530c SockAddr endian cleanups & add uint128 ctors
- Make SockAddr endian arguments explicit
- Consolidate port-less contructors and port constructors into one with
  a default port of 0.
- Add {h,n}uint128_t ctors for construction from IPv6 addrs
3 years ago
Jason Rhinelander fe0d099e86 Code cleanups
- De-lambda a lambda that is only called once, immediately after it is
  defined.
- C++17 modernize key-value for loops
- Remove unused (and useless) method
3 years ago
Jason Rhinelander 0339bd941a Convert protocol type to enum class 3 years ago
Jeff 9bf002cc8d
Merge pull request #1574 from tewinget/header_fixup
standardize include format and pragma once
3 years ago
Jason Rhinelander 59a363b0a2
Merge pull request #1575 from tewinget/format_sh_fix
let format.sh try system clang-format in case it is the correct version
3 years ago
Jeff 0ddea9b103
Merge pull request #1571 from oxen-io/dev
merge dev to stable for 0.8.4
3 years ago
Jason Rhinelander f47e0cf7a2 Fix UB -- use after move 3 years ago
Thomas Winget 43bd6a9842 remove vestigal file
a file that was accidentally committed after being moved was
suddenly being chosen as an include target over the correct
one due to an amusing coincidence of cmake configuration.  that
file is now gone.
3 years ago
Thomas Winget 09ebe77860 let format.sh try system clang-format in case it is the correct version 3 years ago
Thomas Winget 7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
3 years ago
Thomas Winget 35fb54d131 add project source dir to util include directories 3 years ago
Jeff Becker a8885c5405
update gui hashpin for windows 3 years ago
Jason Rhinelander e0bb7b7d0f Bump oxen-mq submodule to tagged 1.2.4 3 years ago
Jeff 1de2bb7ecf
Merge pull request #1572 from majestrate/tag-v0.8.4-2021-03-09
bump version for 0.8.4
3 years ago
Jeff Becker 084e0aa023
bump version for 0.8.4 3 years ago
Jason Rhinelander 39e2647b1c
Merge pull request #1570 from majestrate/unbreak-android-2021-03-07
Unbreak android
3 years ago
Jeff Becker 324498fe9a
flip order of parameters so it works 3 years ago
Jeff Becker 3d09b94590
make android work again
ip packet on read error was returning an uninitialized ip packet with non zero size so it was thinking it was a valid packet.
value initialize it to set the packet size to zero by default.

this fixed it in an emulator at least...
3 years ago
Jeff Becker 6550aa844c
try to unbreak more 3 years ago
Jeff Becker 7af4807302 correctly set size of OwnedBuffer when using OwnedBuffer::copy_used 3 years ago
Jeff 6daf5c6ea6
Merge pull request #1568 from jagerman/clang-format-11
Clang format 11
3 years ago
Jason Rhinelander 91d6698a9d Reformat with clang-format-11 3 years ago
Jason Rhinelander e5aa96ed7c Upgrade to clang-format 11
The formatting changes here are not too large and also nice: in
particular clang-format-11 appears to do better handling of `{...}`
constructor braces/arguments.
3 years ago
Jeff 76ee6734db
Merge pull request #1557 from jagerman/uvw-overhaul
libuv -> uvw overhaul
3 years ago
Jeff 57a5f8cb15
Merge pull request #1567 from jagerman/loki-core-docker-deps
Add oxen-core deps to docker images
3 years ago
Jeff Becker 27685b1b6e
fix docker lines and dont install recommended packages 3 years ago
Jason Rhinelander 78a43e7163 Add oxen-core deps to docker images 3 years ago
Jason Rhinelander c00de1e4ec Add wakeup call into transit_hop UpstreamHandler 3 years ago
Jason Rhinelander 89b582bf60 Modernize [[maybe_unused]] attribute 3 years ago
Jason Rhinelander 4b5387a078 Remove unused ShouldFlushNow method 3 years ago
Jason Rhinelander f9dc308f75 Tick event loop on data queuing 3 years ago
Jason Rhinelander 895acc45ff EventLoop: add public wakeup() method, and call it from call()
call(), when invoked from the logic thread, wasn't triggering a wakeup
which stalled some traffic (such as client-to-snode packets).

Fix it by triggering a wakeup on `call()`, and expose it because this is
a useful thing to be able to do.
3 years ago
Jason Rhinelander f8d5e106a0 Uncurse SockAddr's sockaddr* operator
The `const sockaddr*` conversion was returning a pointer to the
sockaddr_in6, but with its family set to AF_INET, so the receiving code
would have treated interpreting the result as a sockaddr_in pointer --
but it isn't, and trying to get the IPv4 from the mis-reinterpreted
sockaddr_in6 fails; this then prevented uvw UDP binding (which uses the
sockaddr* operator) from working.

This changes it to always leave the family value at the proper value and
using the ipv6_is_mapped_ipv4 check to determine when we have (and
should return) a pointer to the sockaddr_in rather than the
sockaddr_in6.

Also fixes toString() to compare the full prefix instead of just bytes
10 and 11.
3 years ago
Jason Rhinelander 62fc1bbc48 Make llarp_buffer_t constructible from an rvalue reference 3 years ago
Jason Rhinelander f8486604c4 Export UDP file descriptor (for android) 3 years ago
Jason Rhinelander d995766436 Android & hive fixes 3 years ago
Jason Rhinelander 673d065ed8 Remove HasNextPacket() (and fix win32)
We don't use it anymore (instead we just ReadNextPacket until it returns
an empty result).
3 years ago
Jason Rhinelander 6e05dc693f Remove unused arguments (and ants) 3 years ago
Jason Rhinelander 2c827870c9 Simplify code of many f's
We don't need to go through the contention killer here, that was mainly
for (long ago) debugging reasons.
3 years ago
Jason Rhinelander 36edabd9b0 Rename EventLoop::udp to EventLoop::make_udp
Makes it consistent with the make_waker, etc.

Also removes some debugging.
3 years ago
Jason Rhinelander afd856bca0 Remove unused junk (also fix win32 compilation fail) 3 years ago
Jason Rhinelander ced035d401 Switch uvw to a fork with libuv backwards compat support 3 years ago
Jason Rhinelander 096f37fe4e Fix linux compilation & narrowing conversion warning 3 years ago
Jason Rhinelander e198bfd3e1 Remove unused variable 3 years ago
Jason Rhinelander c4559d158e Make format 3 years ago
Jason Rhinelander ccc7b5c9e9 Merge Logic functions into EventLoop
loop->call(...) is similar to the old logic->Call(...), but is smart
about the current thread: if called from within the event loop it simply
runs the argument directly, otherwise it queues it.

Similarly most of the other event loop calls are also now thread-aware:
for example, `call_later(...)` can queue the job directly when called if
in the event loop rather than having to double-queue through the even
loop (once to call, then inside the call to initiate the time).
3 years ago
Jason Rhinelander 5b555ee5aa Replace libuv with uvw & related refactoring
- removes all the llarp_ev_* functions, replacing with methods/classes/functions in the llarp
  namespace.
- banish ev/ev.h to the void
- Passes various things by const lvalue ref, especially shared_ptr's that don't need to be copied
  (to avoid an atomic refcount increment/decrement).
- Add a llarp::UDPHandle abstract class for UDP handling
- Removes the UDP tick handler; code that needs tick can just do a separate handler on the event
  loop outside the UDP socket.
- Adds an "OwnedBuffer" which owns its own memory but is implicitly convertible to a llarp_buffer_t.
  This is mostly needed to take over ownership of buffers from uvw without copying them as,
  currently, uvw does its own allocation (pending some open upstream issues/PRs).
- Logic:
  - add `make_caller`/`call_forever`/`call_every` utility functions to abstract Call wrapping and
    dependent timed tasks.
  - Add inLogicThread() so that code can tell its inside the logic thread (typically for
    debugging assertions).
  - get rid of janky integer returns and dealing with cancellations on call_later: the other methods
    added here and the event loop code remove the need for them.
- Event loop:
  - redo everything with uvw instead of libuv
  - rename EventLoopWakeup::Wakeup to EventLoopWakeup::Trigger to better reflect what it does.
  - add EventLoopRepeater for repeated events, and replace the code that reschedules itself every
    time it is called with a repeater.
  - Split up `EventLoop::run()` into a non-virtual base method and abstract `run_loop()` methods;
    the base method does a couple extra setup/teardown things that don't need to be in the derived class.
  - udp_listen is replaced with ev->udp(...) which returns a new UDPHandle object rather that
    needing gross C-style-but-not-actually-C-compatible structs.
  - Remove unused register_poll_fd_(un)readable
  - Use shared_ptr for EventLoopWakeup rather than returning a raw pointer; uvw lets us not have to
    worry about having the event loop class maintain ownership of it.
  - Add factory EventLoop::create() function to create a default (uvw-based) event loop (previously
    this was one of the llarp_ev_blahblah unnamespaced functions).
  - ev_libuv: this is mostly rewritten; all of the glue code/structs, in particular, are gone as
    they are no longer needed with uvw.
- DNS:
  - Rename DnsHandler to DnsInterceptor to better describe what it does (this is the code that
    intercepts all DNS to the tun IP range for Android).
- endpoint:
  - remove unused "isolated network" code
  - remove distinct (but actually always the same) variables for router/endpoint logic objects
- llarp_buffer_t
  - make constructors type-safe against being called with points to non-size-1 values
- tun packet reading:
  - read all available packets off the device/file descriptor; previously we were reading one packet
    at a time then returning to the event loop to poll again.
  - ReadNextPacket() now returns a 0-size packet if the read would block (so that we can implement
    the previous point).
  - ReadNextPacket() now throws on I/O error
- Miscellaneous code cleanups/simplifications
3 years ago
Jason Rhinelander c71d3527bd C++17 simplification 3 years ago
Jason Rhinelander 8aa1b702cd Disallow evil compilation
-fpermissive allows nasty things that are (apparently) needed on
Windows, so only enable it there.

vla are evil, so don't just warn but error on it.

remove duplicate -Wno-unknown-pragmas
3 years ago
Jason Rhinelander ffe9bbc984 Tweak clang-tidy rules
Turn off modernize-use-trailing-return because it's *really* annoying
(and clangd picks it up when using it for editing).

Turn off modernize-use-nodiscard as well because it's already annoying.

Add bugprone-* as well because it includes a lot of useful checks.
3 years ago
Jason Rhinelander dfb62d06ce Shut up noisy catch tests 3 years ago
Jason Rhinelander 8b00eacabf Fix signed/unsigned char comparison bug
These functions would not working properly if given a high bit char
value.
3 years ago
Jason Rhinelander 00df8b85da Bump required oxenmq version
Current lokinet dev relies on something from oxenmq dev branch which is
in the not-yet-released next version; without this lokinet tries using
the system 1.2.3 install, which then fails the build.
3 years ago
Jason Rhinelander e3aff6c36c Add more junk & clangd symlinks to .gitignore
Ignore any root directory starting with build so that you can have many
build directories (build, build2, build-win32, ...) that get ignored.

Add .cache which clangd creates

Ignore compile_commands.json (and generate it by default) which helps
clangd, but needs to be symlinked to a compile_commands.json in a build
dir so isn't suitable for inclusion in the repo.
3 years ago
Jeff db515e48ec
Merge pull request #1561 from majestrate/catch2_migrate-2021-03-03
totally remove gtest/gmock from unit tests.
3 years ago
Jeff abf057d6e3
Merge pull request #1536 from majestrate/memleak-fix-2021-02-15
plug super slow memory leak
3 years ago
Jeff 72c9b0f1b4
Merge pull request #1535 from majestrate/no-iwp-multiack-2021-02-13
only do single ack packets
3 years ago
Jeff Becker 4cf0f1ee35
decaying hashset unit test fixes 3 years ago
Jeff Becker 5fd15fa044
generate keys in unit test 3 years ago
Jeff Becker 6c8e5256d6
catchAll -> testAll 3 years ago
Jeff Becker 60bfdacc23
get rid of the rest of gtest/gmock 3 years ago
lyyn ece91e87fc
Migrate tests from gtest to catch2 3 years ago
Jeff Becker ec0f45eeb7
plug memory leak in outbound message queue.
sometimes we use rxid in our pathid so we need to clear those queues too.
if we don't it'll leak from never clearing those queues.
3 years ago
Jeff Becker 7dbd25f271
don't leave old multi ack codepath in 3 years ago
Jeff Becker 8a4417cb1a
reduce test message count so it can pass 3 years ago
Jeff Becker c9ff917e0d
revert priority queue ordering change 3 years ago
Jeff Becker ad3c23ba2b
simplify call 3 years ago
Jeff Becker 5cffc3b0f8
consolidate rx message handling in iwp
* add toggle flag for using multi ack
* check replay filter before processing message
3 years ago
Jeff Becker e6ac7e721d
use a std::map instead of a std::unordered_map for holding message buffers by their sequentially increasing message id.
when retransmissions happen, they will be executed in a deterministic order by their delivery id.
this reduces the jitter from delayed message delivery on link layer as with an unordered map the order of iteration is "random",
so when we iterate all messages for retransmission we do it lowest id first (the messages queued first).
3 years ago
Jeff Becker 74f707ee01
only do single ack packets 3 years ago
Jeff 4992629f20
Merge pull request #1563 from majestrate/dont-multiplex-from-outbound-context-2021-03-03
use lowest latency path for send context
3 years ago
Jeff d5baeaa425
Merge pull request #1564 from majestrate/exit-backwards-comapt-issue-2021-03-03
unbreak ipv4 exits
3 years ago
Jeff e379200ba6
Merge pull request #1566 from majestrate/redo-cmake-setcap-check-2021-03-04
redo cmake setcap check
3 years ago
Jeff Becker b9d439558f
dont include lokinet-bootstrap.ps1 in ci builds 3 years ago
Jeff Becker 4540c964f5
rework cmake install targets
* redo setcap on linux so that it's required to do install targets on linux
* add -DWITH_SETCAP=OFF option to bypass setcap requirement on linux
* remove lokinet-bootstrap.ps1 as we bundle the bootstrap in the win32 installer now
* remove references to lokinet-bootstrap.ps1 in cmake
3 years ago
Jeff 32ed709839
Merge pull request #1565 from majestrate/ci-fixup-2021-03-04
explicitly turn off setcap on ci builds so they pass
3 years ago
Jeff Becker 7060a60c84
enable route poker poking before going "up" 3 years ago
Jeff Becker 849c8b6aa8
explicitly turn off setcap on ci builds so they pass 3 years ago
Jeff Becker f77cbfb48e
fixes for ipv4 traffic: dont use new range because that breaks backwards comapt 3 years ago
Jeff Becker f67668f0a6
use lowest latency path for send context 3 years ago
Jeff f2b234d6c3
Merge pull request #1539 from majestrate/path-algorithm-flavors-2021-02-18
add option to enforce unique netblocks per path.
3 years ago
Jeff b4b8b84e57
Merge pull request #1548 from majestrate/lns-mx-records-2021-02-25
add mx records to lns names
3 years ago
Jeff Becker d6567614e3
use mutable lambda instead of shared_ptr for handling mx dns reply for lns 3 years ago
Jeff d0e4069762
Merge pull request #1554 from majestrate/cmake-check-for-setcap-2021-03-01
add explicit check for setcap
3 years ago
Thomas Winget 49037e8be9
Merge pull request #1560 from jagerman/gradle-cache
Allow multiple gradles to run on the same box
3 years ago
Jason Rhinelander 6c176330a4 Allow multiple gradles to run on the same box
/cache is shared among multiple runners that can potentiall run at
once, but gradle's cache is retarded and just completely blocks anything
from using the cache for the span of the entire build.  Work around it
by sticking the unique builder identifier in the cache path.
3 years ago
Jason Rhinelander c2689ee7e6
Merge pull request #1558 from majestrate/disallow-ci-fail-android-2021-03-02
disallow fail on ci pipeline for android builds
3 years ago
Jeff Becker b8d7d0327f
disallow fail on ci pipeline for android builds 3 years ago
Jeff f685d615bf
Merge pull request #1537 from majestrate/android-works-now-2021-02-11
Android
3 years ago
Jeff 7c02b6ea08
Merge pull request #1550 from majestrate/docker-ci-jizz-2021-02-25
speed up ci pipeline
3 years ago
Thomas Winget 4c630e0437 Large collection of changes to make android work
- Previous android java and jni code updated to work, but with much love
  still needed to make it work nicely, e.g. handling when the VPN is
  turned off.

- DNS handling refactored to allow android to intercept and handle DNS
  requests as we can't set the system DNS to use a high port
  (and apparently Chrome ignores system DNS settings anyway)

- add packet router structure to allow separate handling of specific
  intercepted traffic, e.g. UDP traffic to port 53 gets handled by our
  DNS handler rather than being naively forwarded as exit traffic.

- For now, android lokinet is exit-only and hard-coded to use exit.loki
  as its exit.  The exit will be configurable before release, but
  allowing to not use exit-only mode is more of a challenge.

- some old gitignore remnants which were matching to things we don't
  want them to (and are no longer relevant) removed

- some minor changes to CI configuration
3 years ago
Jeff Becker d4112b157c
add explicit check for setcap binary when doing setcap so when it's missing it's not a nop / silent failure 3 years ago
Jeff Becker 2655a64da0
redo ci pipeline:
* make cached docker containers for ci
* remove old docker files from root of repo
* use cached docker containers for ci
3 years ago
Jeff Becker b59a92aa01
add mx records to lns names 3 years ago
Jeff Becker ed97d29c97
fix up pyllarp parts
* expose paths config in pyllarp
* fix up pyllarp unit tests
3 years ago
Jeff Becker 0fa91381ba
add llarp::CSRNG for cryptographically secure random number generator for use in std::shuffle 3 years ago
Jeff Becker a88aec5f01
fix typo 3 years ago
Jeff Becker a3585caa70
add value 0 to disable unique-range-size 3 years ago
Jeff Becker f7424b8bbe
dont use std::optional 3 years ago
Jeff Becker 4478cf6f72
use pointers to entries instead of lookups by key 3 years ago
Jeff Becker b865ffb736
use 64-bit Mersenne Twister instead of 32 bit flavor in nodedb 3 years ago
Jeff Becker e584cbe44d
make non 64 bit platforms happy 3 years ago
Jeff Becker 3425069b41
feedback from jason
* use emplace in PeerSectionConfig::Acceptable use insert everywhere else
* use const l-value references
* fix typos and spelling mistakes
3 years ago
Jeff Becker 5d465264a8
truly random access in nodedb iteration 3 years ago
Jeff Becker 9457da27d9
add option to enforce unique netblocks per path. 3 years ago
Jeff f2f0486f13
Merge pull request #1555 from majestrate/lokimq-oxenmq-rename-2021-03-01
loki-mq -> oxen-mq
3 years ago
Jeff Becker 979a652446
loki-mq -> oxen-mq 3 years ago
Jeff 4565f31990
Merge pull request #1549 from jagerman/no-siit-tests
Fix SockAddr test code
3 years ago
Jason Rhinelander e2f96631a6 Fix SockAddr test code
Exception error messages changed and broke tests

Also adds two test cases for the separate string/port constructor.
3 years ago
Jeff 541912326b
Merge pull request #1545 from jagerman/no-siit
SockAddr fixes and cleanups
3 years ago
Jason Rhinelander 56cbef6086 SockAddr fixes and cleanups
- Remove SIIT from method names & comments because we're doing IPv4
mapped addresses (::ffff:0:0/96) rather than actual SIIT
(::ffff:0:0:0/96).

- add constructor taking a string+numeric port (and then don't allow a
port in the string).

- simplify IP string parsing by using parse_int()

- replace addrIsV4 with call to ipv6_is_mapped_ipv4 (this also fixes a
bug where addrIsV4 was not checking for leading 0s and so could return
true for a public IPv6 that happened to have ffff in the wrong spot).
3 years ago
Jeff 291aa2e56d
Merge pull request #1526 from majestrate/interactive-auth-2021-01-01
feedback auth result via lmq rpc
3 years ago
Jeff Becker dcdd147e74
use static_cast with enum class 3 years ago
Jeff Becker 5fe7e00765
make AuthResultCode an enum class 3 years ago
Jeff Becker 94b8743b1c
fix typo 3 years ago
Jeff Becker 5b2abce86f
add string reason to auth messages 3 years ago
Jeff Becker 2cb889013b
revise lambda captures 3 years ago
Jeff Becker 85867bd7be
make service restart 3 years ago
Jeff Becker 6d5f1b0c6a
feedback auth result via lmq rpc 3 years ago
Jeff c76f2fe8de
Merge pull request #1496 from majestrate/rpc-kill-endpoint-sessions-2020-11-28
add llarp.endpoint rpc command
3 years ago
Jeff 59aa0768c8
Merge pull request #1544 from majestrate/only-set-public-address-when-provided-2021-02-23
only set public address when provided
3 years ago
Jeff Becker 785b4258ed
only set public address when provided 3 years ago
Jeff 4fc1f8e4bf
Merge pull request #1543 from majestrate/try-remove-cpu-bottleneck-2021-02-22
remove packet rate based cpu bottleneck
3 years ago
Jeff Becker d7842d18ee
add missing header 3 years ago
Jeff Becker cb3b89457f
remove pointless operator overload 3 years ago
Jeff Becker be3faeb402
feedback from tom.
* remove unneeded header.
* fix typo in docs
3 years ago
Jeff Becker 1c3020a05e
drop on overload 3 years ago
Jeff Becker bb9bd25059
get rid of use of llarp::IpAddress from hotpaths 3 years ago
Jeff Becker 01262d1c4d
flush queue when full 3 years ago
Jeff Becker 42ffbcca0a
try coleasing inbound packets from iwp 3 years ago
Jeff 0c869600df
Merge pull request #1532 from majestrate/network-thaw-2021-02-08
thaw network when default gateway changes
3 years ago
Jeff Becker dc68ff6de9
prevent bad side effects, dont use iterator after use and use operator[] 3 years ago
Jeff Becker b2b68c413c
actually set disabled when disabiling route poker 3 years ago
Jeff Becker 6a29cc7380
call closed hook when we explicitly close a link session 3 years ago
Jeff Becker 6a2d35d907
always use most recent convotag 3 years ago
Jeff Becker b484d9bebb
update route poker logic to include "up" 3 years ago
Jeff Becker e46204b068
dont wire up router thaw to sigusr1 3 years ago
Jeff Becker 07b599430e
thaw router when connectivity changes 3 years ago
Jeff Becker 676ca7f511
close stale sessions on thaw because they are probably already gone. this removes them and forces the sessions to be renegotiated. 3 years ago
Jeff Becker ffef3bc48f
wire up sigusr1 to reset libunbound dns resolver 3 years ago
Jeff 6825e9177d
Merge pull request #1538 from majestrate/ip6nat-exit-2021-02-16
ip6 nat exits
3 years ago
Jeff Becker 8239efa71b
clarify new member's purpose and name. add comment. 3 years ago
Jeff Becker 1526941f3a
make it compile again 3 years ago
Jeff Becker 0600f42814
fix up names of functions to be less hidious. 3 years ago
Jeff Becker 1ee545d6d2
fix up macos route command for ipv6 3 years ago
Jeff Becker 35137913b9
windows and macos route pokers for ipv6 3 years ago
Jeff Becker 1c7079dbab
fix up route poking with lokinet to work with ipv6 3 years ago
Jeff Becker 063e982ef6
fix exit range default value 3 years ago
Jeff Becker bd93a8f828
initial v6 exits 3 years ago
Jeff fe29df696c
Merge pull request #1522 from majestrate/update-readme-2021-01-25
redo readme structure
3 years ago
Jeff Becker 935f210900
update readme links 3 years ago
Jeff Becker 2d4ff6c9dd
update badge url 3 years ago
Jeff Becker 6d00c3ecd2
update windows parts
* document need for ninja-build package
* update contrib/windows.sh, remove -DCROSS_COMPILE option, set -e and set +x
3 years ago
Jeff Becker fdc3de6f9c
redo readme structure:
* add notes about debian packages (fixes #1521)
* reorder sections to have better flow
* add notes about win/mac release location
3 years ago
Jeff 5c1f66b8c0
Merge pull request #1531 from komachi/update-apparmor
Update AppArmor profile
3 years ago
Anton Nesterov da2c979936 update apparmor profile:
add nameservice abstraction
give profile a name
allow to read conf, tmp files, etc.
remove /lib/@{multiarch}/ld-*.so mr, already covered by abstractions/base
allow local additions
3 years ago
Jeff c5a423d3f8
Merge pull request #1529 from majestrate/nodedb-refactor-2021-02-02
NodeDB refactor
3 years ago
Jeff Becker 1f1db29816
GetIf -> GetRandom 3 years ago
Jeff Becker f24cdb305b
clean up calls to NodeDB::GetIf to be cleaner and more concise 3 years ago
Jeff Becker c8aba0af31
make llarp::NodeDB::GetIf always randmize location 3 years ago
Jeff Becker d55705362a
use good routers 3 years ago
Jeff Becker b6dbbb4bef
consolidate pathbuilder logic
* deduplicate code for path hops selection
3 years ago
Jeff Becker 242e56507c
proper lokimq -> oxenmq refactor 3 years ago
Jeff Becker 1e58715e0b
fix pybind layer 3 years ago
Jeff Becker d112a50096
minidump fix 3 years ago
Jeff Becker 922f4fb724
fix iteration bug 3 years ago
Jeff Becker df4ea34a56
nodedb refactor
* bump zmq static dep
* lokimq -> oxenmq
* llarp_nodedb -> llarp::NodeDB
* remove all crufty api parts of NodeDB
* make NodeDB rc selection api not suck
* make path builder api not suck
* propagate all above changes so that unit tests work and it all compiles
3 years ago
Jeff Becker 811b2a3fbf
bump submodule 3 years ago
Jeff 5e2ba55c41
Merge pull request #1527 from jahway603/dev
fixed broken documentation link
3 years ago
jahway603 6eab03567a fixed broken documentation link 3 years ago
Jeff 899e0878eb
Merge pull request #1514 from jagerman/downgrade-required-libuv-version
Downgrade required libuv version to 1.18
3 years ago
Jason Rhinelander 3d0c9a90a8 Link against libdl for libuv 3 years ago
Jason Rhinelander 231674e5a5 Remove CMAKE_CROSSCOMPILE
We set CMAKE_CROSSCOMPILE in a few places, but that is just a typo for
CMAKE_CROSSCOMPILING.  However we don't need to set it at all: cmake
does so automatically whenever CMAKE_SYSTEM_NAME is set (which is why
our cross compiling actually works currently.)
3 years ago
Jason Rhinelander 60a267a136 Add automake+libtool for libuv static build 3 years ago
Jason Rhinelander ab4013f00d Downgrade required libuv version to 1.18
(1.18 is the version found in bionic).
3 years ago
Jason Rhinelander b3d2177e73
Fix build server name & path (#1516)
builds.lokinet.dev -> oxen.rocks
/loki-project/ -> /oxen-io/
3 years ago
Jeff 5f0f4e0c70
prevent crash by removing duplicate logic (#1515)
when a path expires or fails or something causes its lifecycle to end we have cleanup
logic that handles clean up for it. this removes a code path that was crashing that
is duplicated elsewhere and is thus probably safe to bin. yolo.
3 years ago
Jeff 0ed8942dc6
libuv cmake fixups (#1511)
* fix up cmake parts for libuv
* make libuv use external project via StaticBuild.cmake
* remove libuv submodule
3 years ago
Yevhen Stasiv 70ceeb10a6
Update readme.md (#1512)
Added missing instruction for FreeBSD install
3 years ago
Jason Rhinelander d6231521d5
Merge pull request #1509 from majestrate/unbreak-build-2021-01-12
unbreak the build
3 years ago
Jeff Becker f8c0195cfc
add ulimit -n 1024 to mac ci stuff because lol apple 3 years ago
Jeff Becker 82b3ec19e8
unbreak the build
* remove llarp/ev/pipe.cpp from cmake
* fix typo in llarp/ev/ev_libuv.cpp
3 years ago
Jeff 49b9ad7197
tun code refactor (#1495)
* partial tun code refactor

* take out the trash

* move vpn platform code into llarp/vpn/platform.cpp

* fix hive build

* fix win32

* fix memory leak on win32

* reduce cpu use

* make macos compile

* win32 patches:

* use wepoll for zmq
* use all cores on windows iocp read loop

* fix zmq patch for windows

* clean up cmake for win32

* add uninstall before reinstall option to win32 installer

* more ipv6 stuff

* make it compile

* fix up route poker

* remove an unneeded code block in macos wtf

* always use call to system

* fix route poker behavior on macos

* disable ipv6 on windows for now

* cpu perf improvement:

* colease calls to Router::PumpLL to 1 per event loop wakeup

* set up THEN add addresses

* emulate proactor event loop on win32

* remove excessively verbose error message

* fix issue #1499

* exclude uv_poll from win32 so that it can start up

* update logtag to include directory

* create minidump on windows if there was a crash

* make windows happy

* use dmp suffix on minidump files

* typo fix

* address feedback from jason
* use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
* quote $@ in apply-patches in case path has spaces in it

* address feedback from tom

* remove llarp/ev/pipe
* add comments for clairification
* make event loop queue size constant named
3 years ago
Dimitris Apostolou 029b6db364
Fix macOS instructions (#1506) 3 years ago
Jason Rhinelander 7ad1030736
Add full-static-deps armhf build (+upload) (#1505)
* Add armhf static build + upload

* openssl build fix for static armhf build

Without this it tries building for arm64.

* Disable LTO for armhf static build

* Fix static lib check for arm
4 years ago
Jason Rhinelander 634ecfcea0 Merge remote-tracking branch 'origin/dev' into stable 4 years ago
Jason Rhinelander f9be8b6b73
Bump version & gui build (#1501) 4 years ago
Jeff Becker 7ee9d0281c
add llarp.endpoint rpc command with kill option to kill all active convotags given
a list of or a single remote service address.
4 years ago
Jeff Becker f97b167fa3
Merge remote-tracking branch 'origin/dev' into stable 4 years ago
Jeff Becker 1cb4203eff
Merge branch 'stable' into dev 4 years ago
Jeff 1eb5c6deed
resolve merge conflicts for 0.8.2 (#1493)
* Update gui win32 package url (#1466)

* Dev to stable (#1471)

* Install less stuff on windows CI

mingw-w64 is a metapackage that pulls in 4 different compilers
{i686,x86_64}×{-posix,-win32} but we only need x86_64-posix, so just
install that package.

* Update gui win32 package url (#1466) (#1468)

Co-authored-by: Jeff <jeff@i2p.rocks>

* stop lokinet before uninstalling service (#1469)

* stop lokinet before uninstalling service

* kill gui in uninstaller

* add helper script for building windows installers because i forgot how to most of the time.

* Update win32 gui download with smaller svg icon

Co-authored-by: Jeff <jeff@i2p.rocks>

Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
4 years ago
Jeff Becker 0d79117674
Merge branch 'dev' into stable 4 years ago
Jeff Becker c24f6a6d2b
Merge branch 'stable' into dev 4 years ago
Jeff 6407733c8e
* make llarp.halt rpc call actually return a reply (#1488)
* add --kill flag to lokinet-vpn that calls llarp.halt
* make macos uninstaller kill lokinet via lokinet-vpn --kill
4 years ago
Jason Rhinelander f1b074bb95
Merge pull request #1487 from jagerman/revert-uninstaller-subdir
Revert "Build mac uninstaller as subproject instead of externalprojec…
4 years ago
Jeff b18546086a
make macos uninstaller actually kill and uninstall lokinet (#1484)
* macos fluff

* make uninstaller work, the uninstall script needs to be called with /usr/bin/sudo to work because god know why it needs that even though it's already root.
* add logrotation
* make the uninstall script kill all the things

* revert

* use correct regular expression

* remove logrotate configs rename logrotate config file name to be more descriptive
4 years ago
Jason Rhinelander bc62e9dd2d Revert "Build mac uninstaller as subproject instead of externalproject (#1485)"
This reverts commit e62f04c601.
4 years ago
Jason Rhinelander e62f04c601
Build mac uninstaller as subproject instead of externalproject (#1485)
This makes it easier to build/rebuild via a target, and is a bit
cleaner.
4 years ago
Jason Rhinelander a753e96d8d
Version bump (#1483)
* Bump version to 0.8.2

* Let cmake set PROJECT_NAME

`project(x ...)` already sets PROJECT_NAME (and CMAKE_PROKECT_NAME if
this is the top-level build) to `x`; the logic here seemed sort of
backwards.

* Get rid of uninstaller entitlement

We don't seem to need it anymore with Qt 5.15.1.

* Bump windows lokinet-gui build
4 years ago
Jason Rhinelander 225c991edd
Merge pull request #1478 from majestrate/macos-packaging-fixes-2020-11-13
reset dns in uninstall script
4 years ago
Jason Rhinelander deae302571 macos: pass our pre-built static libs into the gui sub-build
Avoids the mac build needing to build lokimq & libzmq twice (once in
lokinet, then again in the gui)
4 years ago
Jason Rhinelander 8dd5bd6899 Update to lokimq 1.2.2 for segfault-at-shutdown fix 4 years ago
Jason Rhinelander 1c0e4dc4e7 Move all patches into contrib/patches 4 years ago
Jason Rhinelander f9144a7bb3 Patch to avoid IP_DONTFRAG bug in latest xcode with broken Big Sur SDK 4 years ago
Jason Rhinelander 8c01201a2f Upgrade libunbound to latest stable 4 years ago
Jeff Becker 876f292efb use /var/log/ for log files 4 years ago
Jeff Becker 300ce89278 kill the gui 4 years ago
Jeff Becker 452cf13841 delete lokinet applications directory 4 years ago
Jeff Becker b8a1c69a3e remove old path too 4 years ago
Jeff Becker bacb95962f try installing to lokinet subdirectory 4 years ago
Jeff Becker 42b979b266 remove line from uninstaller 4 years ago
Jeff Becker c4e983da3f update icon 4 years ago
Jeff Becker f3989c0f9a add entitlements 4 years ago
Jeff Becker 3a950aa950 change icon 4 years ago
Jeff Becker 4d089db3cd change tool name 4 years ago
Jeff Becker 36fa3f347a fix icon path 4 years ago
Jeff Becker d2a68f8323 add install target 4 years ago
Jeff Becker bb1f9c4dc0 ugh 4 years ago
Jeff Becker d268ef1246 security.h 4 years ago
Jeff Becker ee3489744e more fixes for macos 4 years ago
Jeff Becker 6e6bff5e1d fix header 4 years ago
Jeff Becker e835ad6347 chmod +x 4 years ago
Jeff Becker e183bf9673 fix typo 4 years ago
Jeff Becker ca5df6436a add initial uninstaller code that is horrible 4 years ago
Jeff Becker 580f005f50 revert 4 years ago
Jeff Becker 3b3374fa4c try watching trash for lokinet-gui.app and delete ourself if we see it 4 years ago
Jeff Becker 41311c020a preflight -> preinstall 4 years ago
Jeff Becker 0afe9f0138 update packaging for macos add preinstall script that nukes any existing lokinet make uninstaller revert dns to "empty" make cpack use preinstall script in pkg file 4 years ago
Jason Rhinelander 384b968cf0
Merge pull request #1437 from majestrate/key-manager-fixes-2020-10-30
key manager should throw on failure to load keys
4 years ago
Jason Rhinelander 3694124a9a
Merge pull request #1482 from majestrate/lokinet-cryptography-instalpath-2020-11-17
fix install path for liblokinet-cryptography.so
4 years ago
Jeff Becker 27c276ae4d
fix install path for liblokinet-cryptography.so 4 years ago
Jeff db7abe8f09
do /1 route poker split on linux (#1480)
* do /1 route poker split on linux

i hate netlink so god damn much

* use an enum class for the gateway mode
4 years ago
Jeff dad66c50cb
poke route hole for loopback on windows because that OS is made by brain damaged non programmers. (#1473)
this fixes the gui bug where it hangs on adding an exit becuase loopback gets routed over the exit.
before it was causing the lmq connection to hang becuase of that route change.
4 years ago
Jason Rhinelander 8e550091ab
Disable LTO on sid for now (#1472) 4 years ago
Jason Rhinelander 1ecdfd73e7
Dev to stable (#1471)
* Install less stuff on windows CI

mingw-w64 is a metapackage that pulls in 4 different compilers
{i686,x86_64}×{-posix,-win32} but we only need x86_64-posix, so just
install that package.

* Update gui win32 package url (#1466) (#1468)

Co-authored-by: Jeff <jeff@i2p.rocks>

* stop lokinet before uninstalling service (#1469)

* stop lokinet before uninstalling service

* kill gui in uninstaller

* add helper script for building windows installers because i forgot how to most of the time.

* Update win32 gui download with smaller svg icon

Co-authored-by: Jeff <jeff@i2p.rocks>
4 years ago
Jason Rhinelander fc49d09b26
Merge pull request #1470 from jagerman/svg-button-update
Update win32 gui download with smaller svg icon
4 years ago
Jason Rhinelander bcdb521974 Update win32 gui download with smaller svg icon 4 years ago
Jeff f18f18372a
stop lokinet before uninstalling service (#1469)
* stop lokinet before uninstalling service

* kill gui in uninstaller

* add helper script for building windows installers because i forgot how to most of the time.
4 years ago
Jason Rhinelander b5bbe17479
Update gui win32 package url (#1466) (#1468)
Co-authored-by: Jeff <jeff@i2p.rocks>
4 years ago
Jason Rhinelander f4fe47e028
Merge pull request #1467 from jagerman/win32-less-stuff
Install less stuff on windows CI
4 years ago
Jason Rhinelander a99b0bfd2b
Update gui win32 package url (#1466) 4 years ago
Jason Rhinelander aa4c4e7453 Install less stuff on windows CI
mingw-w64 is a metapackage that pulls in 4 different compilers
{i686,x86_64}×{-posix,-win32} but we only need x86_64-posix, so just
install that package.
4 years ago
Jason Rhinelander b0c43de12c
Merge pull request #1465 from loki-project/dev
retag 0.8.1
4 years ago
Jeff a0ed303d7b
try to handle router deregistrations on the network better (#1461)
* don't send messages to de-registered relays but allow traffic to clients

* actively close sessions to de-registered relays
4 years ago
Jason Rhinelander 4eb275324d
Fix deb snapshot builds + misc other CI updates (#1462)
* Remove unneeded libcurl-dev build dep

* Make apt-get operations quieter

* apt repo updates

- store the apt repo gpg pubkey in the repo rather than having to fetch
it every time
- add the apt repo for all the deb builds
- update apt repo URL to deb.loki.network instead of
deb.imaginary.stream

* Use http so that we don't need ca-certificates

The repo packages are already signed so using https really isn't
important.

* Add hack to ignore jsonnet conflicts in deb builds

* Add build machine name to build output

* We don't install any shared libs currently
4 years ago
Jeff 8a6ad2b7ee remove dpi flag for windows 4 years ago
Jason Rhinelander 276015034c
Merge pull request #1459 from majestrate/revert-1444
Revert 1444
4 years ago
Jeff a7518057cb Revert "deny traffic to non whitelisted routers. (#1444)"
This reverts commit ff02e62a79.
4 years ago
Jeff 107b68df87 git push origin stableMerge branch 'dev' into stable 4 years ago
Jeff 6bca6b3582 Merge remote-tracking branch 'origin/stable' into dev 4 years ago
Jeff ede6de708d
run without highdpi scaling on windows (#1456) 4 years ago
Jeff Becker 681de5fdaf bump lokinet wi32 gui build 4 years ago
Jeff c743022cfb
try fixing deadlock (#1454)
* fix deadlock in #1453

* remove use of shared_lock in profiling
* clean up Save and Load to acquire lock
* bencode and bdecode are now non locking

* remove all places using std::shared_lock

* bail if write fails
4 years ago
Jeff Becker 9d8b724cae fix path in uninstall command 4 years ago
Jeff e66522b9dd
fix path reference leak (#1451) 4 years ago
Jeff 34c7f0da0d
profiles.dat is always relative so if you spawn lokinet in / then it will error about permissions. (#1449)
* use absolute path for profiles.dat.

* remove old bencoding bits to use const fs::path instead of const char *
4 years ago
DEADBLACKCLOVER 30d7662ef2
Adding Russian translation (#1447)
* Create release_ru.md

* Create readme_ru.md

* Update readme.md
4 years ago
Jeff d1181d0ebb
Bump win32 gui version (#1446)
* bump gui build and hashpin

* run gui in no-tray mode by default

* bump gui version and hashpin
4 years ago
Jeff 92ddda96a9
update information in exit-setup.md (#1441) 4 years ago
Jeff 8be7c46531
try fixing memory leak in path builder (#1442) 4 years ago
Jeff ff02e62a79
deny traffic to non whitelisted routers. (#1444)
* deny message delivery from non registered nodes when whitelist is enabled and applicable

* use DoCallback and return true so that the event gets fired right
4 years ago
Jeff 87c76a6769
add exit.localhost.loki cname record (#1440)
* add exit.localhost.loki cname record

* return cname in localhost.loki A/AAAA lookup reply

* correctly handle case where we have no exit

* typofix

* simplify logic
4 years ago
Jason Rhinelander eea0929077
Move resolvconf from deb branches to contrib/ (#1439)
* Move resolvconf from deb branches to contrib/

This script gets invoked by the systemd service after startup to update
resolvconf with the lokinet dns server.

It was previously living in debian/lokinet-resolvconf in the
debian/ubuntu branches, but really belongs in contrib/ instead.

* Disable LTO on sid gcc/clang-11
4 years ago
Jeff 3ec727d844
I have no words. (#1438)
So apparently dnsConfig in Router was never set.
Router::networkConfig was set, but only used in the function
which set it and otherwise only passed to another function once.
dnsConfig was only used in one place.

both member variables have been removed in favor of just
referencing Router::m_Config.

Co-authored-by: Thomas Winget <tewinget@gmail.com>
4 years ago
Jeff Becker 5233b26552
format 4 years ago
Jeff Becker bf1a692005
key manager should throw on failures 4 years ago
Jeff Becker 3e5dcb34cf turn building shared libraries off by default because no one uses this right now 4 years ago
Jeff 0e1e0aaef3
allow for relative file paths in config (#1432)
* llarp::Config constructor can take an empty fs::path now and it will default to fs::current_path
* llarp::ensureConfig now throws on fs error
* updates to daemon/main.cpp to reflect changes to llarp::ensureConfig's new throwability
* dowse parts of the code with holy water for the 0.8.1 tag
4 years ago
Jeff 569bfe14b4
dont do native builds in static linux ci (#1434) 4 years ago
Jeff f3ef81b28c
use same directory for windows installer, remove version. (#1435) 4 years ago
Jeff c81b6049f1
fix crashes on shutdown (#1433) 4 years ago
Jason Rhinelander e47b70a82f
CMake fixes: libuv static build, base_libs, shared lib install dir (#1431)
* Update how we build libuv

- Update submoduled libuv to latest stable (1.40.0)
- Don't look for a system libuv if we're under BUILD_STATIC_DEPS
- Add a libuv interface library rather than using globals
- Make the windows build fall back to the submodule if not explicitly
  given a LIBUV_ROOT

* Replace ${LIBS} global with `base_libs` interface

This simplifies linking and include handling a bit.

* Remove unneeded header

* Add missing csignal header

(This was previously being pulled in incredibly indirectly via some
stuff that eventually includes some other stuff that eventually included
uv.h)

* Use GNUInstallDirs to get lib dir instead of hard-coding lib

Fixes #1429
4 years ago
Jeff 4e2ba1a96c
bump version to 0.8.1 (#1425) 4 years ago
Jeff dcb48db5fe
enable profiling on clients by default (#1421)
* enable client relay profiling by default

* macos dns fixes

* improve peer profiling algorithm to track timeouts vs failures

* remove debug ioctl call in tuntap code

* use ub_wait instead of ub_process as that was what was there before

* const correctness

* DRY out checking for SIIT

* typofix

* correct name
4 years ago
Jeff 32f4287df6
handle libuv case when we don't have it (#1403)
* add case for cmake when libuv is not found

* update error case in cmake
4 years ago
Jeff 4354a270c0
bump win32 gui build\ * add hashpin for gui * add installer icon (#1424) 4 years ago
Jeff 4c7d52ac20
more aggressive path building. (#1423)
* more aggressive path building.

* do more than one in parallel path builds at a time

* correct last commit's logic

* rename numPaths -> numDesiredPaths to clarify intent

* revert string change as it will break a lot

* don't prematurly short circuit on snode builds

Co-authored-by: Thomas Winget <tewinget@gmail.com>
4 years ago
Jeff e731eab4b6
bugfixes for lokinetmon (#1426)
* bugfixes for lokinetmon

* move call to fetch version to before mainloop
4 years ago
Jason Rhinelander 4f3775c28c
Crank clang version to 11 (#1422) 4 years ago
Jeff c5c73568a5
redo cpack for win32 (#1420)
* bundle gui
* bundle bootstrap.signed
* add shortcut
* install/remove service
4 years ago
Jeff 7a1207dc47
dont bind inbound links as client (#1419)
* dont bind inbound links as client

* fix broken test

* logic call MUST defer call
4 years ago
Jeff a01a622fce
make drone ci use debian testing (#1413) 4 years ago
Jeff f4e2f93c8e
use correct path for windows service (#1418) 4 years ago
Thomas Winget a91bb35dbf
Some Windows fixes (#1415)
* Should fix some windows service issues

* fix return condition inversion

* Add some Trace level logging

also make the logger actually respect the log level you set.

* event loop should not queue things to itself...

at present, logic thread queue continues until it is empty, so
queueing things onto itself is just wasteful.

* call_later(foreach thing) is better than foreach thing (call later)

also if you already queued those things but they have not happened yet,
there is no sense to queue them to happen again.

* do not queue read on write finish, only on read finish

* failure to start DNS server should be proper startup failure.

without the DNS server working lokinet is...kinda pointless, right?

* format

* don't queue stuff to logic thread if in logic thread
the thing that clears the queue...clears it.  So you're just delaying and adding overhead.

* windows unbound thread sleep instead of just busy-waiting

also clang-format decided I can't have a blank line for some reason...

* fix unbound async worker on windows
4 years ago
Jeff 12eb32a816
add conf.d directory for config overrides (#1410)
* add conf.d directory for config overrides

* refactor llarp::Config

* add explicit constructor with datadir as parameter
* have all config files be passed as std::optional
* make Config::LoadDefault private and use std::optional in Config::Load to remove ambiguity
* update rest of codebase to reflect above changes

* fix pybind

* rename bootstrap config skipBootstrap to seednode as it's more descriptive
* make seednode configurable
* make pybind layer compile
* make pybind layer run
4 years ago
Jeff 22acf0a537
Lns exits (#1407)
* lns exits

* try appeasing the clang

* clean up lambda
4 years ago
Thomas Winget df36ed953d
Route Poker changes (#1416)
If not using an exit, messing with the routing table is not good.
As such, the ability to keep track of routes we *might* want is good,
but the ability to set/unset those routes is necessary, to correspond
to enabling/disabling exit functionality.
4 years ago
Jason Rhinelander a888b7bbc2
Reduce macOS target to 10.12, and fix target for deps (#1414)
This is relatively painless for lokinet as it already had workarounds
during 0.8 dev work for the things macos hated in 10.13.

Dependencies, however, were not being built with the proper macos target
junk, so this fixes that.
4 years ago
Jason Rhinelander 60de84fde7
Try to build for 10.14 (#1412) 4 years ago
Jeff 98e022ea21
Unflaky-ify lns dns (#1406)
* always ensure path to service on dns lookup

* deprecate profiles option
4 years ago
Jeff 38f13533df
always use data directory for bootstrap.signed (#1405) 4 years ago
Jeff 5b5bd6b44e
dns features (#1404)
* add some dns txt records for stuff we want to expose

* fix txt records

* txt records for snode info

* dont send cname as it mangles the response

* check for 3 parts not 3 characters
4 years ago
Jason Rhinelander d10fee87c7
Don't report a huge negative elapsed time on startup (#1401) 4 years ago
Jeff 3b70b99dd2
fix empty config case (#1400)
* fix empty config case

* * fix case for empty ifname / ifaddr on relay
* bail if no dns server bound

* use AssignmentAcceptor
4 years ago
Jeff 50aea744f6
order packets when writing to network interface (#1372)
* order packet writes on userside

* make it compile

* fix pybind
4 years ago
Rick V b9f6af760b
move old stuff down a notch (#1377)
* move old stuff down a notch

* Update CROSSCOMPILE.md

* Update CROSSCOMPILE.md

* Update CROSSCOMPILE.md

* Update CROSSCOMPILE.md
4 years ago
Jason Rhinelander af6caf776a
Config file improvements (#1397)
* Config file API/comment improvements

API improvements:
=================

Make the config API use position-independent tag parameters (Required,
Default{123}, MultiValue) rather than a sequence of bools with
overloads.  For example, instead of:

    conf.defineOption<int>("a", "b", false, true, 123, [] { ... });

you now write:

    conf.defineOption<int>("a", "b", MultiValue, Default{123}, [] { ... });

The tags are:
- Required
- MultiValue
- Default{value}
plus new abilities (see below):
- Hidden
- RelayOnly
- ClientOnly
- Comment{"line1", "line2", "line3"}

Made option definition more powerful:
=====================================

- `Hidden` allows you to define an option that won't show up in the
  generated config file if it isn't set.

- `RelayOnly`/`ClientOnly` sets up an option that is only accepted and
  only shows up for relay or client configs.  (If neither is specified
  the option shows up in both modes).

- `Comment{...}` lets the option comments be specified as part of the
  defineOption.

Comment improvements
====================

- Rewrote comments for various options to expand on details.
- Inlined all the comments with the option definitions.
- Several options that were missing comments got comments added.
- Made various options for deprecated and or internal options hidden by
  default so that they don't show up in a default config file.
- show the section comment (but not option comments) *after* the
  [section] tag instead of before it as it makes more sense that way
  (particularly for the [bind] section which has a new long comment to
  describe how it works).

Disable profiling by default
============================

We had this weird state where we use and store profiling by default but
never *load* it when starting up.  This commit makes us just not use
profiling at all unless explicitly enabled.

Other misc changes:
===================

- change default worker threads to 0 (= num cpus) instead of 1, and fix
  it to allow 0.
- Actually apply worker-threads option
- fixed default data-dir value erroneously having quotes around it
- reordered ifname/ifaddr/mapaddr (was previously mapaddr/ifaddr/ifname)
  as mapaddr is a sort of specialization of ifaddr and so makes more
  sense to come after it (particularly because it now references ifaddr
  in its help message).
- removed peer-stats option (since we always require it for relays and
  never use it for clients)
- removed router profiles filename option (this doesn't need to be
  configurable)
- removed defunct `service-node-seed` option
- Change default logging output file to "" (which means stdout), and
  also made "-" work for stdout.

* Router hive compilation fixes

* Comments for SNApp SRV settings in ini file

* Add extra blank line after section comments

* Better deprecated option handling

Allow {client,relay}-only options in {relay,client} configs to be
specified as implicitly deprecated options: they warn, and don't set
anything.

Add an explicit `Deprecated` tag and move deprecated option handling
into definition.cpp.

* Move backwards compat options into section definitions

Keep the "addBackwardsCompatibleConfigOptions" only for options in
sections that no longer exist.

* Fix INI parsing issues & C++17-ify

- don't allow inline comments because it seems they aren't allowed in
ini formats in general, and is going to cause problems if there is a
comment character in a value (e.g. an exit auth string).  Additionally
it was breaking on a line such as:

    # some comment; see?

because it was treating only `; see?` as the comment and then producing
an error message about the rest of the line being invalid.

- make section parsing stricter: the `[` and `]` have to be at the
beginning at end of the line now (after stripping whitespace).

- Move whitespace stripping to the top since everything in here does it.

- chop off string_view suffix/prefix rather than maintaining position
values

- fix potential infinite loop/segfault when given a line such as `]foo[`

* Make config parsing failure fatal

Load() LogError's and returns false on failure, so we weren't aborting
on config file errors.

* Formatting: allow `{}` for empty functions/structs

Instead of using two lines when empty:

    {
    }

* Make default dns bind 127.0.0.1 on non-Linux

* Don't show empty section; fix tests

We can conceivably have sections that only make sense for clients or
relays, and so want to completely omit that section if we have no
options for the type of config being generated.

Also fixes missing empty lines between tests.

Co-authored-by: Thomas Winget <tewinget@gmail.com>
4 years ago
Jason Rhinelander 62a90f4c82 macos package fixes for 0.3.0
- bumps deployment target to 10.15 because earlier versions don't
  support C++17.
- remove double-include of installer.cmake
- use new static dep lokinet build system
- replace lokinetctl with lokinet-vpn
4 years ago
Jeff b0088b3298
dont segfault on exit (#1396)
* dont segfault on exit

* initialize m_isServiceNode earlier.
4 years ago
Jeff ff23106852
don't allow running lokid-rpc as client (#1394) 4 years ago
Jeff 03d6f191d1
add status command to lokinet-vpn (#1393) 4 years ago
Jason Rhinelander d507e44350
Don't use -march=native for static linux build (#1390) 4 years ago
Jason Rhinelander 277adc61c7
Merge pull request #1388 from loki-project/master
Merge master back to dev
4 years ago
Jason Rhinelander b67df3aaf3
Merge pull request #1387 from jagerman/net-if-default
Set default inbound link to best public interface
4 years ago
Jason Rhinelander 753d989f7c Set default inbound link to best public interface
Fixes default config not working.
4 years ago
Jason Rhinelander 49907a3ca0
Merge pull request #1386 from loki-project/dev
Add upstream dns default and fixes to 0.8.0 release
4 years ago
Jason Rhinelander f96af0ff9d
Merge pull request #1385 from majestrate/default-upstream-dns-2020-10-02
set Default upstream dns
4 years ago
Jason Rhinelander 7aa4566016 Make format 4 years ago
Jason Rhinelander c2519a1619
Merge pull request #1384 from jagerman/shallow-clone
Drone: Shallow clone submodules
4 years ago
Jason Rhinelander 4faaf9082c Fix broken unbound resolver when including upstream port
unbound breaks when given "1.2.3.4:53" as it expects only an IP.
4 years ago
Jason Rhinelander 01013c1963 Make upstream= override work; reject non-default upstream port
If you specify upstream= then you get no upstream, if you give one then
you use that instead of the default, but you can still list multiple.

unbound doesn't support an upstream port, so bail if the user gives a
non-port-53 response.
4 years ago
Jason Rhinelander d129b0432a Allow empty values so that upstream= can disable the default 4 years ago
Jason Rhinelander c97b9ef31b Simplify k=v parsing code 4 years ago
Jeff 9d6dc40f81 format 4 years ago
Jeff 2b5b3ce8e1 default upstream dns to cloudflare 4 years ago
Jason Rhinelander 4ac733c7e2 Shallow clone submodules 4 years ago
Jason Rhinelander 5a85aa96ec
Merge pull request #1382 from loki-project/dev
0.8.0 release for real*
4 years ago
Jeff 0f7e848903
disable rpc on relays by default (#1383)
* disable rpc on relays by default

* add default inbound link as service node

* throw if public-ip and public-port are not set
4 years ago
Jason Rhinelander fbfa8ca89c
make format (#1381) 4 years ago
Jason Rhinelander b121933374
Make public-ip option work (#1380)
0.7 supported both public-address and public-ip, but only the former was
being allowed in 0.8.

This makes `public-ip=...` work again, and makes it the canonical option
(because it makes a bit more sense than address when we also have the
public-port parameter), while making `public-address=` accepted with a
deprecation warning.

Also adds default descriptions for port and ip for the generated ini.
4 years ago
Jason Rhinelander 53f1601dc4
Merge pull request #1379 from majestrate/config-fixes-2020-10-02
fixes for 0.8.0 retag
4 years ago
Jeff f797405318 ping lokid every 30 second after starting up 4 years ago
Thomas Winget 4f3ed5d1c4
remove unnecessary code
the signed_bt_dict field is not used for a Version 0 RC anyway, so no need to handle it here.  That was my bad.
4 years ago
Jeff Becker c04cbfe34f
fix decode version 0 rc when in version 1 mode 4 years ago
Jeff Becker 79dfb6d357
kill lmq before stopping links/ 4 years ago
Jeff Becker 5b4b1f7aee
disable whitelist in unit test 4 years ago
Jeff Becker bb67b42f0b
put pubkey_ed25519 in fields 4 years ago
Jeff Becker 23302cd10c
use size_left 4 years ago
Jeff 3445716fce update readme build info 4 years ago
Jeff 503a92c992 un limit lmq 4 years ago
Jeff 7852735b36 tweak configuration defaults 4 years ago
Jason Rhinelander 98463b9c11
Merge pull request #1376 from loki-project/dev
0.8.0
4 years ago
Jeff 28bfaf0372
ammend log levels for common spammy log events (#1375) 4 years ago
Jeff Becker ac16cdc177 bump lokimq submodule to 1.2.0 4 years ago
Jason Rhinelander d41f6f1ef0
0.8.0 version bump (#1373) 4 years ago
Jeff 8943be6c3a
serialize auth codes in rpc (#1369)
* serialize auth codes in rpc

* format

* format

* config and route fixups

* bump lokimq

* fix compile

* discard unknown members in service keys

* format
4 years ago
Thomas Winget 7f18df4e9a
fix format string for size_t (#1371) 4 years ago
Jeff 56f49a6980
make win32 exits work again (#1367) 4 years ago
Jeff 53598ec0e9
dont serialize ephemeral members of service identity (#1370)
* prepare for keytool script

* dont serialize ephemeral members in service key file
* regnerate ephemeral members in service identity on load

* add keygen script

* use nacl for generating keys

* format
4 years ago
Thomas Winget 15229ea7ff
New RC format (#1368)
* initial work for RC SRVs.

Needs tests for new RC format.

Needs SRVs added to new RC, and associated tests.

* convert rc sign/verify test to catch2, add test for new rc

Also fixes a mistake in new rc serialization

* bump loki-mq submodule

need support for viewing bt deserialize consumer buffer so we
know how much it has consumed.

* fix some behavior errors

need to advance llarp_buffer_t after consuming data from it

only rewind and modify size of llarp_buffer_t in owning context.

* Add test for router contact (de-)serialization

Adds a test that makes a list of RouterContact with mixed
versions and ensures it serializes and deserializes correctly.
4 years ago
Jeff 252692a55b
dont poke routes if we have no exit (#1352)
* * refactor route poking out of llarp::Router and into llarp::RoutePoker
* only poke routes when we have an exit enabled as a client

* add route_poker header so it compiles
4 years ago
Jeff 10e3d80559
resolve issue #1361 about peer stats excessive logging (#1365) 4 years ago
Jason Rhinelander 5765c128ad
Remove gcc-5 workaround (#1360) 4 years ago
Jeff Becker 7a18d14fde make it compile 4 years ago
Jeff a9d23d3ac3
use absolute path for route command (#1354)
* ignore tun interfaces on windows for mitigating foot cannons

* add flag for git add -p when using format verifier as git hook

* use explicit path for route command on windows

* fix typo

* fix typo

* remove hunk for win32 route exclusion based off being a tun interface

* add metric to win32 route command

* * refactor win32 route poking to use a common function for iterating over routes

* put interface in route poking for default route

* mnake it compile

* use correct route command on windows

* use fs::path for service::Identity::EnsureKeys
4 years ago
Jeff 11ed8924c6
use fs::path for service::Identity::EnsureKeys (#1364) 4 years ago
Jason Rhinelander d03066ee05
Support [dns] no-resolvconf option (ignored by lokinet) for deb compatibility (#1362)
* Add ignored [dns]no-resolvconf option for deb backwards compat

The debs hack a `#no-resolvconf=1` into the config file in 0.7 to allow
a user to disable resolvconf setup during startup by uncommenting it.
That doesn't work anymore since 0.8 errors on invalid config options, so
add it as an ignored option so that 0.7 deb config files can still be
compatible.

* Fix `[dns]upstream` comment not being produced in generated conf file

* fix test

Co-authored-by: Jeff <jeff@i2p.rocks>
4 years ago
Jason Rhinelander 63a876cc78
Allow -DWITH_SETCAP=OFF to disable setcap during make install (#1363)
The debs don't want it (and so this will save needing to patch it out),
nor do you need it if running via a systemd service file that sets the
capabilities.
4 years ago
Jason Rhinelander bbfbc1c1e7
Drone CI job shuffling (#1359)
- Disable bionic arm64 job to reduce the load on the ARM box a bit.
- Add bionic amd64 build so that we have a (normal) build on bionic.
- Remove sid/g++-10 job because g++ is now the default on sid (so the
  debian/sid build is already doing the same thing).
4 years ago
Jeff c91e4df856
make errors with service keyfile throw (#1358) 4 years ago
Jeff fe30193a97
revive android build system (#1339)
* it lives?

* clean up

* add readme and add x86_64 to abi filters

* disable route poking on android

* make it compile on android

* it compiles!!111

* typofix

* re-enable ccache for android
4 years ago
Jeff ef794bbd11
move pkgconfig requirement (#1355) 4 years ago
Jason Rhinelander d90c1390fa
Merge pull request #1351 from majestrate/wire-up-lns-2020-09-19
client side lns fixes
4 years ago
Jeff 75ef28531e allow lns subdomains 4 years ago
Jeff a035dbdb9a enable peer stats by default 4 years ago
Jeff 686b13b2f3 fix up cmake lokimq target 4 years ago
Jeff 78b40d6725 wire up lns gotnamemessage handler to kitchen sink 4 years ago
Ryan Tharp 5d43a804d1
Update requirements and other README.md clean up (#1343)
* Update requirements and other clean up

git is now required due to submodules
libcurl/libcap: not sure if the minimum version is correct, The number I used is based on the bionic package version
add recursive option to all cloning
other tweaks to make concise and  precise

* Remove libcurl

* Add nproc back

* add libcurl back for windows

* Remove libcurl from WIndows

as lokinet-bootstrap.exe is just curl.exe now and will be removed soon
4 years ago
Rick V 7136f77c2e
allow running lokinet as root on windows (#1347)
* - allow running lokinet as root on windows
  ($PROGRAMDATA/.lokinet/lokinet.ini)
- oops forgot to eat my own command line args

* cursed windows

* now that we eat our own startup options the entry in cxxopts is fully
ded

* aha our command line options get smashed up

* revert plus DRY fix
4 years ago
Jeff 21930cf667
LNS (#1342)
* initial relay side lns

* fix typo

* add reserved names and refactor test for dns

* lns name decryption

* all wired up (allegedly)

* refact to use service::EncryptedName for LNS responses to include nonce with ciphertext

* fully rwemove tag_lookup_job

* replace lns cache with DecayingHashTable

* check for lns name validity against the following rules:

* not localhost.loki, loki.loki, or snode.loki

* if it contains no dash then max 32 characters long, not including the .loki tld (and also assuming a leading subdomain has been stripped)

* These are from general DNS requirements, and also enforced in
registrations:

* Must be all [A-Za-z0-9-]. (A-Z will be lower-cased by the RPC call).

* cannot start or end with a -

* max 63 characters long if it does contain a dash

* cannot contain -- in the third and fourth characters unless it starts with xn--

* handle timeout in name lookup job by calling the right handler with std::nullopt
4 years ago
Jason Rhinelander f5e5066bd5
Update deps (#1348)
* Update submodules/static deps to latest versions

* Add mingw zmq build patch

* Drop support for Windows 2000
4 years ago
Jeff c64c9093f2
make endpoints reachable by default (#1344) 4 years ago
Jeff dfd8df5e7f
add uninstall target (#1340)
* add uninstall target

* * redo cmake uninstall
* remove lokinet-vpn python script
* don't install lokinet-vpn twice
4 years ago
Jeff 854ce48e1c
remove gitlab ci as it is unused (#1341) 4 years ago
Jeff 681459185f
remove locks (#1336)
* remove locks

* use tryPushBack to attempt to prevent deadlocks
4 years ago
cathugger 838d28c6ed
contrib: NetworkManager dnsmasq config (#1335) 4 years ago
cathugger 412821ed77
contrib: systemd-resolved config (#1334) 4 years ago
Jeff 3ab7db7723
macos route poking (#1333)
* fix up macos route poker logic

* fix typo

* use string_view

* add forgotten header

* full paths

* add debugging

* catch exception on adding route

* workarround for macos

* typofix

* typofix

* fix for macos

* fix command for macos

* because we autopoke remove explicit route poking in rpc

* probably final fix of macos route poking

* split routes instead of deleting them

* dynamic route poking

* move log statement for introset lookup and dont consider bad sessions as able to send

* send convotag reset frame when we have no session

* add exit map to rpc

* use split_any
4 years ago
Jeff 60f4d96ba5
proper route poking (#1330)
* route poking:

* remove popen() call, replace with reading /proc/net/route for getting default route
* dynamically poke and unpoke routes on runtime

* swap intros and fix rpc endpoint for version to return what the ui expects

* use std::string::find_first_not_of instead of using a lambda
4 years ago
Thomas Winget 2c6e7b86c3
SRV records fixes (#1332)
* fix a log print log level

* correctly match SRV record service and protocol...

* tests for new dns question functions
4 years ago
Thomas Winget b1c14af938
SRV Record handling for introsets (#1331)
* update loki-mq submodule for tuple support

* srv record reply implementation

still need to encode srv records into intro sets / router contacts
as well as decode from them and match against queried service.proto

* inverted condition fix in config code

* SRV record struct (de-)serialization for intro sets

* parsing and using srv records from config (for/in introsets)

* adopt str utils from core and use for srv parsing

* changes to repeat requests

no longer drop repeat requests on the floor, but do not make
an *actual* request for them if one is in progress.

do not call reply hook for each reply for a request, as
each userland request is actually made into several lokinet
requests and this would result in duplicate replies.

* fetch SRVs from introsets for .loki

* make format

* dns and srv fixes, srv appears to be working
4 years ago
Jeff 521765b5a8
Merge pull request #1319 from majestrate/clean-up-dev-2020-07-27
exit tool rewrite in C++ (without macos support yet)
4 years ago
Jason Rhinelander fd684a225b Update nlohmann to latest stable 4 years ago
jeff def8a9ce46 disable running router hive just build it 4 years ago
jeff 1537ad18df format 4 years ago
jeff fc5035902a only stop router hive from fixture when router hive is not None 4 years ago
jeff 75f550434c change assert to throw an exception instead when service node has no peer stats enable.
update unit tests so it passes on debian sid
4 years ago
jeff 52d20968a7 remove llarp::StrEq 4 years ago
jeff bbc749294e fix windows build typo 4 years ago
jeff 5391e6a66a initial config overriding on runtime 4 years ago
jeff e3bfe76f98 add exit auth token awareness to config 4 years ago
Jeff Becker 1b4f5ee5ea
add forgotten win32 header 4 years ago
jeff 39f5e7213f set send timeout to 5 seconds for exits 4 years ago
Jeff Becker d39ed26ff0
add headers and fix type for windows 4 years ago
Jeff Becker 68e72d88fd
add forgotten header on macos 4 years ago
Jeff Becker d70e11feba
change what patches are applied 4 years ago
Jeff Becker d4e1a44452
fix typo 4 years ago
Jeff Becker ab568b27d0
bump windows version for CI until patches are updated 4 years ago
Jeff Becker 184503dab1
change to unsigned char for CI 4 years ago
Jeff Becker bc40453100
get rid of void pointer arithmatic and signed vs unsigned comparison 4 years ago
Jeff Becker fc75da174e
disable second path for now until it works 4 years ago
Jeff Becker 43a58b9c74
const correctness 4 years ago
Jeff Becker 21bc3bd9a0
format 4 years ago
Jeff Becker d8dcffe80a
resolve conflict with dev 4 years ago
jeff 574a986d9a
explicitly set frame reset field to zero by default 4 years ago
jeff f6f56029d3
working netlink route poker 4 years ago
jeff 668ddf837f
checks 4 years ago
jeff e039aeb6d5
remove codepath for convotag invalidation 4 years ago
jeff 0c3b57199a
fix initialization 4 years ago
jeff abc55924e7
forgot header 4 years ago
jeff 5a8884cc2f
uncomment block 4 years ago
jeff 8472aea93f
initial netlink jizz 4 years ago
jeff b0bb0b7609
initial route poking 4 years ago
jeff 2e7f9d1b87
remove convo tag when we invalidate it 4 years ago
jeff 3fbc46879d
Revert "don't send protocol discard message on fail"
This reverts commit ee2a42118c88bd7778cd6dc8694564c7d10e60d1.
4 years ago
jeff 78a4d361ab
don't send protocol discard message on fail 4 years ago
jeff 099831719a
update macos command for default route poker. 4 years ago
jeff 528340e056
dont include sys/wait.h on windows 4 years ago
jeff d973ce9089
upgrade alpine container 4 years ago
jeff d0374ce083
windows does not have fork/wait 4 years ago
jeff 30a6e901f5
add router.enable-peer-stats config option unconditionally 4 years ago
jeff 6d91ac8e4e
rename r flag to router 4 years ago
jeff f5e4d8bd1b
execv needs program name as first argument 4 years ago
jeff 75f9643776
attempt to fix snode traffic ip rewrite bug 4 years ago
jeff fac5502c55
if Router::SendToOrQueue fails propagate that failure in LRCM handler 4 years ago
jeff b6d63968c4
* correct unit tests for exit context so they pass
* when providing an ip address for inbound links dont throw if they are valid
4 years ago
jeff 2aaed895f3
disable exits in RCs 4 years ago
jeff 0ee1c4a60a
use full path for ip on linux and report exit code 4 years ago
jeff bc8e867dfb
use exec for lokinet-vpn 4 years ago
Jeff Becker 3619356406
attempt fixing 100% cpu use on relays 4 years ago
Jeff Becker ff130e2b5e
die if we are a relay and don't have any inbound links 4 years ago
Jeff Becker 8c3621cead
fix issue #1328 4 years ago
Jeff Becker d531769e39
disable long running unit test so ci doesn't take so long 4 years ago
Jeff Becker 9494315bc6
add lokinet-vpn to ci upload artifacts 4 years ago
Jeff Becker 1e8fcbb99b
make destructor virtual 4 years ago
Jeff Becker da6ba86892
add destructor to fix CI builds on macos 4 years ago
Rick V f283c565e7
make x.x.x.y+1 the default router on windows 4 years ago
Jeff Becker 400f5d3902
windows uses multiple commands for default route. 4 years ago
Jeff Becker d1abee84d1
windows route hack because lol windows 4 years ago
Jeff Becker 611cc95f2b
add docs for exit setup 4 years ago
Jeff Becker b2e5a178a4
verbose logging of executed commands 4 years ago
Jeff Becker d9d63ba14b
add metric to windows 4 years ago
Jeff Becker 876b8db1a1
windows fixes 4 years ago
Jeff Becker dde6bbeeb8
fix for windows as it is cursed 4 years ago
Jeff Becker 88de4c6f91
windows fixes 4 years ago
Jeff Becker 65b9b55335
fixes for windows 4 years ago
Jeff Becker 7e562a5b37
add netmask for macos 4 years ago
Jeff Becker 49eb42d63f
formatting and typo fix 4 years ago
Jeff Becker 9e24a5bfca
add check for no default route on down
fix macos bits for down
install lokinet-vpn with cmake
4 years ago
Jeff Becker c49e11031a
fix variable name 4 years ago
Jeff Becker 778792f8fc
fix compile error on macos and exclude excluded interface 4 years ago
Jeff Becker c2e484d14b
fix apple build 4 years ago
Jeff Becker 847fdb4f6b
add initial macos bits for lokinet-vpn (apple made macos so that man may suffer) 4 years ago
Jeff Becker 34ffd8e869
dont put the "gateway" into the return value use the interface address instead because that is what we are looking for 4 years ago
Jeff Becker 45b6fcd7cb
forgot hunk 4 years ago
Jeff Becker 04392a5115
tweak windows bits so that they compile 4 years ago
Jeff Becker 36a2bc5d66
add forgotten array header 4 years ago
Jeff Becker 22e4aef4f9
initial windows platform specific bits for lokinet-vpn 4 years ago
Jeff Becker 37e16291cb
working on linux with root 4 years ago
Jeff Becker a8239af73a
initial lokinet-vpn tool rewrite 4 years ago
Jeff Becker 576c6ec9d4
fix serialize order of dict in peer stats and make the unit tests match this change 4 years ago
Jeff Becker fa37c7c9b5
use std::array in unit test and initialize it to be all zero so that when we use it the string we cast to is probably null terminated.
also apply clang format
4 years ago
Jeff Becker e9aa200e8c
make formatting happy 4 years ago
Jeff 1a74c190b6
Merge pull request #1327 from despair86/win32-scm-daemon
Win32 scm daemon
4 years ago
Rick V 98241c6c1a this is what c-f v10 thinks it should look like 4 years ago
Rick V 59b8b1ba6d add service description 4 years ago
Rick V 7de4c509d7 haha lokinet is cursed now 4 years ago
Rick V 7bd3731e98 first draft of daemon control code 4 years ago
Rick V d56706b626 more daemon fluff 4 years ago
Rick V 8c62a726c0 stupid trampoline to return control to lokinet
after SCM starts
4 years ago
Rick V ca9984cc69 win32 daemon install/remove goo 4 years ago
Rick V 5c34665fce
move win32 lokimq patch 4 years ago
Jeff 671e01c028
Merge pull request #1324 from majestrate/libunbound-win32-fix-2020-08-04
attempt fix for libunbound on win32
4 years ago
Jeff Becker 4bb214eba0
attempt fix for libunbound on win32
* run unbound stuff in another thread because LOL windows
* because unbound runs in another thread callbacks for libunbound need to be wrapped in a deferred call so they are done in the logic thread
* bump sqlite3 dep because it's gone, repin hash.
4 years ago
Jason Rhinelander 6f3d881a0f
Merge pull request #1323 from majestrate/freebsd-fix-unit-tests-2020-07-31
disable thread safety anonations for freebsd + gtest
4 years ago
Jeff Becker 9050085165
disable thread safety anonations for freebsd + gtest 4 years ago
Jeff 07b994a767
Merge pull request #1321 from majestrate/bind-ip-port-config-2020-07-30
fix issue #1320 (allow providing ip/port in bind section of config)
4 years ago
Jeff Becker 301cb6d32f
fix issue #1320 (allow providing ip/port in bind section of config) 4 years ago
Jeff 998d4c4ec3
Merge pull request #1318 from notlesh/peer-stats-follow-up-2020-07-09
Peer stats follow up 2020 07 09
4 years ago
Stephen Shelton 83d337ddfd
Send response on error conditions in API request 4 years ago
Stephen Shelton b037cf0ae4
Handle get_peer_stats request's list of router ids 4 years ago
Stephen Shelton 4699280d97
Crude attempt at retrying lokid connection 4 years ago
Stephen Shelton 1d9c337021
Grab lokimq::ConnectionID on connection attempt 4 years ago
Stephen Shelton 607d04a314
Use str instead of lokimq::ConnectionID in pybind 4 years ago
Stephen Shelton eedf7ca599
Add implementation of get_peer_stats API 4 years ago
Stephen Shelton bbc1cd5a31
Stub out get_peer_stats LMQ API request 4 years ago
Stephen Shelton c07dcaa2ef
Handle service node privkeys response correctly 4 years ago
Stephen Shelton acb0248f94
Use LMQ request instead of command for lokid ping 4 years ago
Stephen Shelton 9deee9e542
Add bencoding serialization to PeerStats 4 years ago
Stephen Shelton baac6bf3bd
Update python test code to reflect HiveRouter API 4 years ago
Stephen Shelton 159447b984
Don't "safely" visit relays in RouterHive 4 years ago
Stephen Shelton 56e2bc2c47
Acquire python's Global Interpreter Lock in callbacks 4 years ago
Stephen Shelton a88dc9f026
Prevent pybind from deleting HiveRouter pointers 4 years ago
Stephen Shelton 305795315b
Specify disabling RC gossiping (testing only) properly 4 years ago
Stephen Shelton 0e99f5bc86
Configure HiveContext it pybind correctly 4 years ago
Stephen Shelton 90ec789fe9
Avoid lokid in router hive 4 years ago
Stephen Shelton 0f074cff8c
Remove ambguity WRT loading and passing of Config 4 years ago
Stephen Shelton f607b99dbe
Fixes to Context::Configure with default config 4 years ago
Stephen Shelton ced2ac64fb
Remove last remnants of 'worker' 4 years ago
Stephen Shelton fb75329b88
Update SessionEstablished function sig in test_iwp_session.cpp 4 years ago
Stephen Shelton 97c14d81fd
Refactor test_llarp_exit_context.cpp to remove C API usage 4 years ago
Stephen Shelton cdaa28bfd3
Use QueueDiskIO instead of diskworker for db flushing 4 years ago
Stephen Shelton 88c3e9ce00
Remove worker thread parameter from Router constructors 4 years ago
Stephen Shelton ec20d94c6b
Fix Context::Configure() 4 years ago
Stephen Shelton 343252c48d
Use HiveContext and HiveRouter properly 4 years ago
Stephen Shelton ed47ba998f
Minor fixes around Context 4 years ago
Stephen Shelton 552dcce5fd
Use inheritance to handle Hive injection 4 years ago
Stephen Shelton b0d8568452
Remove llarp C API usage from RouterHive 4 years ago
Stephen Shelton 84c83a2400
Add specialized subclass of Router for Hive 4 years ago
Jason Rhinelander 2b2c41fdf6
Fix sqlite3 external target name 4 years ago
Stephen Shelton e38a507551
<3 Windows (prefer fs::path::string() over native()) 4 years ago
Stephen Shelton 1e95625f27
<3 apple -- avoid std::optional::value() 4 years ago
Stephen Shelton 93bafcf142
Set up sqlite3 deps 'if NOT TAGRET sqlite3' 4 years ago
Stephen Shelton eb9a862f51
Sqlite3 deps for Windows / static targets 4 years ago
Stephen Shelton 186a35c0e2
Appease clang (fixes for minor compilation errors) 4 years ago
Stephen Shelton fd230dd93b
<3 apple 4 years ago
Stephen Shelton 6e1a23cdc7
Use pkg_check_modules instead of find_package for sqlite3 4 years ago
Stephen Shelton 0ecdda7a89
make format 4 years ago
Stephen Shelton 8628212269
<3 jsonnet 4 years ago
Stephen Shelton 4aa6f8e2df
Use find_package() for sqlite3 4 years ago
Stephen Shelton aeb0c2be3a
Remove ability to stop routers from gossiping for now 4 years ago
Stephen Shelton bdac43e19f
Peer stats test which artificially stops a router from gossiping its RC 4 years ago
Stephen Shelton 63f41d6a98
Introduce mutex for hive's routers 4 years ago
Stephen Shelton 3b6f84c68c
Peek at peer stats db in test_peer_stats 4 years ago
Stephen Shelton c4cbbd6731
RouterHive: store router contexts by routerId instead of index 4 years ago
Stephen Shelton d1b629f494
RouterHive ConnectionAttemptEvent 4 years ago
Stephen Shelton d69d538f1a
Add missing files 4 years ago
Stephen Shelton b2a72dd46a
Initial test_peer_stats hive test 4 years ago
Stephen Shelton 2453fff10b
Piggyback on link callbacks to add peer stats 4 years ago
Stephen Shelton cb8e5354f5
Add some breadcrumbs about how ILinkLayer's callbacks are used 4 years ago
Stephen Shelton c9faddc8e4
Use fs::path since mac doesn't support std::filesystem 4 years ago
Stephen Shelton 5a8f390b3b
Make mutex mutable, fix typo 4 years ago
Stephen Shelton 023e061146
Make [router]:enable-peer-stats only valid for client 4 years ago
Stephen Shelton 54017652d6
log-- 4 years ago
Stephen Shelton d897099e1d
Track traffic peerstats 4 years ago
Stephen Shelton 77b98459dd
Implement RouterID serialization in sqlite_orm 4 years ago
Stephen Shelton a9ce319e76
Make llarp_time_t serializable in sqlite_orm 4 years ago
Stephen Shelton aa1c8f257f
Sort out peerstats receive <-> expiry windows 4 years ago
Stephen Shelton 4b4284ccf4
PeerDb sqlite optimizations 4 years ago
Stephen Shelton 5e05defc76
Add API query for peer stats, other related fixes 4 years ago
Stephen Shelton 595288e046
Add PeerDb::handleGossipedRC 4 years ago
Stephen Shelton 7109ddc951
Add PeerDb::modifyPeerStats() 4 years ago
Stephen Shelton 4f4192e272
constexpr 4 years ago
Stephen Shelton 2a30e7dac2
Add PeerDb to Router 4 years ago
Stephen Shelton cc6e9c882a
Use foo.snode as peerstats unique id, test file-backed db 4 years ago
Stephen Shelton a30806b375
Some sqlite_orm related fixes 4 years ago
Stephen Shelton 98171aad36
Add libsqlite3-dev to drone 4 years ago
Stephen Shelton 8adb6295fc
Initialize sqlite_orm and start interacting with it 4 years ago
Stephen Shelton 73c9ddff52
Begin peer stats infrastructure 4 years ago
Jeff 352cc12780
Merge pull request #1306 from majestrate/integrate-lmq-2020-05-19
LokiMQ
4 years ago
Jeff Becker 2c0c6aa819
log error instead of executing job 4 years ago
Jeff Becker d7ff6c579c
address feedback from jason
* split up ipv6 netmask
* revert iwp ack interval change
* c++17-isms in ip range map
* lambda-ize nodedb
* mutable lambdas in transit hops
* perfect forwarding of args in abstract router
* mutable lambdas in lokid rpc client
* notes in readme about nproc
4 years ago
Jeff Becker 26f62bc260
make pybind compile 4 years ago
Jeff Becker d85c7bc628
remove wrapper and just use a lambda that throws on non empty value 4 years ago
Jeff Becker a0dc2e795c
add a wrapper that always throws with a custom error message
use that wrapper for lokid.jsonrpc
4 years ago
Jeff Becker a9109aa91b
* deprecate old unused lokid rpc options
* use lokimq::address in config and in lokid rpc
* bump lokimq submodule
4 years ago
Jeff Becker 80919a3b76
address feedback.
* use exceptions when fetching identity key instead of std::optional, will throw on fail
* fix up config options for endpoint auth and add better docs
* add llarp::serive::AuthType enum for controlling what kind of endpoint auth to use
4 years ago
Jason Rhinelander a7c42ab2bd
Use lokimq's hex/base32z encoding/decoding 4 years ago
Jason Rhinelander 271ded7a1f
Fix test variable scope
These variables need to persist past the end of the lambda and weren't;
release builds didn't seem to mind access the freed memory, but Debug
builds triggered failures.
4 years ago
Jason Rhinelander 3dff5931a2
Use imaginary repo for sodium on bionic/arm64
Building both sodium + libzmq is kind of a pain, so just use the
backport libsodium from the loki repo on deb.imaginary.stream.
4 years ago
Jeff Becker 8772c05a13
revert download libsodium target name change 4 years ago
Jeff Becker 2737cd6f98
remove FindSodium.cmake and use the cmake incantations from loki-core for setting sodium target up 4 years ago
Jeff Becker c6bd0afe96
move sodium cmake target about so that it is detected earlier 4 years ago
Jeff Becker 8fc52fcbbe
increase test timeout 4 years ago
Jeff Becker 9f7ac7a9a3
apply patch 4 years ago
Jeff Becker e85efcf7ce
move include so it's included on all platforms including windows 4 years ago
Jeff Becker c2f9c46686
zmq requires win xp or higher. 4 years ago
Jeff Becker 92bb135a73
only bump loki-mq submodule 4 years ago
Jeff Becker c9a2222d39
Revert "bump submodules"
This reverts commit 0de2b994fa3e3252eae46d39960dd17872184050.
4 years ago
Jeff Becker 00aa78c80a
it's safe to call reply from another thread because all it does is fufill a promoise 4 years ago
Jeff Becker 0f21eeccb0
* rework exit codepath to allow multiple exits
* rework net code for ip ranges to be cleaner
* clean up endpoint auth code
* refactor config to validate network configs before setting up endpoints
* remove buildone from path/pathbuilder.cpp so we don't spam connection attempts
4 years ago
Jeff Becker 2ef2e6171a
bump submodules 4 years ago
Jeff Becker eb0f29223a
add docs to gdb-filter.py
turn off thread logging in gdb
make sure everything runs in gdb when running test
add note in contrib/format.sh about a GNU-ism
4 years ago
Jeff Becker 3cdca30a74
more auth shit 4 years ago
Jeff Becker 0d6e3bcd89
fix crashing tests 4 years ago
Jeff Becker 0787b6e2fd
load config differently for unit tests because they run as root in CI for some reason 4 years ago
Jeff Becker 98a3b45f16
disable logging to see why ci tests die like a sucka 4 years ago
Jeff Becker 63b56d55a9
check pw and pw_dir to be not null so that if either are null it bails to else block 4 years ago
Jeff Becker 2371e416bd
dont use $HOME when checking for default data dir 4 years ago
Jeff Becker b6a7b5ccfb
only run catch2 tests in gdb and add assert to unit test 4 years ago
Jeff Becker 1ac7da294f
use bt full 4 years ago
Jeff Becker 52bc2facc2
add gdb to ci runners on debian to catch backtraces if they happen 4 years ago
Jeff Becker fc08f92425
move lokimq cmake code 4 years ago
Jeff Becker e13e886df9
fix up event loop crap so that unit tests pass 4 years ago
Jeff Becker 5c039233db
remove the dreaded makefile and update docs 4 years ago
Jeff Becker 456f9d4ba1
remove GNU-ism 4 years ago
Jeff Becker 0a889d7042
fix up iwp unit test 4 years ago
Jeff Becker e95b9d530e
fix unit tests, make them pass 4 years ago
Jeff Becker 1779f33506
fix makefile fromat target
use lokimq::address instead of std::string or std::string_view
4 years ago
Jeff Becker ca9e015ca4
virtual destructor 4 years ago
Jeff Becker 397d558af8
wtf 4 years ago
Jeff Becker 59eb1b0842
make format 4 years ago
Jeff Becker f1e7fc2cba
make format and update submodule 4 years ago
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 4 years ago
Jeff Becker 30b158b906
update submodule 4 years ago
Jeff Becker 5abf111159
endpoint auth whitelist 4 years ago
Jeff Becker 9f11b03016
enable exit node again 4 years ago
Jeff Becker a42d3d51c3
more 4 years ago
Jeff Becker 1e8368b636
make it compile 4 years ago
Jeff Becker 61c5808765
exit authentication (initial) 4 years ago
Jeff Becker be01808a6b
more 4 years ago
Jeff Becker c5dbb670ca
set sane defaults for config, implement lmq rpc server, update lokinetmon 4 years ago
Jeff Becker 970cdf212b
fix up cmake cruft 4 years ago
Jeff Becker 6bbf7beaf5
add stubs for lmq rpc server 4 years ago
Jeff Becker 7003eda305
add FindLokiMQ.cmake for finding lokimq package 4 years ago
Jeff Becker 1175a583d2
initial working code 4 years ago
Stephen Shelton 13b0a4f2fc
WIP: LokidRpcClient 4 years ago
Stephen Shelton ca9214f50f
Add loki-mq as submodule 4 years ago
Jeff Becker 9bfff61d08
initial wack at lokimq 4 years ago
Stephen Shelton fd4b03f896
WIP: LokidRpcClient 4 years ago
Stephen Shelton 17026a0b21
Remove libabyss and rpc::Caller/rpc::Server 4 years ago
Stephen Shelton 0c0deb0656
Add loki-mq as submodule 4 years ago
Jeff Becker 749c5a813c
require at least 2 hops because otherwise stuff wont publish 4 years ago
Jeff Becker d5b4dbe052
more 4 years ago
Jeff Becker b1259e25c5
set sane defaults for config, implement lmq rpc server, update lokinetmon 4 years ago
Jeff Becker 31304dbd9f
fix up cmake cruft 4 years ago
Jeff Becker fb8b8e2e56
add stubs for lmq rpc server 4 years ago
Jeff Becker 520e472bcd
add FindLokiMQ.cmake for finding lokimq package 4 years ago
Jeff Becker ad882d0d70
initial working code 4 years ago
Stephen Shelton 78256e3228
WIP: LokidRpcClient 4 years ago
Stephen Shelton a7dceed4eb
Remove libabyss and rpc::Caller/rpc::Server 4 years ago
Stephen Shelton 7bfd8cdbc9
Add loki-mq as submodule 4 years ago
Jeff Becker 0006751d80
initial wack at lokimq 4 years ago
Stephen Shelton 91725a8530
WIP: LokidRpcClient 4 years ago
Stephen Shelton 11951510bf
Remove libabyss and rpc::Caller/rpc::Server 4 years ago
Stephen Shelton c67db46b12
Add loki-mq as submodule 4 years ago
Jeff c316bf306d
Merge pull request #1314 from notlesh/rip-c-api-2020-06-29
Remove [most of] C API
4 years ago
Stephen Shelton 0aa43c6b07
Pass RuntimeOptions instead of 'bool isRelay' 4 years ago
Stephen Shelton 984015587d
"Rethrow" to promise using std::current_exception() 4 years ago
Stephen Shelton a448cbab4f
Pass on exceptions to exit_code future in main 4 years ago
Stephen Shelton eb2260179f
Pass opts by value since we're crossing threads 4 years ago
Stephen Shelton daecd6eda5
Remove llarp_config and llarp_main 4 years ago
Stephen Shelton d85e48c9d0
Use llarp::Context::CallSafe() for vpn AsyncClose() 4 years ago
Stephen Shelton ba92d12203
Remove TODO comment 4 years ago
Stephen Shelton ec4109ae60
Handle signals without C API 4 years ago
Stephen Shelton b5d6a73ffd
Rip out most of C API 4 years ago
Jeff 4501dd8e0b
Merge pull request #1311 from majestrate/windows-ci-fix-upload-2020-06-17
update ci to use zip for windows
4 years ago
Jason Rhinelander e2ad0e8f09 DRY out ci upload script 4 years ago
Jeff Becker d096f5375f
pass in WINDOWS_BUILD_NAME to uploader to mark 64bit and 32bit builds distinctly 4 years ago
Jeff Becker ad0b66ae02
use correct arch, probably 4 years ago
Jeff Becker 8f3f964ee6
change to i686 4 years ago
Jeff Becker 3b59288a42
fix typo 4 years ago
Jeff Becker 3860352a9a
set arch to be 32bit for 32bit windows builds so build artifacts are marked as such 4 years ago
Jeff Becker c323025722
set windows ci build output to include arch 4 years ago
Jeff Becker 809198636b
chmod +x the script 4 years ago
Jeff Becker 1b10e69b10
update ci to use zip for windows 4 years ago
Jeff 4026051d36
add xz in drone ci because alpine sucks 4 years ago
Jeff 7afa852d96
Merge pull request #1307 from tewinget/libunbound-upstream-dns
Implement upstream DNS using libunbound
4 years ago
Jeff Becker 52b5da33a3
fix dep 4 years ago
Jeff Becker 0dad53100a
add bash and sftp so exe uploads werk 4 years ago
Jeff Becker a9de1ad277
fix typo 4 years ago
Jeff Becker c66e925fb2
add more cmake incantations for windows cross compile 4 years ago
Jeff Becker fdfdd2a1d2
turn off lto, add patches 4 years ago
Jeff Becker db3d43a513
fix typo 4 years ago
Jeff Becker 26a2f54b0b
set ar and ranlib on openssl cross compile to appease the cmake god 4 years ago
Jeff Becker ba1265d94f
set ARCH_TRIPLET to CROSS_TARGET to please the cmake cross compile god 4 years ago
Jeff Becker 48c7d6fbe5
consolidate windows ci drone jizz 4 years ago
Jeff Becker 2e806cc145
set CMAKE_CROSSCOMPILE to on so we are cross compiling in ci 4 years ago
Thomas Winget 9905a2bd4b static build flag for win/mac static builds in drone config 4 years ago
Jason Rhinelander cdd57ac09b fix unbound ssl linking 4 years ago
Thomas Winget 0ecdf60777 static build fixes in cmake stuff
I hate cmake so much.
4 years ago
Thomas Winget 32843510bb libunbound can now be built as a static dep 4 years ago
Thomas Winget 8f0330c9f2 std::vector instead of std::array 4 years ago
Thomas Winget b875d40491 restructure how upstream dns replies are handled
llarp::dns::Message does not fully support DNS packets,
so converting the upstream response to one will not work
for all query types.  Also it is kinda silly to begin with,
as the upstream reply is already a network packet, ready to go.
4 years ago
Thomas Winget 755b4d89b6 libunbound deps in drone config 3: dependency boogaloo 4 years ago
Thomas Winget 4ee95d4ad0 libunbound deps in drone config...watch *them* have deps too 4 years ago
Thomas Winget 221e9ff5de make format 4 years ago
Thomas Winget f58c7df54d add libunbound-dev dep to drone config 4 years ago
Thomas Winget df284cb757 proper CMake finding and using of libunbound 4 years ago
Thomas Winget c2a30692cf Implement upstream DNS using libunbound 4 years ago
Jeff b6817646f6
Merge pull request #1310 from tewinget/static-build-changes
add functionality to download and build static libs
4 years ago
Thomas Winget 926d306443 add functionality to download and build static libs
The libs with rules already set up in StaticBuild.cmake are dependencies
which will be introduced in following commits.
4 years ago
Jeff 36bb43d14a
Merge pull request #1278 from despair86/dev
fix win32 build rules and add to drone ci
4 years ago
Rick V dc52f8c2fe remove stray path separator 4 years ago
Rick V b2fcf6c896 sodium requires stack protection on windows (-D_FORTIFY_SOURCE works
now!)
4 years ago
Rick V 2fe4c15792 why jeff why 4 years ago
Rick V 2efc884acf 64-bit LTO cursed for ages 4 years ago
Rick V a787db9b35 fix ipv4_hdr 4 years ago
Rick V 6d5155def4
jeff pls 4 years ago
Rick V 052bc25c4f
install make 4 years ago
Rick V 1f5df55443
don't use builtin patch 4 years ago
Rick V e43869d9a2
FUWAS 4 years ago
Rick V 8ac5213b42
windows builds on alpine lunix 4 years ago
Linux User e6bcbf47b4
patch libsodium for windows the cmake way 4 years ago
Rick V adf253e800
picflags differ slightly on native vs wow64 builds 4 years ago
Rick V 45890133bc
LIBUV_ROOT override for win32
emit PIC code (.reloc) on win32 for aslr
4 years ago
Jeff f8bec34f80
Merge pull request #1309 from jagerman/drone-submodules-step
Add tags/submodules as separate step
4 years ago
Jason Rhinelander f4b4e4799f Add tags/submodules as separate step
Drone's initial clone doesn't include tags or submodules; add a step to
fetch both (rather than doing this in the build step).
4 years ago
Jeff 0d2572d94d
Merge pull request #1308 from jagerman/drone-typo
Fix static distro drone typo in description
4 years ago
Jason Rhinelander b3f38883b8 Fix static distro drone typo
Static build runs on bionic, not focal.
4 years ago
Jason Rhinelander 1131ad9902
Merge pull request #1305 from jagerman/processor-count
Get processor count properly
4 years ago
Jeff 6ff828be13
Merge pull request #1304 from jagerman/cmake-modernize-ccache
Modernize how we set up ccache
4 years ago
Jason Rhinelander 83fc7de237 Get processor count properly 4 years ago
Jason Rhinelander d24feacae0 Modernize how we set up ccache
CMAKE_<LANG>_COMPILER_LAUNCHER was added around cmake 3.4 and, usefully,
can be enabled/disabled via cmake invocation flags (unlike the older
RULE_LAUNCH_COMPILE property).
4 years ago
Jeff e25500f091
Merge pull request #1302 from majestrate/pybind11-log-silencer-2020-06-08
add pybind to CI
4 years ago
Jeff Becker 6984cda3a6
add pybind and router hive to ci 4 years ago
Jeff dc71a5c018
Merge pull request #1301 from majestrate/ensure-key-backup-bug-squashed-2020-06-08
add regression test for key backup bug
4 years ago
Jeff Becker b8e1ffa83e
add comments and improve the regression test 4 years ago
Jeff Becker 3358a3371e
restore correct logstream 4 years ago
Jeff Becker 3d2990f90d
use llarp::LogSilencer to shut up loging in unit tests 4 years ago
Jeff Becker a73335579a
silence logging in regression test 4 years ago
Jeff Becker 800668348a
add regression test for key backup bug 4 years ago
Jeff ff5091c4b4
Merge pull request #1300 from majestrate/more-unfug-transit-hops-2020-06-04
unfug transit hops (again)
4 years ago
Jeff Becker 019168fef0
remove unused local variable 4 years ago
Jeff Becker 1899debfb5
unfug transit hops 4 years ago
Jeff f41d7d2d7f
Merge pull request #1299 from notlesh/rc-for-clients-2020-06-04
Better fix for client RC construction
4 years ago
Stephen Shelton 193060d602
Undo client-related changes to RC creation
This partially reverts changes from
1497b829bd and intsead only prevents
clients from saving their RC to disk.
4 years ago
Jeff 098df580e8
Merge pull request #1298 from majestrate/unfug-transit-hops-2020-06-04
Unfug transit hops
4 years ago
Jeff 8384cb7847
Merge pull request #1297 from notlesh/dont-touch-rc-if-client-2020-06-04
Dont touch self.signed if client
4 years ago
Jeff Becker 9fb681eb7c
typo 4 years ago
Jeff Becker fe1dae8f30
fix transit hop job queuing 4 years ago
Stephen Shelton 980853804d
Remove log statement 4 years ago
Stephen Shelton cecafb3215
Undo unintentional revert? 4 years ago
Stephen Shelton 43ffe23f66
Remove obnoxious log statement 4 years ago
Stephen Shelton d8b12ce764
Let KeyManager assemble key filenames 4 years ago
Stephen Shelton 1497b829bd
Ignore our self.signed file if we're a client 4 years ago
Jeff bb14b44bcf
Merge pull request #1296 from majestrate/fix-one-hop-path-building-2020-06-02
fix one hop mode path builds
4 years ago
Jeff Becker ac26037c34
when in 1 hop mode we where hitting a case where we were failing to build paths
this was because we were trying to diversify the endpoints used which is not
appicable in 1 hop mode because first hops are sticky.
4 years ago
Jeff ed0f7ebe73
Merge pull request #1295 from notlesh/shared-from-this-sanity-checks-2020-06-01
Sanity checks around shared_from_this()
4 years ago
Stephen Shelton 91a2af0eda
Sanity checks around shared_from_this() 4 years ago
Jeff 45cda241f0
Merge pull request #1272 from majestrate/exit-nodes-2020-05-16
exit traffic via snapps
4 years ago
Jeff Becker f40ffc0fd6
simplify header for tom. 4 years ago
Jeff Becker 95e55a2544
consistent spelling and use std::max 4 years ago
Jeff Becker c6885ec285
remove Endpoint::GetExitRouters() 4 years ago
Jeff Becker 44c790b65c
revert back to for loop for simplicity 4 years ago
Jeff Becker acecb23eb3
make libuv event loop logic queue size configurable.
remove logic constructor that is no-op.
add constant for default logic queue size
add constant for transit hop queue size
4 years ago
Jeff Becker 8a003a1144
add lokinet-vpn systemd service file 4 years ago
Jeff Becker 18b2ef3d1e
remove unneeded file 4 years ago
Jeff Becker 242ab3caba
rename lokinet-exit too to lokinet-vpn
install lokinet-vpn tool for use with debian packaging
4 years ago
Jeff 0f05ecb0f9
Merge pull request #1281 from despair86/string-fix
fix wstring path conversions
4 years ago
Rick V 1340cd0dce remove some string conversions entirely 4 years ago
Rick V 5529371637 RouterContact::[Read|Write] now take a fs::path const ref 4 years ago
Rick V f62214cf8c
first pass fix wstring path conversions 4 years ago
Jeff Becker c47a210302
remove a std::move that prevents copy elision 4 years ago
Jeff Becker dd87cd396b
pedantic change to retrigger ci 4 years ago
Jeff Becker 14b134c42d
when we get an explicit config path respect it and the base dir 4 years ago
Jeff Becker b572e7a7cd
add lokinet-exit.py script 4 years ago
Jeff Becker f25e9bb01f
use std::list here too 4 years ago
Jeff Becker db00d080f6
use std::list instead of std::vector because idfk man 4 years ago
Jeff Becker 9298313066
use std::move 4 years ago
Jeff Becker 96cbab33c3
style: put iterator erase in for loop update 4 years ago
Jeff Becker 44ff3a9928
copy assignment so we don't crash 4 years ago
Jeff Becker 149a01c80f
dont use std::bind, use lambda 4 years ago
Jeff Becker 403bc74493
unbreak unit tests 4 years ago
Jeff Becker f0eca908a4
use static_assert instead 4 years ago
Jeff Becker 4ad8ae253d
align to either 64bit or max_align_t which ever is smaller, for 32 bit. 4 years ago
Jeff Becker 7a5c193e4f
remove unused member 4 years ago
Jeff Becker 25a4bbd5ca
use std::swap 4 years ago
Jeff Becker 4a378ae934
remove logic thread from logic as it is now a thin wrapper arround the event loop 4 years ago
Jeff Becker eb0abbf1ff
add eraseif to decaying hashset 4 years ago
Jeff Becker 39f8f17b53
dont set callback if non provided 4 years ago
Jeff Becker 1230b81517
make format 4 years ago
Jeff Becker b8da447053
use const iterators explicitly 4 years ago
Jeff Becker b8d262573a
use std::vector instead of thrashing heap with allocation 4 years ago
Jeff Becker e9d1a61053
don't recover from sanitizer errors 4 years ago
Jeff Becker fbb7c0d6f9
add forgotten file 4 years ago
Jeff Becker 328c7a398e
make sure event loop owns logic so that logic call does not use seperate thread 4 years ago
Jeff Becker c826d0a0b1
increase transit hop limits 4 years ago
Jeff Becker 3a776b3ed1
bounds checks and such 4 years ago
Jeff Becker a45f92dca7
use random good path for outbound traffic so that it uses an even spread accross
all paths
4 years ago
Jeff Becker 382e4215a8
path testing interval increase to reduce bandwidth use 4 years ago
Jeff Becker 00143e63f4
put replay filters on transit hops to reduce retransmissions. 4 years ago
Jeff Becker 114bdd5ce5
add move and copy constructors/assigment operators to ip_address 4 years ago
Jeff Becker 3eb006f78c
iwp/libuv cleanup: remove llarp_pkt_list and all users of it as it's broke 4 years ago
Jeff Becker 6af498092b
exit traffic via loki addresses 4 years ago
Jeff 1884d17e9d
Merge pull request #1290 from jagerman/deb-ci-snapshots
Drone static build and deb uploads
4 years ago
Jason Rhinelander 8851766c5d macos static build & upload 4 years ago
Jason Rhinelander a484ccffc2 static curl build fixes
- fix ldap disabling flag
- disable a ton of protocols (include ldap, properly)
- remove INSTALL_COMMAND (the default seems to work fine)
- disable --quiet so we can see the configuration summary
4 years ago
Jason Rhinelander cf447dc3a4 Build (and upload) debs by merging into the deb branches
Similar to the static files, the debs also end up under
builds.lokinet.dev/deb.
4 years ago
Jason Rhinelander f54beadaa9 Add tar+upload to builds.lokinet.dev of static build
Relies on an SSH_KEY secret being set in the repository.

Also move the linked library check to a bash script because escaping a
value in jsonnet (escape once) that gets passed through yaml (escape
twice) and then bash (escape again) is too painful.
4 years ago
Jason Rhinelander 861f83c9cc drone tweaks
- add some comments
- exclude commits to the debian/ubuntu branches from getting built
- disable "Updating man-db" which chews up several seconds during
package install
4 years ago
Jeff 437895ca36
Merge pull request #1289 from jagerman/merge-master
Merge master
4 years ago
Jason Rhinelander 5b7d194ff1 Merge remote-tracking branch 'origin/master' into dev 4 years ago
Jeff 22830fe423
Merge pull request #1287 from loki-project/majestrate-patch-1
change ci badge to use drone
4 years ago
Jeff 636622afdb
Merge pull request #1288 from jagerman/remove-str-crutch
Remove llarp::str(string_view)
4 years ago
Jason Rhinelander 854619f04f Workaround for ghc::filesystem (mac) compatibility 4 years ago
Jason Rhinelander d05e6716cb Remove llarp::str(string_view)
It was a workaround for pre-C++17 std::string which didn't support
passing a string_view to various functions/operators.  There's only one
place left that needs an explicit conversion, and that's where it is
used as a map key; so just be explicit there and remove llarp::str()
everywhere else.
4 years ago
Jeff bad6974ee5
change ci badge to use drone 4 years ago
Jeff d35b246d28
Merge pull request #1286 from jagerman/fix-links-output
Fix the static build linked libs output check
4 years ago
Jason Rhinelander 9e1e11825e Fix the static build linked libs output check
- The `grep` had a typo of `-e` instead of `-E` which made it not work

- Made the command actually fail the pipeline if unwanted linked libs
were found.

- Print in green if everything is okay.

- Add librt.so to the whitelist
4 years ago
Jason Rhinelander 7d5a99d820
Merge pull request #1284 from majestrate/toggle-lto-2020-05-20
add WITH_LTO option to disble lto on compile time
4 years ago
Jeff b885f924e8
Merge pull request #1285 from jagerman/bye-bye-travis-ci
Remove travis-ci
4 years ago
Jason Rhinelander 11342b1d9f Remove travis-ci
We don't have much left there that works -- the one useful build (s390x)
errors out with a no available disk space error, so just give up on it.
4 years ago
Jeff 639432c678
Merge pull request #1282 from jagerman/drone-macos
Bunch of crap for macOS
4 years ago
Jason Rhinelander e4e6fc205e Disable lto for most linux builds
Keeps it on for the first three (sid/release, sid/debug, and clang) and
turns them off for the rest.
4 years ago
Jeff Becker a6d17dcd16
add WITH_LTO option to disble lto on compile time 4 years ago
Jason Rhinelander ab02519a40 Add missing quote to static build linked libs test 4 years ago
Jason Rhinelander 3bb24580a4 make format 4 years ago
Jason Rhinelander a2d46eda1e Colour diff; print error *after* diff, and make it red 4 years ago
Jason Rhinelander 1d11456d26 Move specify CLICOLOR_FORCE=1 to the drone backend 4 years ago
Jason Rhinelander ebd2142114 Don't use std::optional::value() because f u macos
This replaces all use of std::optional's `opt.value()` with `*opt`
because macOS is great and the ghost of Steve Jobs says that actually
supporting std::optional's value() method is not for chumps before macOS
10.14.  So don't use it because Apple is great.

Pretty much all of our use of it actually is done better with operator*
anyway (since operator* doesn't do a check that the optional has a
value).

Also replaced *most* of the `has_value()` calls with direct bool
context, except for one in the config section which looked really
confusing at a glance without a has_value().
4 years ago
Jason Rhinelander 7f9160bb6e Untangle some interdependencies
macOS doing a shared library build is not working without untangling
some of the interdependencies.  This commit does that, at least enough
to get macOS to compile.

This isn't the cleanest as currently implemented (we have some net/
things in `liblokinet-platform` and some in `liblokinet`, and likewise
ev/vpnio.cpp is in `liblokinet` while the rest of `ev/*` is in
`liblokinet-platform`).
4 years ago
Jason Rhinelander 97088719e0 Avoid reserved __identifiers
Identifier names with `__` in them are reserved for the implementation.
One leading underscore followed by a lower-case letter is fine though
(leading underscore followed by *upper*-case is, however, also
reserved).
4 years ago
Jason Rhinelander 60d704b25d Remove dead code 4 years ago
Jason Rhinelander f9bbc30c3d IsIPv4Bogon: constexpr array instead of a function-local static vector
The fixed-size array + not needing to do an atomic operation in the
function should allow better compiler optimization.

(And with C++17 the type and size are inferred).
4 years ago
Jason Rhinelander bdc9c7bfa8 Move IPRange out of net.hpp; free up TruncateV6 etc.
- Move IPRange into its own net/ip_range.hpp

- Move the static net::IPPacket::TruncateV6, etc. functions to free
net::TruncateV6, etc. functions (now from net/ip.hpp instead of
net/ip_packet.hpp).

- Make net::TruncateV6 and net::ExpandV4 constexpr.

- Add IPRange::FromIPv4 factory function (to replace the iprange_ipv4
free function)
4 years ago
Jason Rhinelander 72bf215da4 Move IPPacket header (part 1)
Rename net/ip.{cpp,hpp} to net/ip_packet.{cpp,hpp}.

(Doing this in two commits because I want to repurpose ip.hpp/ip.cpp,
and want git to figure out the history properly).
4 years ago
Jason Rhinelander be9ddf2ae1 Bring back ghc::filesystem for broke AF macos
macOS doesn't provide `<filesystem>` support when targetting anything
earlier than 10.15.
4 years ago
Jason Rhinelander 4d34ee82c9 Move Catalina build to drone (on lokinet-mini) 4 years ago
Jason Rhinelander 7cb542ea23
Merge pull request #1274 from notlesh/fix-keymanager-test-2020-05-18
Fix various unit tests
4 years ago
Stephen Shelton ffdeca5378
Initialize all primitive values in Config 4 years ago
Stephen Shelton 807bfc5302
Initialize Config with LoadConfig in all key manager tests 4 years ago
Stephen Shelton fa6845b206
Use global RC file paths instead of redefining them 4 years ago
Stephen Shelton ac225eb65e
Testing: explicitly initialize variable 4 years ago
Stephen Shelton 7167b4ad02
Properly initialize config in unit test 4 years ago
Jeff a43bdef27c
Merge pull request #1280 from jagerman/gcc10
Add gcc-10 build
4 years ago
Jason Rhinelander b1281cd9d3 Add gcc-10 build
This is temporary (until the `g++` metapackage switches from gcc 9 to
gcc 10).
4 years ago
Jason Rhinelander 110fbe14c9
Merge pull request #1279 from jagerman/curl-fix
Fix cmake curl definition
4 years ago
Jason Rhinelander 604501b07f Fix cmake curl definition 4 years ago
Jeff abc127a78a
Merge pull request #1276 from despair86/sockaddr-fix
fix sockaddr on win32
4 years ago
Rick V 918a09c0cf fix sockaddr win32 and collapse headers on the unix side 4 years ago
Jason Rhinelander cc5e8787c5
Merge pull request #1275 from jagerman/curl-win32-fix
Only link curl if we set up a curl target
4 years ago
Jason Rhinelander 28362fd6a6 Clean up curl define
It doesn't have to be win32-specific, we could (for example) use this on
mac as well to build without curl/SN support.
4 years ago
Jason Rhinelander 856cf82c0e Only link curl if we set up a curl target
Should fix win32 (which doesn't link to curl).
4 years ago
Jeff 759c0e6f31
Merge pull request #1273 from jagerman/drone
Drone CI + cmake + fixes
4 years ago
Jason Rhinelander a82b83119e Remove travis-ci builds now handled via drone 4 years ago
Jason Rhinelander 7f8698ce44 Add several drone ci builds 4 years ago
Jason Rhinelander 5e91c946c5 AVX code: move stub into separate file; always check -mavx2/-mfma
This simplifies the build a bit by moving the avx stubs into a single .c
file: we can avoid compiling all of the avx2 code and just add a single
stub file instead when the compiler doesn't have -mavx2/-mfma.

This also simplifies cmake to just always test the flags; there are some
cases (like using NATIVE_BUILD) where USE_AVX2 doesn't necessarily
apply, and it's cheap to just check them.
4 years ago
Jason Rhinelander b4fce0e3ee curl: use ccache; disabled lots of other crap
brotli and libpsl both got autodetected on my system, so explicitly
disable them (and a bunch of other crap from --configure).

Build with ccache.
4 years ago
Jason Rhinelander fa794e64cd Build libsodium with ccache and fPIC
fPIC is needed in case we are building a shared liblokinet (within which
we want the static libsodium).
4 years ago
Jason Rhinelander c5faa86926 cmake refactor
Refactors many things in cmake to improve and simplify:

- don't use variable indirection for target names; target names are
*already* a variable of sorts.  (e.g. ${UTIL_LIB} is now just
lokinet-util).  cmake/basic_definitions.cmake is now gone.

- fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather
than shoving a bunch of flag hacks through link_libraries and
add_compile_options.  This also now enables LTO when building a shared
library (because previously the -flto hacks were only turned on in the
static code for some reason).

- build liblokinet as *either* shared library or static library, but not
both.  Building both makes things more complicated because they had
different names (lokinet-shared or lokinet-static) and seems pointless:
you generally want one or the other.  Now there is just the liblokinet
target, which will be shared or static depending on the value of
BUILD_SHARED_LIBS.

- Simplify lokinet-cryptography AVX2 code: just build *one* library, and
add in the additional AVX2 files when possible, rather than building two
and needing to merge them.

- Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK.
It makes no sense to use one of these (_RUNTIME) on Windows and the
other on non-Windows when they appear to try to do the same thing.

- remove a bunch of annotations from `endif(FOO)` -> `endif()`.

- move all the tuntap compilation code (including OS-specific source
file selection) into vendor/CMakeLists.txt and build tuntap as an
intermediate OBJECT library rather than keeping a global variable in 5
different files.

- move release motto define to root cmake; it made no sense being
duplicated in both unix.cmake and win32.cmake

- fix add_log_tag to not stomp on any existing source compile flags with
its definition.  Also use proper compile definition property instead of
cramming it into compile flags.

- make optimization/linker flags less hacky.  There's no reason for us
to force particular optimization flags because the cmake build type
already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3).  Not doing
that also silences a bunch of cmake warnings because it thinks "-O0 -g3"
etc.  are link libraries (which is reasonable: that's what the code was
telling cmake they are).

- sets the default build type to RelWithDebInfo which gives us `-O2 -g`
if you don't specify a build type.

- Move PIC up (so that the things loaded in unix.cmake, notably libuv,
have it set).

- Add a custom `curl` interface library that carries the correct link
target and include paths for curl (system or bundled).
4 years ago
Jason Rhinelander ab4ee954b9 Remove DEBIAN option
This hasn't been used in a long time; the debian packaging lives in
separate branches instead.
4 years ago
Jason Rhinelander a45bec7c4f Removed RPI definition
This was a long-obsolete fix for things that don't matter anymore.
4 years ago
Jason Rhinelander 26ecf23ad8 Silence various warnings 4 years ago
Jason Rhinelander e03dfc751c Remove crypto_noop
It isn't used anywhere, and has bitrotted (it is marked final, but is
missing some required abstract method instances).
4 years ago
Jason Rhinelander 5087ba2364 Regex fix 4 years ago
Jason Rhinelander bc4573c447 Disable empty string SockAddr throw test
The code intentionally no longer throws and handles this as a special
case (resulting in an empty SockAddr).
4 years ago
Jason Rhinelander 0de3a5f11d
Merge pull request #1231 from majestrate/libuv-cmake-submodule-2020-04-20
add libcurl and libuv to cmake out of makefile
4 years ago
Jeff Becker 06348ced47 fix typo in makefile 4 years ago
Jeff Becker bd19dd95e0 revert makefile and travis 4 years ago
Jeff Becker 701175a873 download sodium 4 years ago
Jeff Becker 8497c8b1d4 more travis tweaks 4 years ago
Jeff Becker 9bd537333b fix travis 4 years ago
Jeff Becker 64157d5d44 track libcurl and libuv with cmake, add libuv submodule 4 years ago
Jeff d0a3d6beae
Merge pull request #1270 from majestrate/gpl3-reliecense-2020-05-15
relicense to GPL3
4 years ago
Jeff cc9830e763
update license preamble
change license preamble to exclude control panel text
4 years ago
Jason Rhinelander d04576a2c6
Merge pull request #1269 from majestrate/make-unit-tests-pass-05-15-20
Make unit tests and CI pass
4 years ago
Jeff Becker fc5b28b66f
const correctness 4 years ago
Jeff Becker d91d9152de
change xcode versions in travis to try and make travis stop sucking 4 years ago
Jeff Becker 57a737290c
relicense to GPL3 4 years ago
Jeff Becker 04c542b03f
clean up makefile targets to remove some old unused ones 4 years ago
Jeff Becker 3ac2a3defa
add dist source tarball generation and bundle it with gitlab static release 4 years ago
Jeff Becker 6ea6a4bd25
use -dev package for python in travis 4 years ago
Jeff Becker 39b32a9ccc
move check for std::filesystem and std::optional down 4 years ago
Jeff Becker abc1f67430
check for std::optional as macos can be broke af sometimes 4 years ago
Jeff Becker 5a24d2deef
add check for std::filesystem 4 years ago
Jeff Becker 1072d9b505
detect travis using environmental vars 4 years ago
Jeff Becker e56faba23d
make format 4 years ago
Jeff Becker a7d616843f
add shitty check for running in travis with workarounds because god is dead and travis-ci fucking sucks. 4 years ago
Jeff Becker 1780e86faa
fix up unit tests, make them all pass 4 years ago
Jeff Becker f04407f183
use only 1 uv_async_t for event loop wakeups
flush logic calls in there too as this was causing unit tests to hang
4 years ago
Jeff ad9edc4ecf
Merge pull request #1266 from majestrate/issue-1264-fix-setting-upstream-dns-2020-05-14
default to port 53 in dns section entries
4 years ago
Jeff f7fbfc1b67
Merge pull request #1267 from majestrate/respect-keyfile-in-config-2020-05-14
keyfile was being initialized before being set by configure call.
4 years ago
Stephen Shelton ed31cdaacf
Cosmetic fixes 4 years ago
Jeff Becker 555b9721ce
keyfile was being initialized before being set by configure call.
this made it so that snapps always use ephemeral keys.
this fixes this.
4 years ago
Jeff Becker 09a356a8a4
dont use static local lambda 4 years ago
Jeff Becker edb5c9e873
keyfile was being initialized before being set by configure call.
this made it so that snapps always use ephemeral keys.
this fixes this.
4 years ago
Jeff Becker ebed21c392
DRY 4 years ago
Jeff Becker 3753dfbddb
IpAddresses in dns section config were not defaulting to port 53 when no port was provided.
Fixes #1264
4 years ago
Jeff 25125511e3
Merge pull request #1265 from jagerman/missmatch
Miss Match & ours/theirs
4 years ago
Jason Rhinelander 6686668b48 Annotate netid mismatch message with (theirs)/(ours)
Every time I see this I don't know which one is wrong.  This helps.
4 years ago
Jason Rhinelander dccc663f31 Miss Match demands her name be removed from the code
(i.e. fix speeling mistack: missmatch -> mismatch)
4 years ago
Jeff e6a85d7176
Merge pull request #1263 from jagerman/c++17-niceties
C++17 niceties
4 years ago
Jason Rhinelander e470a6d73e C++17 niceties
- class template argument deduction lets us write `std::unique_lock
  foo{mutex}` instead of `std::unique_lock<mutex_type> foo{mutex}` which
  makes the `unique_lock` and `shared_lock` functions unnecessary.

- Replace GNU-specific warn_unused_result attribute with C++17-standard
  [[nodiscard]]

- Remove pre-C++17 workaround code for fold expressions, void_t
4 years ago
Jeff a5b09c47e1
Merge pull request #1262 from notlesh/bandaids-for-sockaddr-refactor-2020-05-11
Bandaids for sockaddr refactor 2020 05 11
4 years ago
Stephen Shelton 4dd4327f36
IpAddress::toString() support for IPv6 4 years ago
Stephen Shelton 043f993e41
Return stream in operator<<(stream, IpAddress) 4 years ago
Stephen Shelton 0a40892867
Implement SockAddr operator<() and operator==() 4 years ago
Stephen Shelton 1c7d57f207
Don't forget to return 4 years ago
Stephen Shelton c0f58c8159
Properly read in ExitInfo's address 4 years ago
Stephen Shelton e85105e738
Implement SockAddr's operator<<ostream 4 years ago
Stephen Shelton dfe71309f1
Add to/from in6_addr to SockAddr 4 years ago
Stephen Shelton fd145d6eeb
Make FIXME throws uniquely identifiable 4 years ago
Stephen Shelton 839fb42ba4
Hard code RPC's expectedHostname to 'localhost' 4 years ago
Stephen Shelton 0cd5d7a060
Derp 4 years ago
Stephen Shelton cd44caccaf
Attempt to get this SockAddr refactor up and running 4 years ago
Stephen Shelton 174c9ec740
log-- 4 years ago
Stephen Shelton 78d09f2ae5
Support SockAddr in from sockaddr and friends 4 years ago
Stephen Shelton e944bcb28a
Unit tests and fixes for SockAddr::fromString() 4 years ago
Stephen Shelton 0b54087689
Begin implementing SockAddr 4 years ago
Stephen Shelton bcf473757d
Fix broken config-related test cases 4 years ago
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 4 years ago
Jeff 08a1b74c3b
Merge pull request #1258 from majestrate/fixup-router-hive-2020-05-06
unbreak router hive
4 years ago
Jeff Becker 01cc2c86bf
format 4 years ago
Jeff Becker 635dc4fe13
unbreak router hive
llarp/config/config.cpp:
respect [network]:type option

llarp/handlers/exit.cpp:
when [network]:type is null dont init tun interface

llarp/service/context.cpp:
respect [network]:type option
change endpoint name back to "default"

llarp/tooling/router_hive.cpp:
dont use LogicCall for obtaining RCs from underlying relays, it crashes the mainloop and it's probably safe to readonly access RCs.

pybind/common.hpp:
remove typecasters as we use C++17 now

pybind/llarp/config.cpp:
remove SnappConfig
wire up NetworkConfig

pybind/llarp/handlers/pyhandler.hpp:
remove SnappConfig from constructor

pybind/llarp/handlers/pyhandler.cpp:
update constructor implementation to match header

test/hive/hive.py:
remove broke endpoint related code
wire up null endpoint option using NetworkConfig
use index at 0 for relays and clients instead of 1
dont add a python endpoint to all clients
4 years ago
Jeff 8b23e7bcbf
Merge pull request #1259 from cathugger/patch-1
fix GenVersion.cmake
4 years ago
cathugger 0bb43d98c7
fix GenVersion.cmake
* rev-parse --short without any argument defaults to 8 chars
* truncation is absolutely moot here
* rev-list --abbrev-commit also uses 8 chars by default

because of length mismatch (COMMIT - 9 chars, TAGGEDCOMMIT - 8 chars) it always was mismatching them even when it should've been detecting that it's at release tag.
cut out explicit lengths and leave everything to use defaults, because they work (they both rely on the same core.abbrev setting so no length mismatch should happen).
4 years ago
Stephen Shelton 1cab83ad01
Expand upon IpAddress header, take in feedback 4 years ago
Stephen Shelton dff170712f
Gut Addr, replace with stubbed SockAddr and IpAddress 4 years ago
Jeff ed27d39817
Merge pull request #1256 from majestrate/set-network-section-2020-05-04
set network section
4 years ago
Jeff Becker 7e4fdc5b0e
check for zero address for bogons 4 years ago
Jeff Becker f1edca9fa1
additional cleanup of cruft 4 years ago
Jeff Becker c425355a6b
set data dir in in loadconfig too 4 years ago
Jeff Becker f307c25d3e
set datadir path when giving filename for config 4 years ago
Jeff Becker c4b5b641bb
default to default data dir given by params instead 4 years ago
Jeff Becker 1cbf50296c
only add endpoint for hidden service if not service node 4 years ago
Jeff Becker e33a1a2e0f
proper autodetect of ifname and ifaddr 4 years ago
Jeff Becker 6aa79b7ca9
set network section 4 years ago
Jason Rhinelander cd7fd1b6ad FIXME fix the FIXME 4 years ago
Jason Rhinelander 4f09090c58 Add [network]:enabled to ignored settings list
No one knows what this option does or did, but it is in some generated
config files.
4 years ago
Jason Rhinelander 1d98632fd3
Merge pull request #1254 from majestrate/network-ifaddr-ifname-2020-05-04
add ifname and ifaddr to network config parsing
4 years ago
Jeff Becker 96a6d81380
add ifname and ifaddr to network config parsing 4 years ago
Jason Rhinelander 4be7b2c8a5
Merge pull request #1253 from notlesh/better-config-error-messages-2020-05-04
Use more user-friendly error messages in config
4 years ago
Stephen Shelton f96fded525
Use more user-friendly error messages in config 4 years ago
Jeff e1632795c2
Merge pull request #1252 from notlesh/nonstd-to-std-2020-05-04
Nonstd to std 2020 05 04
4 years ago
Stephen Shelton 78eb0d976d
nonstd::optional -> std::optional 4 years ago
Jeff da8583a69d
Merge pull request #1246 from notlesh/snapp-config-cleanup-2020-04-24
Snapp config cleanup 2020 04 24
4 years ago
Jeff Becker 7c12347e80
upstream-dns -> upstream 4 years ago
Stephen Shelton 42a7bcd434
Less invasive fix for Addr 4 years ago
Stephen Shelton d3b248e004
Add test for broken Addr::from_char_array() 4 years ago
Stephen Shelton 5f0cbb4625
Don't forget to load your keys 4 years ago
Stephen Shelton 9ba0f117c7
Revert to previous "if hops > 0" logic in Configure() 4 years ago
Stephen Shelton 15918ff1c9
log-- 4 years ago
Stephen Shelton 960dc37c1f
Refactor TunEndpoint::Configure() (partially) 4 years ago
Stephen Shelton f2a26adcaa
Move all [endpoint] options to [network] 4 years ago
Stephen Shelton 559610ec94
Properly handle empty config default values 4 years ago
Stephen Shelton dd9ab0f1d5
Remove ability to have multiple endpoints/snodes from config 4 years ago
Stephen Shelton b7451b7632
Rip out tag, prefetch tags/addrs from Endpoint 4 years ago
Stephen Shelton 1d12e9d14e
Lokinet_INIT() is already checked in main(), so remove from config 4 years ago
Stephen Shelton 3198a8b139
Handle blacklist-snode validation in config 4 years ago
Stephen Shelton fde93ac02d
Don't take EndpointConfig by value 4 years ago
Stephen Shelton 2730491641
Remove NetworkConfig's freehand options 4 years ago
Stephen Shelton daf599b032
Update comment about ExitEndpoint config TODO 4 years ago
Stephen Shelton 2bc908cd40
Remove [dns]:local-dns in favor of [dns]:bind 4 years ago
Stephen Shelton 779658edd0
Refactor ExitEndpoint's config, mv dns ops from [network] to [dns] 4 years ago
Stephen Shelton 21ad442b55
Remove NetConfig_t 4 years ago
Stephen Shelton df01770466
Rename SnappConfig -> EndpointConfig 4 years ago
Stephen Shelton 93b35c92a7
Eradicate service::Config 4 years ago
Stephen Shelton cbd93fcb09
Find "-snapp" conf sections, add more snapp conf options 4 years ago
Jason Rhinelander d901943593
Merge pull request #1250 from jagerman/cpp17
C++17
4 years ago
Jason Rhinelander 3efaf9ff76 Add string header (reportedly needed for libc++) 4 years ago
Jason Rhinelander 5cf2126bb9 make format 4 years ago
Jason Rhinelander 1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
4 years ago
Jeff 5a2141bae8
Merge pull request #1248 from notlesh/config-fixes-2020-04-29
Config fixes 2020 04 29
4 years ago
Stephen Shelton f0f9b1abdd
Allow 0 as outbound port 4 years ago
Stephen Shelton f8439dab61
Misc aesthetic tweaks 4 years ago
Stephen Shelton 7d83611a0a
Default outbound port to 0, not 1090 4 years ago
Stephen Shelton c4de0f8493
Add more ignored config options 4 years ago
Stephen Shelton 517922e4c3
Reintroduce support for configurable key files 4 years ago
Stephen Shelton 5c6c7c7020
Expand on ConfigDefinition truthy/falsy unit test 4 years ago
Stephen Shelton 320564d792
Specialize ConfigOption for bool to accept "truthy" / "falsy" values 4 years ago
Stephen Shelton 331770b348
Add ability to tolerate (ignore) old config options
This allows us to explicitly ignore (with a warning) old options
that are no longer supported.
4 years ago
Stephen Shelton cdd4439cff
Temporary fix for [dns]bind and [dns]local-dns 4 years ago
Stephen Shelton 936fbb2424
Fix config not falling back to undeclared handler for missing option 4 years ago
Jason Rhinelander 7ce8e4a830
Merge pull request #1234 from notlesh/i-love-apple-2020-04-21
Fix DNS "claiming" on Mac when no explicit DNS is set
4 years ago
Jeff 20dfd11d4e
Merge pull request #1245 from notlesh/potential-router-hive-fixes-post-config-cleanup-2020-04-24
Some maybe-fixes for RouterHive post config cleanup
4 years ago
Stephen Shelton 526b1320b7
Some maybe-fixes for RouterHive post config cleanup 4 years ago
Jeff 54a7843bc5
Merge pull request #1186 from notlesh/config-cleanup-2020-03-13
Config cleanup
4 years ago
Jeff 0d6d0ec7b2
Merge pull request #1239 from jagerman/restore-dns-via-signal-handler
More macos hacks
4 years ago
Jeff 245c0004dd
Merge pull request #1243 from majestrate/fix-windows-ci-2020-04-22
fix ci for win32
4 years ago
Jeff Becker 783e72da73
fix ci for win32 4 years ago
Jeff 0fcb7380c5
Merge pull request #1240 from majestrate/fix-win32-build-for-ci-2020-04-22
fix ci for win32
4 years ago
Jeff 1b7fa7c978
Merge pull request #1242 from jagerman/fix-systemd-dev
No LINUX variable in cmake
4 years ago
Jeff 0048badcf9
Merge pull request #1241 from jagerman/fix-systemd
No LINUX variable in cmake
4 years ago
Jason Rhinelander 6080a9427b No LINUX variable in cmake
Just let the pkg_check fail when libsystemd isn't install; it shouldn't
hurt anything.
4 years ago
Jason Rhinelander d8858361f4 No LINUX variable in cmake
Just let the pkg_check fail when libsystemd isn't install; it shouldn't
hurt anything.
4 years ago
Jeff Becker 2f97b98945
fix ci for win32 4 years ago
Jason Rhinelander 1a552d580e More macos uninstall hackery 4 years ago
Jason Rhinelander 86a67db87a After touching, macos needs some sleep 4 years ago
Jason Rhinelander 2be546557f Touch the magic file 4 years ago
Jason Rhinelander d48a54363d Restore DNS via signal handler
If we get signalled we still want to run it, but a signal on the script
could result in us exiting early.
4 years ago
Jason Rhinelander 9ce38fe54f
Merge pull request #1238 from notlesh/mac-uninstall-permissions-into-dev-2020-04-21
Use install(PROGRAMS... instead of isntall(FILES...
4 years ago
Stephen Shelton 67f023cf8a
Use install(PROGRAMS... instead of isntall(FILES... 4 years ago
Stephen Shelton 04bba0f415
Merge pull request #1237 from notlesh/install-mac-script-with-execute-2020-04-21
Use install(PROGRAMS... instead of install(FILES...
4 years ago
Stephen Shelton 55ff55eec0
Use install(PROGRAMS... instead of isntall(FILES...
@ mac uninstall script
4 years ago
Jason Rhinelander ffae1a7f11
Merge pull request #1236 from jagerman/macos-deployment-target-dev
Set -mmacosx-version-min the cmake way
4 years ago
Jason Rhinelander 0a8aef0880
Merge pull request #1235 from jagerman/macos-deployment-target
Set -mmacosx-version-min the cmake way
4 years ago
Jason Rhinelander 3048ccf3f8 Set -mmacosx-version-min the cmake way 4 years ago
Jason Rhinelander 053a5cb180 Set -mmacosx-version-min the cmake way 4 years ago
Jeff 8b72a5a400
Merge pull request #1233 from jagerman/dev-backport
0.7.1 - Backport minor fixes and packaging from dev to master
4 years ago
Stephen Shelton 47806b4408
Handle no-explicitly-set-dns case in launchd script 4 years ago
Stephen Shelton b4b2e91bb5
Handle no-explicitly-set-dns case in launchd script 4 years ago
Jason Rhinelander 496451ebb9 Remove unwanted defines
Version definitions moved to CMakeLists.txt
4 years ago
Jason Rhinelander a75015bc64 Disable thread safety annotations on AppleClang 4 years ago
Jason Rhinelander b2bd555965 Bump version to 0.7.1
Including mostly windows/macos packaging changes, plus a few minor
fixes.
4 years ago
Jason Rhinelander dacea9a2bc Add stapling after notarization 4 years ago
Stephen Shelton b56ff52ad9 Include macos uninstall script 4 years ago
Jason Rhinelander 2036bcaf8f NOTARIZE only has one O 4 years ago
Jason Rhinelander d49fe8118f Pass CMAKE_PREFIX_PATH through to lokinet-gui
Needed to build against the right Qt
4 years ago
Jason Rhinelander 6391f32627 Notarize has an "a" in it 4 years ago
Jason Rhinelander 44b6ccebbd Move release motto string into CMakeLists.txt
Right after project() which contains the version, so that version +
motto updates are basically in one place (and so that non-Makefile cmake
invocations get it).
4 years ago
Jason Rhinelander 35197a7620 codesigning and notarization
Codesigns and notarizes the package.  Requires a bunch of stuff to
actually get this working.  (see contrib/macos-signing.txt).

I'm currently also building with

    -DLOKINET_GUI_REPO=https://github.com/jagerman/loki-network-control-panel.git -DLOKINET_GUI_CHECKOUT=cmake

because it needs the camke-ification PR for the control panel to
properly sign everything there.
4 years ago
Jason Rhinelander d65a0c97ed Add simple installer readme 4 years ago
Jason Rhinelander 1221a24c25 Change mac install prefix to /opt/lokinet
/usr/local is probably going to get stomped on by homebrew.
4 years ago
Jason Rhinelander 16d2296b11 Add -DBUILD_PACKAGE=ON to make cpack code opt-in 4 years ago
Jason Rhinelander c9a8c67276 Build lokinet-gui with ExternalProject
Also installs it without the extra hack by specifying ../../Applications
for the destination.  (This definitely feels kind of nasty, but it works).
4 years ago
Jason Rhinelander 58133db753 Consolidate cmake vars & definitions
CMake will set version variables itself if you give the version in the
project(), which is cleaner.  Also removes some (nearly) duplicate
definitions and settings added in basic_definitions.cmake for unknown
reasons.

Removes some redundant settings (name, description, version) from the
cpack settings which already default to the values from the project()
call.
4 years ago
Stephen Shelton 0388a10f81 Bundle gui in mac installer 4 years ago
Stephen Shelton e80f20ecb8 MacOS installer / runtime nonsense 4 years ago
Jeff Becker c2fbc28bbf gut ui-* 4 years ago
Jeff Becker 8cfc02ca56 add plist 4 years ago
Jeff Becker b630a3135a macos post install script that bootstraps, generates configs and registers plist 4 years ago
Jeff Becker 230f28f20a tinker with release scripts to hopefully appease the apple gods. 4 years ago
Jeff Becker 7ca8400e66 make apple builds build for older versions and embrace the bitrot 4 years ago
Jeff Becker cc6d4e9401 turn off optimizations for releases 4 years ago
Jeff Becker 7c81c7502d static link on macos 4 years ago
Jeff Becker 012c0816a0 make gitlab mac runner poop out mac pkg builds too 4 years ago
Jeff Becker 0ca8c25b49 remove god awful "packaging" cruft that is no longer used. 4 years ago
Jeff Becker fc14c25771 fix up cpack for macos 4 years ago
Jeff Becker 7e82a3fefb use 64 bit windows target for now 4 years ago
Jeff Becker 4ce2542bbf fix gitlab tag (again) 4 years ago
Jeff Becker d3a503261e fix gitlab tag 4 years ago
Jeff Becker bc575e1649 fix gitlab ci file 4 years ago
Jeff Becker 53bef479a3 more macos installer bits 4 years ago
Jeff Becker b3eaf92588 add mac target for release 4 years ago
Jeff Becker 73eef0427a move cmake unix down 4 years ago
Jeff Becker dbaed61100 make gitlab pump out 32 bit installers, no lto for builds as that is cursed for now. 4 years ago
Jeff Becker 744acce8d2 update lokinet-bootstrap 4 years ago
Jeff Becker cf1cb3d304 allow fail 4 years ago
Jeff Becker 6c3fab84ec update ci for windows installers 4 years ago
Jeff Becker a0b6357e0a make installer pull in tuntap driver 4 years ago
Jeff Becker eb7ddae863 initial lokinet-bootstrap in powershell for windows 4 years ago
Jeff Becker 7f59cce443 set license 4 years ago
Jeff Becker 7406dbc964 cpack win32 4 years ago
Jeff Becker 8c84eac718 strict check of bounds 4 years ago
Jeff Becker dd9c8c91a3 add bounds check 4 years ago
Jeff Becker 91aa488024 remove un needed check 4 years ago
Jeff Becker 9933dadb20 fix use after move 4 years ago
Jeff Becker 0b66441e07 disable accedental fec in iwp outbound messages 4 years ago
Jeff Becker 9ae743a65b when we have an inbound session and we do a forward dns lookup
we should not look up the descriptor on the network as we
already have a session with them
4 years ago
Ryan Tharp cbb08c762e fix make static when TOOLCHAIN isn't set 4 years ago
Jeff e685d1fcf9
Merge pull request #1232 from jagerman/stapling
Add stapling after notarization
4 years ago
Jason Rhinelander 4a0ee5c66f Add stapling after notarization 4 years ago
Jeff edc0d1a3ed
Merge pull request #1225 from majestrate/macos-cpack-setup-and-bootstrap-2020-04-10
macos cpack installer infra
4 years ago
Jeff dde4c4c67e
Merge pull request #1228 from despair86/win32-cleanup
Win32 cleanup
4 years ago
Stephen Shelton 0b1c57f650 Include macos uninstall script 4 years ago
Jason Rhinelander 6da26bfa43 NOTARIZE only has one O 4 years ago
Jason Rhinelander 9f208d2b6c Pass CMAKE_PREFIX_PATH through to lokinet-gui
Needed to build against the right Qt
4 years ago
Rick V 6eaaeab094
reeee 4 years ago
Rick V 337a21d6f6
ew stinki 4 years ago
Rick V 76aa0421ff
use a new read buffer every time 4 years ago
Rick V 1e51bfde2c
fix 4 years ago
Rick V 4e87e8dc08
correctly return true/false when writing 4 years ago
Rick V c65eecf399
are we leaking data randomly 4 years ago
Rick V 46d4ab2708
this might just crash 4 years ago
Rick V 96fc3cdd55
fix pybind 4 years ago
Rick V df634b7775
remove a ton of ded win32 code 4 years ago
Rick V 938f40efe1
probably got mangled in a patch
supposed to tick at the end
4 years ago
Jason Rhinelander 216b807cb3 Notarize has an "a" in it 4 years ago
Jason Rhinelander f8209baf50 Move release motto string into CMakeLists.txt
Right after project() which contains the version, so that version +
motto updates are basically in one place (and so that non-Makefile cmake
invocations get it).
4 years ago
Jason Rhinelander 8d74407d11 codesigning and notarization
Codesigns and notarizes the package.  Requires a bunch of stuff to
actually get this working.  (see contrib/macos-signing.txt).

I'm currently also building with

    -DLOKINET_GUI_REPO=https://github.com/jagerman/loki-network-control-panel.git -DLOKINET_GUI_CHECKOUT=cmake

because it needs the camke-ification PR for the control panel to
properly sign everything there.
4 years ago
Jason Rhinelander 0032f1fdde Add simple installer readme 4 years ago
Jason Rhinelander daf0174e53 Change mac install prefix to /opt/lokinet
/usr/local is probably going to get stomped on by homebrew.
4 years ago
Jason Rhinelander ebb1950941 Add -DBUILD_PACKAGE=ON to make cpack code opt-in 4 years ago
Jason Rhinelander 93311fbc99 Build lokinet-gui with ExternalProject
Also installs it without the extra hack by specifying ../../Applications
for the destination.  (This definitely feels kind of nasty, but it works).
4 years ago
Jason Rhinelander 3dd3d48fbb Consolidate cmake vars & definitions
CMake will set version variables itself if you give the version in the
project(), which is cleaner.  Also removes some (nearly) duplicate
definitions and settings added in basic_definitions.cmake for unknown
reasons.

Removes some redundant settings (name, description, version) from the
cpack settings which already default to the values from the project()
call.
4 years ago
Stephen Shelton c20d5b186d Bundle gui in mac installer 4 years ago
Stephen Shelton dd3121d8ac MacOS installer / runtime nonsense 4 years ago
Jeff Becker 88ae4bdd77 gut ui-* 4 years ago
Jeff Becker b0936830d1 add plist 4 years ago
Jeff Becker 31f74b5ffb macos post install script that bootstraps, generates configs and registers plist 4 years ago
Jeff 5b1941222b
unscrew travis-ci (#1223)
* update travis ci clang-format to clang-format-9 because we use that now
add python3-dev package becuase something inside ci thinks it has python but really does not

* try using python3.6

* try working around hot garbage that is travis-ci

* add deadsnakes repo for python3.8

* prevent nullptr deference when running in unit tests

* move python3.8 to main dependancy matrix and add python3.8 to homebrew deps

* add deadsnake apt repo

* add deadsnakes and python3.8 back to previous matrix

* dev package for python

* toggle hive build in ci

* dont add pybind11 if not bulding hive

* revert setting pyenv shim for travis ci

* make native builds on by default except for windows ci

* only apply native build being off for windows release target becuase that broke macos
4 years ago
Jeff 9d9776d5ca
Merge pull request #1224 from jagerman/snode-addr-converter-reverse
hex-to-base32z.py: add -r flag to do reverse conversion
4 years ago
Jason Rhinelander 612c65f2ab hex-to-base32z.py: add -r flag to do reverse conversion 4 years ago
Jeff 6d5b9850e6
Merge pull request #1222 from jagerman/snode-addr-converter
Add ed25519 key to snode address script to contrib
4 years ago
Jason Rhinelander 5e0a8cf738 Add ed25519 key to snode address script to contrib 4 years ago
Jeff 6a645cd277
Merge pull request #1219 from jagerman/mac-fixes
Fix errors and warnings compiling on mac
4 years ago
Jason Rhinelander 3c6aa002b8 Fix errors and warnings compiling on mac 4 years ago
Stephen Shelton ca24f25665
Make fewer assumptions about config state
This handles values missing when config is created through RouterHive.
4 years ago
Stephen Shelton dfcf8fb62e
Update RouterHive to reflect config changes 4 years ago
Stephen Shelton 6a10a33e9e
Revert "Remove llarp::Config::Copy()"
This reverts commit 3a1c727b9b.
4 years ago
Stephen Shelton de8e44ba21
Re-apply clang-format rules after rebasing 4 years ago
Stephen Shelton 3a1c727b9b
Remove llarp::Config::Copy()
I probably missed this in my rebase on top of The Great Wall of Blame
4 years ago
Stephen Shelton 6d001c5fd2
Opportunistically move 'netdb' to 'nodedb' 4 years ago
Stephen Shelton a66f502ed6
Remove [netdb] conf and place it under data-dir
This does three things:

1) Remove the [netdb] conf section,
2) Rename the subdir 'netdb' -> 'nodedb'
3) Place 'nodedb' under 'data-dir'
4 years ago
Stephen Shelton 3c6a127dce
Complain loudly when we can't create nodedb dirs 4 years ago
Stephen Shelton be014175e9
Consolidate logging initialization logic 4 years ago
Stephen Shelton 6909e20588
Fix logging initialization and flush at program exit 4 years ago
Stephen Shelton 2479049876
Remove dead code 4 years ago
Stephen Shelton d3bcc05aa6
Organize some constants and default values 4 years ago
Stephen Shelton 91206725cb
Inject a default bootstrap file if none in conf 4 years ago
Stephen Shelton da6bda15a1
Where did rc.signed come from?! 4 years ago
Stephen Shelton 7ea8d62640
Use fs::path over std::string for files 4 years ago
Stephen Shelton 7ce256d846
Prefer fs::path over std::string @ KeyManager 4 years ago
Stephen Shelton 0a9515a94a
Proper support for multiple values @ ConfigDefinition 4 years ago
Stephen Shelton 28c1ca9c7a
Handle missing IP address in conf properly 4 years ago
Stephen Shelton 0697d57190
Important TODO 4 years ago
Stephen Shelton 0e5e9a1222
Silently ignore config file if it exists already 4 years ago
Stephen Shelton e3cb4b2d60
Don't create conf dir in main()
ensureConfig() does this implicitly.
4 years ago
Stephen Shelton 1fc7c61d1f
Share common conf comments for client and relay 4 years ago
Stephen Shelton 3739fc1d70
Reinstate multi-valued option 4 years ago
Stephen Shelton a6787657be
Refactor config comments to take list of strings 4 years ago
Stephen Shelton a8671cf9c7
Rename config classes for clarity
ConfigDefinition -> OptionDefiniton
Configuration -> ConfigDefinition
4 years ago
Stephen Shelton f250b7adcb
Remove pidfile support 4 years ago
Stephen Shelton 4f77080f75
Remove optional<> from block-bogons 4 years ago
Stephen Shelton 4d053231d3
Define config defaults as constexpr 4 years ago
Stephen Shelton adfcbd1d0b
Slight cleanup of k:v option maps 4 years ago
Stephen Shelton e06c2e4502
Check that [router]min-connections <= [router]max 4 years ago
Stephen Shelton 6fd270ba09
Rip out link type spec and factory
We only support IWP now, so this is all effectively dead code.
4 years ago
Stephen Shelton 176c1e3cbd
Remove --router option 4 years ago
Stephen Shelton 9e850705b4
Add 'AssignmentAcceptor' convenience for simple config acceptors 4 years ago
Stephen Shelton f2a8dd10ce
Modernize Snapp config 4 years ago
Stephen Shelton 733efbab40
Reflect removal of accessors on config structs 4 years ago
Stephen Shelton c8c940b0f5
Replace individual file locations with dataDir 4 years ago
Stephen Shelton 5d0b53e1be
Remove environment variable support in config 4 years ago
Stephen Shelton 05257126fe
Make distinction between config dir and data dir 4 years ago
Stephen Shelton 9e7254f6fa
Rip out pass-through-to-curl functionality 4 years ago
Stephen Shelton 923e73f693
Plumb isRelay CLI arg through to config 4 years ago
Stephen Shelton 028e55e997
Remove pre-refactor config test 4 years ago
Stephen Shelton 2e75e03434
Remove incomplete impl of config hot-reloading 4 years ago
Stephen Shelton 6301fefd43
Add router-specific config comments 4 years ago
Stephen Shelton 5b520a4dff
Simplify connection limit constants 4 years ago
Stephen Shelton 14e7789847
Add padding to config file generated output 4 years ago
Stephen Shelton 1273f11ce8
First pass at updating comments to lokinet config 4 years ago
Stephen Shelton 18ee23c2a3
Support for comments in config definition 4 years ago
Stephen Shelton 1653b73ee5
Clean up the logic around generating default confs 4 years ago
Stephen Shelton c5ff672c79
Use 'undeclared handler' for multi-valued 'add-node' config option 4 years ago
Stephen Shelton feacde7864
Hook up 'undeclared handlers' to mop up loosely-structured INI values 4 years ago
Stephen Shelton 9a1b7b20de
Add "undeclared value" handler to Configuration 4 years ago
Stephen Shelton e9708a5d1c
Add split(string_view, char) util function 4 years ago
Stephen Shelton ffc58fcedb
Remove dead code (serverOptions) 4 years ago
Stephen Shelton 2e47262350
Demystify LinksConfig 4 years ago
Stephen Shelton cd1e7713de
Clean up / consolidate config logging logic 4 years ago
Stephen Shelton 4c00c6238e
Join config definition and config parser 4 years ago
Stephen Shelton 653a650cf9
Fix typo 4 years ago
Stephen Shelton 9f0ae43149
Remove dead code 4 years ago
Stephen Shelton d82f5e6b93
First pass at replacing config value logic 4 years ago
Stephen Shelton a44eb73baa
Add config INI output unit tests 4 years ago
Stephen Shelton 69331f1571
Remove multiValued as an argument to ConfigDefinition 4 years ago
Stephen Shelton f6d000838f
Clarity and convenience for defining config options 4 years ago
Stephen Shelton 02e31f3867
Introduce acceptor function in ConfigDefinition 4 years ago
Stephen Shelton 60d0bf2a9b
Rename function for clarity 4 years ago
Stephen Shelton 8160c13458
More documentation around Configuration/ConfigDefinition 4 years ago
Stephen Shelton 8352de7bd4
Config documentation, clarity 4 years ago
Stephen Shelton d9340a873e
Consolidate Configuration generate INI functions 4 years ago
Stephen Shelton 1b19314278
Implement Configuration::generateDefaultConfig(), maintain insertion order 4 years ago
Stephen Shelton 7dacc30862
Conveience and clarity around config definiton maps 4 years ago
Stephen Shelton 105dd30fd9
More ConfigDefinition unit tests, fixes, support std::string as type 4 years ago
Stephen Shelton 25212b929c
Add ConfigDefinition unit tests, fixes 4 years ago
Stephen Shelton a856e772c8
Stylistic clean up 4 years ago
Stephen Shelton 0fb888890f
First pass at Configuration definition classes 4 years ago
Stephen Shelton 9d71228e74
Replace config visit pattern with explicit lookups
This is an initial pass at doing explicit value checks when handling
config parsing, as opposed to using a visiting pattern. The latter
made it difficult to check for conditions such as missing required
values, multiple values, etc.

It was also generally less readable (think declarative) which further
made it difficult to get a grasp for what our actual configuration file
requirements were.
4 years ago
Stephen Shelton 858e252820
Add stringify() to util/str 4 years ago
Stephen Shelton ca67c12928
Why template when we only use one type?? 4 years ago
Jeff 30d0eb5bab
Merge pull request #1215 from notlesh/update-clang-format-rules-2020-04-02
Update clang format rules
4 years ago
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
4 years ago
Stephen Shelton 30e7c7f828
Bump clang-format version 8 -> 9 4 years ago
Stephen Shelton 9c68fa7316
Clang-format changes to pointer/reference positioning 4 years ago
Stephen Shelton 95ec728079
More clang-format updates to parameter/argument lists 4 years ago
Stephen Shelton 205549a1c3
Update (mostly loosen) clang-format rules 4 years ago
Stephen Shelton dba9ffe061
Add 'clang-format-hooks' submodule
This submodule provides git hooks which invoke clang-format
in intelligent ways.
4 years ago
Jeff d9160cc0df
Merge pull request #1197 from majestrate/code-docs-2020-03-26
infrastructure for generating docs
4 years ago
Jeff Becker 4375df2f7d
add forgotten files for generating docs 4 years ago
Jeff Becker 83b418b636
make fresh docs every time 4 years ago
Jeff Becker 08613cca0b
speed up doc generation 4 years ago
Jeff Becker c36b6a409c
move version to cmake so docs can access it 4 years ago
Jeff Becker 3d20105646
cleanup unused files and add doc target in wrapper makefile 4 years ago
Jeff Becker 0e51289228
speed up generation 4 years ago
Jeff Becker 53f0dd49e0
move file 4 years ago
Jeff Becker 00814d1a12
update cmake 4 years ago
Jeff Becker 3e7acb72e1
more docs, make doxygen work 4 years ago
Jeff Becker 1227ad3ac0
add snapp options documentation 4 years ago
Jeff Becker 20c65ac6a4
more docs 4 years ago
Jeff Becker 938c8c735e
add initial high level code docs 4 years ago
Jeff d3091cf9fc
Merge pull request #1167 from tewinget/tooling
RouterHive initial PR
4 years ago
Jason Rhinelander 5cc48048f1
Merge pull request #1218 from majestrate/macos-ci-build-fixes-2020-04-06
make apple builds build for older versions and embrace the bitrot
4 years ago
Jeff Becker aaae6f1ba9
tinker with release scripts to hopefully appease the apple gods. 4 years ago
Jeff Becker 7455a1956d
make apple builds build for older versions and embrace the bitrot 4 years ago
Jeff d3d3f0eac0
Merge pull request #1214 from majestrate/macos-cpack-fixes-2020-04-03
turn off optimizations for releases on macos
4 years ago
Jeff Becker 1e5a81846e
turn off optimizations for releases 4 years ago
Jeff d70e8b6d5e
Merge pull request #1213 from majestrate/macos-cpack-fixes-2020-04-03
make cpack generate macos pkg files
4 years ago
Jeff Becker 7d8101e177
static link on macos 4 years ago
Jeff Becker ab676c0c24
make gitlab mac runner poop out mac pkg builds too 4 years ago
Jeff Becker 69415fe09f
remove god awful "packaging" cruft that is no longer used. 4 years ago
Jeff Becker 9428689939
fix up cpack for macos 4 years ago
Jeff 2caf807fc0
Merge pull request #1212 from majestrate/fix-gitlab-ci-2020-04-02
use 64 bit windows target for now
4 years ago
Jeff Becker b4a96c6375
use 64 bit windows target for now 4 years ago
Jeff 78b0739bc0
Merge pull request #1211 from majestrate/fix-gitlab-ci-2020-04-02
fix gitlab tag (again)
4 years ago
Jeff Becker 34e24f383e
fix gitlab tag (again) 4 years ago
Jeff 2e5d797177
Merge pull request #1210 from majestrate/fix-gitlab-ci-2020-04-02
fix gitlab tag
4 years ago
Jeff Becker e2e649bcbe
fix gitlab tag 4 years ago
Jeff 9da7ce94a5
Merge pull request #1209 from majestrate/fix-gitlab-ci-2020-04-02
fix gitlab ci file
4 years ago
Jeff Becker f1b4c5fa9b
fix gitlab ci file 4 years ago
Jeff 779dcb9f2c
Merge pull request #1035 from majestrate/cpack-installer-2020-01-10
win32 installer using cpack
4 years ago
Jeff Becker aae260fbea
more macos installer bits 4 years ago
Jeff Becker 81dbe1288d
add mac target for release 4 years ago
Jeff Becker a02363325e
move cmake unix down 4 years ago
Jeff Becker 3b26b8b24d
make gitlab pump out 32 bit installers, no lto for builds as that is cursed for now. 4 years ago
Jeff Becker a615457316
update lokinet-bootstrap 4 years ago
Jeff Becker caad1dcd05
allow fail 4 years ago
Jeff Becker 9d8e3736bf
update ci for windows installers 4 years ago
Jeff Becker 9e696e131e
make installer pull in tuntap driver 4 years ago
Jeff Becker 2922668e6b
initial lokinet-bootstrap in powershell for windows 4 years ago
Jeff Becker f335aaa847
set license 4 years ago
Jeff Becker 2190da8c81
cpack win32 4 years ago
Jeff 928b501da1
Merge pull request #1207 from majestrate/remove-unused-headers-2020-04-01
remove unused headers
4 years ago
Jeff Becker 9a1050bbe7
remove unused headers 4 years ago
Jeff d3c3aebeaf
Merge pull request #1194 from majestrate/disable-iwp-fec-2020-03-23
disable accedental fec in iwp outbound messages
4 years ago
Jeff Becker 3b424f76f1
strict check of bounds 4 years ago
Jeff 007e4239a9
Merge pull request #1198 from majestrate/inbound-dns-hotfix-2020-03-28
dont request descriptors for inbound sessions
4 years ago
Jeff Becker 67883aa945
when we have an inbound session and we do a forward dns lookup
we should not look up the descriptor on the network as we
already have a session with them
4 years ago
Jeff 375b09486e
Merge pull request #1196 from majestrate/lokinetmon-update-2020-03-24
update lokinetmon to work again with dns rebinding protection
4 years ago
Jeff Becker 510053cbce
update lokinetmon to work again with dns rebinding protection 4 years ago
Jeff b66eebc917
Merge pull request #1195 from majestrate/remove-cruft-2020-03-24
remove unused cruft
4 years ago
Jeff Becker e8c5a62ee8
remove unused cruft 4 years ago
Jeff Becker b398076bc6
add bounds check 4 years ago
Jeff Becker b96700579e
remove un needed check 4 years ago
Jeff Becker 53e7397935
fix use after move 4 years ago
Jeff Becker 769bafd281
disable accedental fec in iwp outbound messages 4 years ago
Jason Rhinelander fcf6f7119f
Merge pull request #1192 from loki-project/neuroscr-mar2020-staticfix
fix make static when TOOLCHAIN isn't set
4 years ago
Ryan Tharp 24cd9ca57d
fix make static when TOOLCHAIN isn't set 4 years ago
Jeff 250a817c6e
Merge pull request #1189 from loki-project/dev
0.7.0
4 years ago
Jeff b1f036bb7f
Merge pull request #1188 from majestrate/call-jsonrpc-server-cleanup-2020-03-16
fix memleak in jsonrpc
4 years ago
Jeff Becker 1e434c03f8
cleanup 4 years ago
Jeff Becker d1f8752b7c
fix memleak in jsonrpc
llarp_tcp_acceptor ticker wasn't being called so connections where not
being cleaned up
4 years ago
Jeff 03da1d7d8f
Merge pull request #1187 from majestrate/future-proof-intro-sets-2020-03-14
discard unknown fields in introset for future use
4 years ago
jeff 7089996ac5 discard unknown fields in introset for future use 4 years ago
Stephen Shelton 8a12da8bd5
Remove some .cpp files related to RouterEvents
The motivation is to reduce the raw amount of code required to create
and maintain events.
4 years ago
Stephen Shelton 4c6be3c8d1
Add PathBuildRejectedEvent to RouterHive 4 years ago
Stephen Shelton ea835405c5
Refactor NotifyRouterEvent() to forward args, event code cleanup
This template-ifies Router::NotifyRouterEvent() up so that it accepts
the arguments to instantiate the specified event type, forwarding them
to std::make_unique. This would allow (in the future) the function to
no-op the call and avoid memory allocation. It also slightly reduces
the amount of code required to fire an event.

This commit also simplifies some of the RouterEvent code to reduce
redundancy.
4 years ago
Jeff 9ccaed71a5
Merge pull request #1183 from majestrate/add-random-snode-a-record-dns-2020-03-12
add an A Record for random.snode so that it works
4 years ago
Jeff Becker 4452b152aa
add an A Record for random.snode so that it works 4 years ago
Stephen Shelton 6664202868
Add FindRouterSentEvent and FindRouterReceivedEvent to RouterHive 4 years ago
Thomas Winget 84a1d7dbcc clang format....... 4 years ago
Thomas Winget 695784b2b6 more hive things
DHT PubIntroSentEvent
some helper functions added to RouterHive (C++ class) as well as RouterHive(Python class)
hive.py main() continues to be a testbed for new event types
some more internal classes in pybind
4 years ago
Thomas Winget 6d472d2423 rc gossip delay adjustment for hive
allows enough time for every relay (at least in a hive of 50) to connect
to the bootstrap node so all will get all gossips, but not too long so
tests can run relatively quickly.
4 years ago
Thomas Winget 6fc05ca1ff RCGossipSentEvent 4 years ago
Thomas Winget 7e0e8ab7bf hive.py upgrades, now with more cli args! 4 years ago
Thomas Winget f01624d10a 2ms between hive router spin-up instead of 20ms 4 years ago
Thomas Winget a58a8c9a61 hive.py now defaults to 1000 relays because f your box.
also check for error on uv_async_init...

may want to `ulimit -Sn $(ulimit -Hn)`...
4 years ago
Thomas Winget c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 4 years ago
Thomas Winget 912e4267e4 I'm a muppet. 4 years ago
Thomas Winget 88c80dc2ee add cxxopts to shared_lib dependencies 4 years ago
Thomas Winget df0380e746 LRSM RouterEvent, added to hive test and test passes. 4 years ago
Thomas Winget 138a0b33fb jason's computer can't python3 4 years ago
Thomas Winget 771d0b4489 hive pytest framework in place (and path build test works)! 4 years ago
Thomas Winget 04c1f67f78 more structure to python hive code 4 years ago
Thomas Winget d40b106292 --print-events to enable hive printing all events, default false now 4 years ago
Thomas Winget 2bf1c889cf call relays 'relays' instead of 'routers' in hive.py 4 years ago
Thomas Winget ee7b7e917d hive can now instantiate and start relays/clients separately 4 years ago
Thomas Winget 2bbb274131 superfluous class declaration 4 years ago
Thomas Winget e1be27611b hive print count of each event after every 10 events 4 years ago
Stephen Shelton 4741d81051 Add GotIntro event to RouterHive 4 years ago
Thomas Winget 68c1ae52b3 add ShortHex function to AlignedBuffer 4 years ago
Thomas Winget 341d03bcf8 changes 4 years ago
Jeff Becker e7689b40a7 dht pub intro message router event thiny doo 4 years ago
Jeff Becker 22ed47ca12 better tostring 4 years ago
Thomas Winget 5672c42f20 RouterEvent::ToString in parent class 4 years ago
Thomas Winget 81209669e3 typo 4 years ago
Thomas Winget 14bf2733c1 how to use a router event doc 4 years ago
Thomas Winget 4ffd42109c some tooling documentation 4 years ago
Thomas Winget 309569628e change some to_string functions 4 years ago
Thomas Winget db2a0ef7f7 git add because I'm dumb 4 years ago
Thomas Winget a9882ad475 PathRequestReceivedEvent implemented 4 years ago
Thomas Winget c9a278c0de some more changes to pybind/hive code, read below
hive.py is currently largely for testing the pybind stuff, so changes to it will likely
be frequent and arbitrary for now.

Added pybind for llarp::path::PathHopConfig, but not every member -- just rc and upstream routerID

Hive now uses std::queue with mutex instead of our lockless queue.

Removed some functions from Hive that will not be necessary as things are being handled from python.
4 years ago
Thomas Winget e0187fd690 holy GIL contention batman 4 years ago
Thomas Winget 5cf35769b4 don't have python try to intercept stdout/stderr 4 years ago
Jeff Becker 32dbe6b1ad more shiz 4 years ago
Jeff Becker 877443d95c more introspection code 4 years ago
Thomas Winget 931ff521d1 working toward full testnet of routers (not clients yet) in hive/pybind setup
Not working yet -- some sort of RC issue.  Checkout the commit prior to this if you want something that 'works' that you can play with.
4 years ago
Thomas Winget d8d0338575 don't use cmake findlibrary on pybind 4 years ago
Thomas Winget 2cda9f6cb8 pybind stable 4 years ago
Thomas Winget 1e04decb66 can ping on lokinet running in python context! 4 years ago
Thomas Winget 85e510c89b add router_event pybind file 4 years ago
Thomas Winget 5e498e962f working on more pybinds 4 years ago
Thomas Winget 0f34a950a9 pybind config object, working 4 years ago
Thomas Winget 9b3bf833e0 revert nop logging -- un-revert later 4 years ago
Jeff Becker 5dcf271339 update python 4 years ago
Thomas Winget a5c2b369b7 nop logging on hive build for now
a bunch of routers logging to stdout at the same time is a complete
charlie foxtrot.  until we take the time to make logger not a singleton
(and probably make each router able to log to its own file rather than stdout)
just make it not log.

Note: this is very temporary, as the logs will be annoying for testing the
pybind stuff and shouldn't be necessary for debugging it
4 years ago
Thomas Winget 0007996fde using instead of typedef 4 years ago
Jeff Becker 21026753d1 makefile tweaks for tommyboi 4 years ago
Jeff Becker a5dc41b049 OMG IT DOES STUFF :DDDDDD 4 years ago
Jeff Becker 1bb3fba31b add demo script 4 years ago
Jeff Becker 831e80f498 more pybind bindings 4 years ago
Thomas Winget f712acc486 huzzah it builds, time to test soon! 4 years ago
Jeff Becker da79b14703 make it compile 4 years ago
Jeff Becker d0b909f881 use stable branch in submodule 4 years ago
Thomas Winget 8dc5dabe49 working toward compilation, still has include issue 4 years ago
Jeff Becker a4141617d7 add build infra for toggling hive builds 4 years ago
Jeff Becker 26c1670af7 make it compile 4 years ago
Jeff Becker fc0dfb6e3d add submodule 4 years ago
Jeff Becker 78454f1cb4 more introspection 4 years ago
Jeff Becker 35bea37fd1 make it compile 4 years ago
Jeff Becker 1fdb8b4c94 initial pybind11 introspection code 4 years ago
Thomas Winget 8d03e6dd3c more router hive stuff, read below the fold
Router now has a hive pointer if LOKINET_HIVE is set.
llarp::Context has a method InjectHive to give Router the pointer.
Router has a method NotifyRouterEvent which does:
  - when LOKINET_HIVE is set, passes the event to RouterHive
  - else when LOKINET_DEBUG is set, prints the event at a low log level
  - else NOP
4 years ago
Thomas Winget cd48b3946e config will be handled by python. router add/start/stop code in hive. 4 years ago
Thomas Winget 86bd6bed50 progress commit to push for others to see 4 years ago
Thomas Winget 6a0ee9dc55 RouterHive initial commit, minor changes to RouterEvent 4 years ago
Thomas Winget 07c5d6f5df first draft of router event tooling 4 years ago

@ -1,6 +1,6 @@
BasedOnStyle: Google
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'true'
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlinesLeft: 'true'
AlignOperands: 'false'
@ -14,19 +14,48 @@ AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: All
AlwaysBreakTemplateDeclarations: 'true'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializersBeforeComma: 'true'
Cpp11BracedListStyle: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
NamespaceIndentation: All
PenaltyBreakString: '3'
SpaceBeforeParens: Never
SpacesInAngles: 'true'
SpaceBeforeParens: ControlStatements
SpacesInAngles: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
UseTab: Never
SortIncludes: false
SortIncludes: false
ColumnLimit: 100
# treat pointers and reference declarations as if part of the type
DerivePointerAlignment: false
PointerAlignment: Left
# when wrapping function calls/declarations, force each parameter to have its own line
BinPackParameters: 'false'
BinPackArguments: 'false'
# TODO: uncomment me when we are reading to rearrange the header includes
# IncludeBlocks: Regroup
# IncludeCategories: 'llarp/'

@ -1,2 +1,2 @@
HeaderFilterRegex: 'llarp/.*'
Checks: 'readability-else-after-return,clang-analyzer-core-*,modernize-*'
Checks: 'readability-else-after-return,clang-analyzer-core-*,modernize-*,-modernize-use-trailing-return-type,-modernize-use-nodiscard,bugprone-*,-bugprone-easily-swappable-parameters'

@ -0,0 +1,450 @@
local default_deps_base = [
'libsystemd-dev',
'python3-dev',
'libuv1-dev',
'libunbound-dev',
'nettle-dev',
'libssl-dev',
'libevent-dev',
'libsqlite3-dev',
'libcurl4-openssl-dev',
'libzmq3-dev',
'make',
];
local default_deps_nocxx = ['libsodium-dev'] + default_deps_base; // libsodium-dev needs to be >= 1.0.18
local default_deps = ['g++'] + default_deps_nocxx;
local docker_base = 'registry.oxen.rocks/lokinet-ci-';
local submodule_commands = [
'git fetch --tags',
'git submodule update --init --recursive --depth=1 --jobs=4',
];
local submodules = {
name: 'submodules',
image: 'drone/git',
commands: submodule_commands,
};
// cmake options for static deps mirror
local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https://oxen.rocks/deps ' else '');
local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';
// Regular build on a debian-like system:
local debian_pipeline(name,
image,
arch='amd64',
deps=default_deps,
build_type='Release',
lto=false,
werror=true,
cmake_extra='',
local_mirror=true,
extra_cmds=[],
jobs=6,
tests=true,
oxen_repo=false,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
] + (
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',
'eatmydata ' + apt_get_quiet + ' update',
] else []
) + [
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y gdb cmake git pkg-config ccache ' + std.join(' ', deps),
'mkdir build',
'cd build',
'cmake .. -DWITH_SETCAP=OFF -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE=' + build_type + ' ' +
(if build_type == 'Debug' then ' -DWARN_DEPRECATED=OFF ' else '') +
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
'-DWITH_LTO=' + (if lto then 'ON ' else 'OFF ') +
'-DWITH_TESTS=' + (if tests then 'ON ' else 'OFF ') +
cmake_extra +
ci_dep_mirror(local_mirror),
'VERBOSE=1 make -j' + jobs,
'cd ..',
]
+ (if tests then ['./contrib/ci/drone-gdb.sh ./build/test/testAll --use-colour yes'] else [])
+ extra_cmds,
},
],
};
local apk_builder(name, image, extra_cmds=[], allow_fail=false, jobs=6) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: 'amd64' },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, ANDROID: 'android' },
commands: [
'VERBOSE=1 JOBS=' + jobs + ' NDK=/usr/lib/android-ndk ./contrib/android.sh',
'git clone https://github.com/oxen-io/lokinet-flutter-app lokinet-mobile',
'cp -av build-android/out/* lokinet-mobile/lokinet_lib/android/src/main/jniLibs/',
'cd lokinet-mobile',
'flutter build apk --debug',
'cd ..',
'cp lokinet-mobile/build/app/outputs/apk/debug/app-debug.apk lokinet.apk',
] + extra_cmds,
},
],
};
// windows cross compile on debian
local windows_cross_pipeline(name,
image,
gui_image=docker_base + 'nodejs-lts',
arch='amd64',
build_type='Release',
lto=false,
werror=false,
cmake_extra='',
local_mirror=true,
extra_cmds=[],
jobs=6,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'GUI',
image: gui_image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y p7zip-full wine',
'cd gui',
'yarn install --frozen-lockfile',
'USE_SYSTEM_7ZA=true DISPLAY= WINEDEBUG=-all yarn win32',
],
},
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, WINDOWS_BUILD_NAME: 'x64' },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y build-essential cmake git pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip icoutils automake libtool librsvg2-bin bison',
'JOBS=' + jobs + ' VERBOSE=1 ./contrib/windows.sh -DSTRIP_SYMBOLS=ON -DGUI_EXE=$${DRONE_WORKSPACE}/gui/release/Lokinet-GUI_portable.exe' +
ci_dep_mirror(local_mirror),
] + extra_cmds,
},
],
};
// linux cross compile on debian
local linux_cross_pipeline(name,
cross_targets,
arch='amd64',
build_type='Release',
cmake_extra='',
local_mirror=true,
extra_cmds=[],
jobs=6,
allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: docker_base + 'debian-stable-cross',
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, CROSS_TARGETS: std.join(':', cross_targets) },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'VERBOSE=1 JOBS=' + jobs + ' ./contrib/cross.sh ' + std.join(' ', cross_targets) +
' -- ' + cmake_extra + ci_dep_mirror(local_mirror),
],
},
],
};
// 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', oxen_repo=true) = {
kind: 'pipeline',
type: 'docker',
name: 'DEB (' + distro + (if arch == 'amd64' then '' else '/' + arch) + ')',
platform: { arch: arch },
environment: { distro_branch: distro_branch, distro: distro },
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
failure: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
] + (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 []) + [
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git devscripts equivs ccache git-buildpackage python3-dev',
|||
# Look for the debian branch in this repo first, try upstream if that fails.
if ! git checkout $${distro_branch}; then
git remote add --fetch upstream https://github.com/oxen-io/lokinet.git &&
git checkout $${distro_branch}
fi
|||,
// Tell the merge how to resolve conflicts in the source .drone.jsonnet (we don't
// care about it at all since *this* .drone.jsonnet is already loaded).
'git config merge.ours.driver true',
'echo .drone.jsonnet merge=ours >>.gitattributes',
'git merge ${DRONE_COMMIT}',
'export DEBEMAIL="${DRONE_COMMIT_AUTHOR_EMAIL}" DEBFULLNAME="${DRONE_COMMIT_AUTHOR_NAME}"',
'gbp dch -S -s "HEAD^" --spawn-editor=never -U low',
'eatmydata mk-build-deps --install --remove --tool "' + apt_get_quiet + ' -o Debug::pkgProblemResolver=yes --no-install-recommends -y"',
'export DEB_BUILD_OPTIONS="parallel=$$(nproc)"',
//'grep -q lib debian/lokinet-bin.install || echo "/usr/lib/lib*.so*" >>debian/lokinet-bin.install',
'debuild -e CCACHE_DIR -b',
'./contrib/ci/drone-debs-upload.sh ' + distro,
],
},
],
};
local clang(version) = debian_pipeline(
'Debian sid/clang-' + version + ' (amd64)',
docker_base + 'debian-sid-clang',
deps=['clang-' + version] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=clang-' + version + ' -DCMAKE_CXX_COMPILER=clang++-' + version + ' '
);
local full_llvm(version) = debian_pipeline(
'Debian sid/llvm-' + version + ' (amd64)',
docker_base + 'debian-sid-clang',
deps=['clang-' + version, ' lld-' + version, ' libc++-' + version + '-dev', 'libc++abi-' + version + '-dev']
+ default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=clang-' + version +
' -DCMAKE_CXX_COMPILER=clang++-' + version +
' -DCMAKE_CXX_FLAGS=-stdlib=libc++ ' +
std.join(' ', [
'-DCMAKE_' + type + '_LINKER_FLAGS=-fuse-ld=lld-' + version
for type in ['EXE', 'MODULE', 'SHARED']
])
);
// Macos build
local mac_builder(name,
build_type='Release',
werror=true,
cmake_extra='',
local_mirror=true,
extra_cmds=[],
jobs=6,
codesign='-DCODESIGN=OFF',
allow_fail=false) = {
kind: 'pipeline',
type: 'exec',
name: name,
platform: { os: 'darwin', arch: 'amd64' },
steps: [
{ name: 'submodules', commands: submodule_commands },
{
name: 'build',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
// If you don't do this then the C compiler doesn't have an include path containing
// basic system headers. WTF apple:
'export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"',
'ulimit -n 1024', // because macos sets ulimit to 256 for some reason yeah idk
'./contrib/mac-configure.sh ' +
ci_dep_mirror(local_mirror) +
(if build_type == 'Debug' then ' -DWARN_DEPRECATED=OFF ' else '') +
codesign,
'cd build-mac',
// We can't use the 'package' target here because making a .dmg requires an active logged in
// macos gui to invoke Finder to invoke the partitioning tool to create a partitioned (!)
// disk image. Most likely the GUI is required because if you lose sight of how pretty the
// surface of macOS is you might see how ugly the insides are.
'ninja -j' + jobs + ' assemble_gui',
'cd ..',
] + extra_cmds,
},
],
};
local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: 'amd64' },
trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
steps: [
submodules,
{
name: 'build',
image: image,
pull: 'always',
[if allow_fail then 'failure']: 'ignore',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'cmake -S . -B build-docs',
'make -C build-docs doc',
] + extra_cmds,
},
],
};
[
{
name: 'lint check',
kind: 'pipeline',
type: 'docker',
steps: [{
name: 'build',
image: docker_base + 'lint',
pull: 'always',
commands: [
'echo "Building on ${DRONE_STAGE_MACHINE}"',
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-14 jsonnet',
'./contrib/ci/drone-format-verify.sh',
],
}],
},
// documentation builder
docs_pipeline('Documentation',
docker_base + 'docbuilder',
extra_cmds=['UPLOAD_OS=docs ./contrib/ci/drone-static-upload.sh']),
// Various debian builds
debian_pipeline('Debian sid (amd64)', docker_base + 'debian-sid'),
debian_pipeline('Debian sid/Debug (amd64)', docker_base + 'debian-sid', build_type='Debug'),
clang(13),
full_llvm(13),
debian_pipeline('Debian stable (i386)', docker_base + 'debian-stable/i386'),
debian_pipeline('Debian buster (amd64)', docker_base + 'debian-buster', cmake_extra='-DDOWNLOAD_SODIUM=ON'),
debian_pipeline('Ubuntu latest (amd64)', docker_base + 'ubuntu-rolling'),
debian_pipeline('Ubuntu LTS (amd64)', docker_base + 'ubuntu-lts'),
debian_pipeline('Ubuntu bionic (amd64)',
docker_base + 'ubuntu-bionic',
deps=['g++-8'] + default_deps_nocxx,
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8',
oxen_repo=true),
// ARM builds (ARM64 and armhf)
debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64', jobs=4),
debian_pipeline('Debian stable (armhf)', docker_base + 'debian-stable/arm32v7', arch='arm64', jobs=4),
// cross compile targets
// Aug 11: these are exhibiting some dumb failures in libsodium and external deps, TOFIX later
//linux_cross_pipeline('Cross Compile (arm/arm64)', cross_targets=['arm-linux-gnueabihf', 'aarch64-linux-gnu']),
//linux_cross_pipeline('Cross Compile (ppc64le)', cross_targets=['powerpc64le-linux-gnu']),
// Not currently building successfully:
//linux_cross_pipeline('Cross Compile (mips)', cross_targets=['mips-linux-gnu', 'mipsel-linux-gnu']),
// android apk builder
// Aug 11: this is also failing in openssl, TOFIX later
//apk_builder('android apk', docker_base + 'flutter', extra_cmds=['UPLOAD_OS=android ./contrib/ci/drone-static-upload.sh']),
// Windows builds (x64)
windows_cross_pipeline('Windows (amd64)',
docker_base + 'debian-bookworm',
extra_cmds=[
'./contrib/ci/drone-static-upload.sh',
]),
// Static build (on bionic) which gets uploaded to builds.lokinet.dev:
debian_pipeline('Static (bionic amd64)',
docker_base + 'ubuntu-bionic',
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" ' +
'-DCMAKE_C_FLAGS="-march=x86-64 -mtune=haswell" ' +
'-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF -DBUILD_LIBLOKINET=OFF',
extra_cmds=[
'./contrib/ci/drone-check-static-libs.sh',
'./contrib/ci/drone-static-upload.sh',
]),
// Static armhf build (gets uploaded)
debian_pipeline('Static (buster armhf)',
docker_base + 'debian-buster/arm32v7',
arch='arm64',
deps=['g++', 'python3-dev', 'automake', 'libtool'],
cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
'-DCMAKE_CXX_FLAGS="-march=armv7-a+fp -Wno-psabi" -DCMAKE_C_FLAGS="-march=armv7-a+fp" ' +
'-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF',
extra_cmds=[
'./contrib/ci/drone-check-static-libs.sh',
'UPLOAD_OS=linux-armhf ./contrib/ci/drone-static-upload.sh',
],
jobs=4),
// integration tests
debian_pipeline('Router Hive',
docker_base + 'ubuntu-lts',
deps=['python3-dev', 'python3-pytest', 'python3-pybind11'] + default_deps,
cmake_extra='-DWITH_HIVE=ON'),
// Deb builds:
deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid'),
deb_builder(docker_base + 'debian-bullseye-builder', 'bullseye', 'debian/bullseye'),
deb_builder(docker_base + 'ubuntu-jammy-builder', 'jammy', 'ubuntu/jammy'),
deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid', arch='arm64'),
// Macos builds:
mac_builder('macOS (Release)', extra_cmds=[
'./contrib/ci/drone-check-static-libs.sh',
'./contrib/ci/drone-static-upload.sh',
]),
mac_builder('macOS (Debug)', build_type='Debug'),
]

1
.gitattributes vendored

@ -2,3 +2,4 @@ external/date/test export-ignore
external/nlohmann/doc export-ignore
external/nlohmann/test export-ignore
external/nlohmann/benchmarks/data export-ignore
*.signed binary

@ -0,0 +1,22 @@
name: Close incomplete issues
on:
schedule:
- cron: "30 1 * * *"
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/stale@v4.1.1
with:
only-labels: incomplete
days-before-issue-stale: 14
days-before-issue-close: 7
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been 'incomplete' for 14 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}

11
.gitignore vendored

@ -3,10 +3,10 @@
*.a
*.o
*.plist
*.so
build/
/build*/
**/__pycache__/**
llarpd
*.test
@ -18,12 +18,16 @@ CMakeFiles
CMakeCache.txt
.ninja_log
.ninja_deps
/.cache/
/compile_commands.json
callgrind.*
.gdb_history
*.sig
*.signed
!/contrib/bootstrap/mainnet.signed
!/contrib/bootstrap/testnet.signed
*.key
shadow.data
@ -40,9 +44,6 @@ vsproject/
.vs
daemon.ini
lokinet-win32.exe
lokinet
lokinet.exe
.gradle/

@ -1,90 +0,0 @@
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- test
# disabled because gcc9 can't build net_if.hpp
#build:linux:
# image: alpine:latest
# tags:
# - linux
# stage: build
# before_script:
# - apk add --update g++ make cmake linux-headers libcap-dev libuv-dev curl-dev git
# script:
# - make STATIC_LINK=ON DOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet"
# we'll just try our travis set up for now
build:linux_release:
image: ubuntu:xenial
tags:
- linux
stage: build
before_script:
- apt-get update && apt-get install -y apt-transport-https curl
- curl https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
- echo 'deb https://apt.kitware.com/ubuntu/ xenial main' >/etc/apt/sources.list.d/kitware.list
- apt-get update && apt-get install -y build-essential ca-certificates cmake curl git libcap-dev pkg-config wget xz-utils
script:
- make static DOWNLOAD_SODIUM=ON
# alternatively: git describe --tag
- LOKINET_VERSION=$(./lokinet-static --version|sed s/lokinet-//)
- echo lokinet-linux-x64-v$LOKINET_VERSION
- mkdir lokinet-linux-x64-v$LOKINET_VERSION
- cp lokinet-bootstrap lokinet-linux-x64-v$LOKINET_VERSION
- cp build/daemon/lokinet lokinet-linux-x64-v$LOKINET_VERSION
- cp build/daemon/lokinetctl lokinet-linux-x64-v$LOKINET_VERSION
- cp docs/linux-setcap-readme.txt lokinet-linux-x64-v$LOKINET_VERSION
- tar cJf lokinet-linux-x64-v$LOKINET_VERSION.tar.xz lokinet-linux-x64-v$LOKINET_VERSION
- echo "lokinet-linux-x64-v$LOKINET_VERSION.tar.xz should be ready"
artifacts:
paths:
- lokinet-linux-x64-v*.tar.xz
build:linux_debug:
image: ubuntu:xenial
tags:
- linux
stage: build
before_script:
- apt-get update && apt-get install -y apt-transport-https curl
- curl https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
- echo 'deb https://apt.kitware.com/ubuntu/ xenial main' >/etc/apt/sources.list.d/kitware.list
- apt-get update && apt-get install -y build-essential ca-certificates cmake curl git libcap-dev libcurl4-openssl-dev libuv1-dev ninja-build
script:
- DOWNLOAD_SODIUM=ON IS_NOTIFICATION=1 STATIC_LINK=OFF make
artifacts:
paths:
- build/daemon/lokinet
- build/daemon/lokinetctl
# needs libuv and libcurl
#build:freebsd:
# tags:
# - freebsd
# stage: build
# script:
# - gmake DOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet"
# need windows runner on lokiproject
#build:windows:
# tags:
# - windows
# stage: build
# script:
#- make static CC=gcc CXX=g++
# can't use STATIC because LTO doesn't work on cross-compiled targets
# -DSTATIC_LINK_RUNTIME=ON -DLIBUV_ROOT=libuv
# - cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake -DDOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet.exe"

44
.gitmodules vendored

@ -1,21 +1,41 @@
[submodule "external/nlohmann"]
path = external/nlohmann
url = https://github.com/nlohmann/json.git
[submodule "external/googletest"]
path = external/googletest
url = https://github.com/google/googletest.git
[submodule "external/cxxopts"]
path = external/cxxopts
url = https://github.com/jarro2783/cxxopts.git
[submodule "external/ghc-filesystem"]
path = external/ghc-filesystem
url = https://github.com/gulrak/filesystem.git
[submodule "test/Catch2"]
path = test/Catch2
url = https://github.com/catchorg/Catch2
[submodule "external/optional-lite"]
path = external/optional-lite
url = https://github.com/martinmoene/optional-lite.git
[submodule "external/date"]
path = external/date
url = https://github.com/HowardHinnant/date.git
[submodule "external/pybind11"]
path = external/pybind11
url = https://github.com/pybind/pybind11
branch = stable
[submodule "external/sqlite_orm"]
path = external/sqlite_orm
url = https://github.com/fnc12/sqlite_orm
[submodule "external/oxen-mq"]
path = external/oxen-mq
url = https://github.com/oxen-io/oxen-mq
[submodule "external/uvw"]
path = external/uvw
url = https://github.com/jagerman/uvw.git
[submodule "external/cpr"]
path = external/cpr
url = https://github.com/whoshuu/cpr
[submodule "external/ngtcp2"]
path = external/ngtcp2
url = https://github.com/ngtcp2/ngtcp2.git
branch = v0.1.0
[submodule "external/oxen-encoding"]
path = external/oxen-encoding
url = https://github.com/oxen-io/oxen-encoding.git
[submodule "external/oxen-logging"]
path = external/oxen-logging
url = https://github.com/oxen-io/oxen-logging.git
[submodule "gui"]
path = gui
url = https://github.com/oxen-io/lokinet-gui.git
[submodule "external/CLI11"]
path = external/CLI11
url = https://github.com/CLIUtils/CLI11.git

@ -1,182 +0,0 @@
language: cpp
dist: bionic
osx_image: xcode11.3
cache: ccache
matrix:
fast_finish: true
include:
- name: "lint check"
os: linux
compiler: gcc
env: MAKE_TARGET=format-verify PATH="/usr/lib/llvm-8/bin:$PATH"
addons:
apt:
sources:
- llvm-toolchain-bionic-8
packages:
- clang-format-8
- name: "make debug (linux/gcc)"
os: linux
compiler: gcc
env: BUILD_TYPE=Debug IS_NOTIFICATION=1
addons: &core_apt_addons
apt:
packages:
- build-essential
- cmake
- curl
- git
- libcap-dev
- libcurl4-openssl-dev
- libuv1-dev
- ninja-build
- libsodium-dev
- libsystemd-dev
- name: "make release (linux/gcc)"
os: linux
compiler: gcc
env: BUILD_TYPE=Release
addons: *core_apt_addons
- name: "make release (old linux/gcc)"
os: linux
dist: xenial
compiler: gcc
env: BUILD_TYPE=Release
addons: *core_apt_addons
- name: "make debug (linux/clang)"
os: linux
compiler: clang
env: BUILD_TYPE=Debug
addons: *core_apt_addons
- name: "make release (linux/clang)"
os: linux
compiler: clang
env: BUILD_TYPE=Release
addons: *core_apt_addons
- name: "make debug (macOS/clang)"
os: osx
env: BUILD_TYPE=Debug PATH="/usr/local/opt/ccache/libexec:$PATH"
- name: "make release (macOS/clang)"
os: osx
env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH"
- name: "make release (linux/gcc/arm64)"
arch: arm64
compiler: gcc
env: BUILD_TYPE=Release
addons: *core_apt_addons
- name: "make release (linux/gcc/s390x)"
arch: s390x
compiler: gcc
env: BUILD_TYPE=Release
addons: *core_apt_addons
- name: "make release (linux/gcc/ppc64le)"
arch: ppc64le
compiler: gcc
env: BUILD_TYPE=Release
addons: *core_apt_addons
# - name: "make iOS"
# os: osx
# env: MAKE_TARGET=ios PATH="/usr/local/opt/ccache/libexec:$PATH"
# - name: "make windows (macOS)"
# os: osx
# env: MAKE_TARGET=windows PATH="/usr/local/opt/ccache/libexec:$PATH"
# - name: "make windows-release (macOS)"
# os: osx
# env: MAKE_TARGET=windows-release PATH="/usr/local/opt/ccache/libexec:$PATH"
# - name: "make release (macOS beta/clang)"
# os: osx
# env: BUILD_TYPE=Release PATH="/usr/local/opt/ccache/libexec:$PATH"
# - name: "address sanitizer"
# os: osx
# env: BUILD_TYPE=Debug XSAN=address PATH="/usr/local/opt/ccache/libexec:$PATH" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
# - name: "thread sanitizer"
# os: osx
# env: BUILD_TYPE=Debug XSAN=thread PATH="/usr/local/opt/ccache/libexec:$PATH" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
# - name: "undefined sanitizer"
# os: osx
# env: BUILD_TYPE=Debug XSAN=undefined PATH="/usr/local/opt/ccache/libexec:$PATH" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
# - name: "memory sanitizer"
# os: linux
# compiler: clang
# env: BUILD_TYPE=Debug XSAN=memory
# addons: *core_apt_addons
# - name: "router docker image"
# os: linux
# dist: xenial
# env: DOCKER_FILE=docker/router.Dockerfile
# services: docker
- name: "make windows docker image"
os: linux
dist: xenial
env: DOCKER_FILE=docker/alpine-windows.Dockerfile
services: docker
- name: "gcc trunk"
os: linux
dist: xenial
env: DOCKER_FILE=docker/gcc-trunk.Dockerfile
services: docker
# - name: "native windows debug"
# os: windows
# env: BUILD_TYPE=Debug
# - name: "native windows release"
# os: windows
# env: BUILD_TYPE=Release
allow_failures:
- name: "make windows docker image"
- name: "native windows debug"
- name: "native windows release"
- name: "router docker image"
- name: "gcc trunk"
- arch: ppc64le
env:
global:
- NINJA=ninja
- STATIC_LINK=OFF
addons:
homebrew:
update: true
packages:
- ccache
- cmake
- curl
- libuv
- make
- ninja
- libsodium
before_install:
- if [ "$TRAVIS_OS_NAME" == "windows" ]; then
choco install curl make ninja;
choco upgrade cmake.install;
export CC="/c/Program Files/LLVM/bin/clang-cl";
export CXX="/c/Program Files/LLVM/bin/clang-cl";
fi
script:
- if [ "$TRAVIS_OS_NAME" == "windows" ]; then
cmd.exe /C '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64 && make test';
elif [[ ! -z $DOCKER_FILE ]]; then
docker build -f $DOCKER_FILE .;
else
make DOWNLOAD_SODIUM=ON ${MAKE_TARGET:-test};
fi
after_script:
- echo $TRAVIS_COMMIT_RANGE
- echo $TRAVIS_COMMIT_LOG
notifications:
webhooks:
urls: $WEBHOOK_URL
irc:
on_success: change
on_failure: change
channels:
- "chat.freenode.net#llarp"
nick: lokinet-ci
template:
- "%{result} | %{repository}#%{build_number} (%{commit} : %{author}) | Build details : %{build_url}"

@ -1,70 +1,137 @@
cmake_minimum_required(VERSION 3.5.1) # xenial's cmake version
cmake_minimum_required(VERSION 3.13...3.24) # 3.13 is buster's version
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "macOS deployment target (Apple clang only)")
option(BUILD_DAEMON "build lokinet daemon and associated utils" ON)
set(LANGS C CXX)
if(APPLE AND BUILD_DAEMON)
set(LANGS ${LANGS} OBJC Swift)
endif()
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
foreach(lang ${LANGS})
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/ccache")
message(STATUS "Enabling ccache for ${lang}")
set(CMAKE_${lang}_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "")
endif()
endforeach()
endif()
project(lokinet
VERSION 0.9.11
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES ${LANGS})
if(APPLE)
# Apple build number: must be incremented to submit a new build for the same lokinet version,
# should be reset to 0 when the lokinet version increments.
set(LOKINET_APPLE_BUILD 5)
endif()
set(RELEASE_MOTTO "Our Lord And Savior" CACHE STRING "Release motto")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(DEFAULT_WITH_BOOTSTRAP ON)
if(APPLE)
set(DEFAULT_WITH_BOOTSTRAP OFF)
endif()
set(PROJECT_NAME lokinet)
project(${PROJECT_NAME} C CXX)
# Core options
option(USE_AVX2 "enable avx2 code" OFF)
option(USE_NETNS "enable networking namespace support. Linux only" OFF)
option(NATIVE_BUILD "optimise for host system and FPU" ON)
option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF)
if (WIN32)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads" OFF)
else()
option(STATIC_LINK "link statically against dependencies" OFF)
endif()
option(SHADOW "use shadow testing framework. linux only" OFF)
option(XSAN "use sanitiser, if your system has it" OFF)
option(JEMALLOC "use jemalloc. Not required on BSD" OFF)
option(DEBIAN "build for debian" OFF)
option(WITH_EMBEDDED_LOKINET "build liblokinet.so for embedded lokinet" OFF)
option(XSAN "use sanitiser, if your system has it (requires -DCMAKE_BUILD_TYPE=Debug)" OFF)
option(USE_JEMALLOC "Link to jemalloc for memory allocations, if found" ON)
option(TESTNET "testnet build" OFF)
option(WITH_SHARED "build shared library" OFF)
option(WITH_COVERAGE "generate coverage data" OFF)
option(USE_SHELLHOOKS "enable shell hooks on compile time (dangerous)" OFF)
option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF)
option(TRACY_ROOT "include tracy profiler source" OFF)
option(WITH_TESTS "build unit tests" ON)
#option(WITH_SYSTEMD ...) defined below
option(WITH_TESTS "build unit tests" OFF)
option(WITH_HIVE "build simulation stubs" OFF)
option(BUILD_PACKAGE "builds extra components for making an installer (with 'make package')" OFF)
option(WITH_BOOTSTRAP "build lokinet-bootstrap tool" ${DEFAULT_WITH_BOOTSTRAP})
option(WITH_PEERSTATS "build with experimental peerstats db support" OFF)
option(STRIP_SYMBOLS "strip off all debug symbols into an external archive for all executables built" OFF)
set(BOOTSTRAP_FALLBACK_MAINNET "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed" CACHE PATH "Fallback bootstrap path (mainnet)")
set(BOOTSTRAP_FALLBACK_TESTNET "${PROJECT_SOURCE_DIR}/contrib/bootstrap/testnet.signed" CACHE PATH "Fallback bootstrap path (testnet)")
include(cmake/enable_lto.cmake)
option(CROSS_PLATFORM "cross compiler platform" "Linux")
option(CROSS_PREFIX "toolchain cross compiler prefix" "")
option(BUILD_STATIC_DEPS "Download, build, and statically link against core dependencies" OFF)
option(STATIC_LINK "link statically against dependencies" ${BUILD_STATIC_DEPS})
if(BUILD_STATIC_DEPS AND NOT STATIC_LINK)
message(FATAL_ERROR "Option BUILD_STATIC_DEPS requires STATIC_LINK to be enabled as well")
endif()
if(BUILD_STATIC_DEPS)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
include(StaticBuild)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
set(debug OFF)
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(debug ON)
add_definitions(-DLOKINET_DEBUG)
endif()
option(WARN_DEPRECATED "show deprecation warnings" ${debug})
if(BUILD_STATIC_DEPS AND STATIC_LINK)
message(STATUS "we are building static deps so we won't build shared libs")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
endif()
include(CheckCXXSourceCompiles)
include(CheckLibraryExists)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
include(cmake/target_link_libraries_system.cmake)
include(cmake/add_import_library.cmake)
include(cmake/add_log_tag.cmake)
include(cmake/libatomic.cmake)
if (STATIC_LINK AND STATIC_LINK_RUNTIME)
message(FATAL "Cannot set both STATIC_LINK and STATIC_LINK_RUNTIME")
endif()
if (STATIC_LINK)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
message(STATUS "setting static library suffix search")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(cmake/gui-option.cmake)
include(cmake/solaris.cmake)
include(cmake/win32.cmake)
include(cmake/macos.cmake)
# No in-source building
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out-of-source build. Create a build directory and run 'cmake ${CMAKE_SOURCE_DIR} [options]'.")
include(cmake/basic_definitions.cmake)
if(MSVC_VERSION)
enable_language(ASM_MASM)
list(APPEND CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS s)
add_definitions(-D_WIN32_WINNT=0x0600 -DNOMINMAX -DSODIUM_STATIC)
else()
enable_language(ASM)
endif(MSVC_VERSION)
# Always build PIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(cmake/solaris.cmake)
include(cmake/unix.cmake)
include(cmake/win32.cmake)
# try detecting the target arch and set the flags needed here
include(cmake/check_for_std_optional.cmake)
include(cmake/check_for_std_filesystem.cmake)
if(NOT WIN32)
if(IOS OR ANDROID)
set(NON_PC_TARGET ON)
@ -79,73 +146,63 @@ if(NOT WIN32)
endif()
endif()
set(CMAKE_CXX_STANDARD 14)
find_package(PkgConfig REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
# this is messing with release builds
add_compile_options(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
message( FATAL_ERROR "shadow-framework is Linux only" )
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
if(NOT DEBIAN AND NOT MSVC_VERSION)
set(OPTIMIZE_FLAGS -O3)
set(DEBUG_FLAGS -O0 -g3)
if(NOT BUILD_STATIC_DEPS)
pkg_check_modules(LIBUV libuv>=1.18.0 IMPORTED_TARGET)
endif()
if(LIBUV_FOUND AND NOT BUILD_STATIC_DEPS)
add_library(libuv INTERFACE)
target_link_libraries(libuv INTERFACE PkgConfig::LIBUV)
else()
if(NOT BUILD_STATIC_DEPS)
message(FATAL_ERROR "Could not find libuv >= 1.28.0; install it on your system or use -DBUILD_STATIC_DEPS=ON")
endif()
endif()
if(XSAN)
set(DEBUG_FLAGS ${DEBUG_FLAGS} "-fsanitize=${XSAN}" -fno-omit-frame-pointer)
set(OPTIMIZE_FLAGS "-O0")
message(STATUS "Doing a ${XSAN} sanitizer build")
endif(XSAN)
if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(OPTIMIZE_FLAGS "")
add_definitions(-DLOKINET_DEBUG=1)
set(CRYPTO_FLAGS "")
add_compile_options( ${DEBUG_FLAGS} )
link_libraries( ${DEBUG_FLAGS} )
endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
# Add non-386 target-specific options here
if(NON_PC_TARGET)
add_definitions(-DRPI)
set(WITH_STATIC ON)
endif(NON_PC_TARGET)
if(WITH_SHELLHOOKS)
add_definitions(-DENABLE_SHELLHOOKS)
endif(WITH_SHELLHOOKS)
if(NOT TARGET sodium)
# Allow -D DOWNLOAD_SODIUM=FORCE to download without even checking for a local libsodium
option(DOWNLOAD_SODIUM "Allow libsodium to be downloaded and built locally if not found on the system" OFF)
if(NOT DOWNLOAD_SODIUM STREQUAL "FORCE" AND NOT BUILD_STATIC_DEPS)
pkg_check_modules(SODIUM libsodium>=1.0.18 IMPORTED_TARGET)
endif()
# Always build PIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(sodium INTERFACE)
if(SODIUM_FOUND AND NOT DOWNLOAD_SODIUM STREQUAL "FORCE" AND NOT BUILD_STATIC_DEPS)
target_link_libraries(sodium INTERFACE PkgConfig::SODIUM)
else()
if(NOT DOWNLOAD_SODIUM AND NOT BUILD_STATIC_DEPS)
message(FATAL_ERROR "Could not find libsodium >= 1.0.18; either install it on your system or use -DDOWNLOAD_SODIUM=ON to download and build an internal copy")
endif()
message(STATUS "Sodium >= 1.0.18 not found, but DOWNLOAD_SODIUM specified, so downloading it")
include(DownloadLibSodium)
target_link_libraries(sodium INTERFACE sodium_vendor)
endif()
if(TRACY_ROOT)
include_directories(${TRACY_ROOT})
add_definitions(-DTRACY_ENABLE)
# Need this target export so that loki-mq properly picks up sodium
export(TARGETS sodium NAMESPACE sodium:: FILE sodium-exports.cmake)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-unknown-warning-option)
set(warning_flags -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-function -Werror=vla)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND warning_flags -Wno-unknown-warning-option)
endif()
if (NOT MSVC_VERSION)
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas)
# vla are evil
add_compile_options(-Wvla)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
if(WARN_DEPRECATED)
list(APPEND warning_flags -Wdeprecated-declarations)
else()
list(APPEND warning_flags -Wno-deprecated-declarations)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wthread-safety)
# If we blindly add these directly as compile_options then they get passed to swiftc on Apple and
# break, so we use a generate expression to set them only for C++/C/ObjC
add_compile_options("$<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:OBJC>>:${warning_flags}>")
if(XSAN)
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fsanitize=${XSAN} -fno-omit-frame-pointer -fno-sanitize-recover")
foreach(type EXE MODULE SHARED STATIC)
string(APPEND CMAKE_${type}_LINKER_FLAGS_DEBUG " -fsanitize=${XSAN} -fno-omit-frame-pointer -fno-sanitize-recover")
endforeach()
message(STATUS "Doing a ${XSAN} sanitizer build")
endif()
include(cmake/coverage.cmake)
@ -153,54 +210,34 @@ include(cmake/coverage.cmake)
# these vars are set by the cmake toolchain spec
if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
include(cmake/cross_compile.cmake)
endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
if(DEBIAN)
add_definitions(-DDEBIAN)
elseif(NATIVE_BUILD)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
set(CRYPTO_FLAGS -mcpu=native -mtune=native)
else()
set(CRYPTO_FLAGS -march=native -mtune=native)
endif()
elseif(NOT NON_PC_TARGET)
if (USE_AVX2)
set(CRYPTO_FLAGS -march=haswell -mtune=haswell -mfpmath=sse)
else()
# Public binary releases
set(CRYPTO_FLAGS -march=nocona -mtune=haswell -mfpmath=sse)
endif()
endif()
if(EMBEDDED_CFG)
message(WARNING "This configuration is optimised for older hardware and/or constrained node operation, may result in poor performance on desktop systems")
message(WARNING "For deployment on such systems, all external code (currently, libuv) must also be compiled for the target!")
set(CRYPTO_FLAGS -march=i486 -mtune=i486)
if(NOT APPLE)
if(NATIVE_BUILD)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
add_compile_options(-mcpu=native -mtune=native)
else()
add_compile_options(-march=native -mtune=native)
endif()
elseif(NOT NON_PC_TARGET)
if (USE_AVX2)
add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
else()
# Public binary releases
add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
endif()
endif()
endif()
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
include(cmake/static_link.cmake)
if(USE_NETNS)
add_definitions(-DNETNS=1)
else()
add_definitions(-DNETNS=0)
endif(USE_NETNS)
if(TESTNET)
add_definitions(-DTESTNET=1)
add_definitions(-DTESTNET)
# 5 times slower than realtime
add_definitions(-DTESTNET_SPEED=5)
endif(TESTNET)
if(SHADOW)
include(cmake/shadow.cmake)
endif(SHADOW)
# add_definitions(-DTESTNET_SPEED=5)
endif()
unset(GIT_VERSION)
unset(GIT_VERSION_REAL)
@ -208,93 +245,96 @@ unset(GIT_VERSION_REAL)
if(NOT GIT_VERSION)
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP)
string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION)
endif(NOT GIT_VERSION)
endif()
string(REGEX REPLACE "^fatal.*$" nogit GIT_VERSION_REAL "${GIT_VERSION}")
# HeapAlloc(2) on Windows was significantly revamped in 2009
# but the old algorithm isn't too bad either
# this is _the_ system allocator on BSD UNIX
# openbsd replaced it with a secure/randomised malloc not too
# long ago
if(JEMALLOC)
set(MALLOC_LIB jemalloc)
endif(JEMALLOC)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(SD libsystemd)
# Default WITH_SYSTEMD to true if we found it
option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND})
if(WITH_SYSTEMD)
if(NOT SD_FOUND)
message(FATAL_ERROR "libsystemd not found")
endif()
add_definitions(-DWITH_SYSTEMD)
include_directories(${SD_INCLUDE_DIRS})
set(SD_LIBS ${SD_LDFLAGS})
endif()
find_package(PkgConfig REQUIRED)
if (NOT BUILD_STATIC_DEPS)
pkg_check_modules(UNBOUND libunbound REQUIRED IMPORTED_TARGET)
add_library(libunbound INTERFACE)
target_link_libraries(libunbound INTERFACE PkgConfig::UNBOUND)
endif()
option(SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON)
if(SUBMODULE_CHECK)
find_package(Git)
if(GIT_FOUND)
function(check_submodule relative_path)
execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${relative_path} OUTPUT_VARIABLE localHead)
execute_process(COMMAND git rev-parse "HEAD:${relative_path}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE checkedHead)
string(COMPARE EQUAL "${localHead}" "${checkedHead}" upToDate)
if (upToDate)
message(STATUS "Submodule '${relative_path}' is up-to-date")
else()
message(FATAL_ERROR "Submodule '${relative_path}' is not up-to-date. Please update with\ngit submodule update --init --recursive\nor run cmake with -DSUBMODULE_CHECK=OFF")
endif()
endfunction ()
message(STATUS "Checking submodules")
check_submodule(external/nlohmann)
check_submodule(external/googletest)
check_submodule(external/cxxopts)
check_submodule(external/ghc-filesystem)
check_submodule(external/optional-lite)
check_submodule(external/date)
pkg_check_modules(SD libsystemd IMPORTED_TARGET)
# Default WITH_SYSTEMD to true if we found it
option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND})
# Base interface target where we set up global link libraries, definitions, includes, etc.
add_library(base_libs INTERFACE)
if(WITH_SYSTEMD AND (NOT ANDROID))
if(NOT SD_FOUND)
message(FATAL_ERROR "libsystemd not found")
endif()
target_link_libraries(base_libs INTERFACE PkgConfig::SD)
target_compile_definitions(base_libs INTERFACE WITH_SYSTEMD)
endif()
if(WITH_TESTS)
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
add_subdirectory(external)
if(USE_JEMALLOC AND NOT STATIC_LINK)
pkg_check_modules(JEMALLOC jemalloc IMPORTED_TARGET)
if(JEMALLOC_FOUND)
target_link_libraries(base_libs INTERFACE PkgConfig::JEMALLOC)
else()
message(STATUS "jemalloc not found, not linking to jemalloc")
endif()
else()
message(STATUS "jemalloc support disabled")
endif()
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(external/nlohmann EXCLUDE_FROM_ALL)
add_subdirectory(external/cxxopts EXCLUDE_FROM_ALL)
add_subdirectory(external/ghc-filesystem)
add_subdirectory(external/optional-lite EXCLUDE_FROM_ALL)
add_subdirectory(external/date EXCLUDE_FROM_ALL)
if(ANDROID)
list(APPEND LIBS log)
add_definitions(-DANDROID)
target_link_libraries(base_libs INTERFACE log)
target_compile_definitions(base_libs INTERFACE ANDROID)
set(ANDROID_PLATFORM_SRC android/ifaddrs.c)
endif(ANDROID)
endif()
set(LIBS ${MALLOC_LIB} ${LIBUV_LIBRARY} ${SD_LIBS})
if(TRACY_ROOT)
list(APPEND LIBS -ldl)
if(WITH_HIVE)
add_definitions(-DLOKINET_HIVE)
endif()
add_subdirectory(crypto)
add_subdirectory(llarp)
add_subdirectory(libabyss)
add_subdirectory(daemon)
if(BUILD_DAEMON)
add_subdirectory(daemon)
endif()
if (NOT SHADOW)
if(WITH_TESTS)
add_subdirectory(test)
endif()
if(ANDROID)
add_subdirectory(jni)
endif(ANDROID)
if(WITH_HIVE)
add_subdirectory(pybind)
endif()
if(WITH_TESTS OR WITH_HIVE)
add_subdirectory(test)
endif()
if(ANDROID)
add_subdirectory(jni)
endif()
add_subdirectory(docs)
include(cmake/gui.cmake)
if(APPLE)
macos_target_setup()
endif()
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
if(BUILD_PACKAGE AND NOT APPLE)
include(cmake/installer.cmake)
endif()
if(TARGET package)
add_dependencies(package assemble_gui)
endif()

@ -1,28 +0,0 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": []
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}

@ -3,7 +3,7 @@
* Act like a responsible adult.
* RUN `make format` BEFORE COMMITING ALWAYS.
* RUN `./contrib/format.sh` BEFORE COMMITING ALWAYS.
# Do NOT

@ -1,58 +0,0 @@
# Cross Compile
Currently supported targets:
Tier 1:
* Linux (arm/x86)
* Windows (32 and 64 bit x86)
* FreeBSD (amd64)
Tier 2:
* Mac OSX (> 10.10)
* Android (arm/x86)
* Apple IOS
* Linux PPC64 (little endian)
Tier 3:
* Big Endian Linux
* NetBSD
* OpenBSD
Unsupported (feel free to support this yourself)
* AIX
* zOS
## For Windows
To cross compile for windows on non windows platforms run:
$ make windows
## For Other Linux
## deps
this setup assumes ubuntu
first you need to cross compile and install libuv:
$ git clone https://github.com/libuv/libuv
$ mkdir -p build && cd build
$ export TOOLCHAIN=arm-linux-gnueabihf # or whatever your compiler is
$ cmake -DCMAKE_C_COMPILER=$(TOOLCHAIN)-gcc-8 -DCMAKE_INSTALL_PREFIX=/usr/$(TOOLCHAIN)
$ make
$ sudo make install
## build
To cross compile on linux for another archietecture:
# for rpi 3
$ make CROSS=ON TOOLCHAIN=contrib/armhf.toolchain.cmake
# for ppc64le
$ make CROSS=ON TOOLCHAIN=contrib/ppc64le.toolchain.cmake

2482
Doxyfile

File diff suppressed because it is too large Load Diff

@ -1,23 +1,674 @@
LokiNET is the reference implementation of LLARP (Low Latency Anonymous
Routing Protocol) and is licensed under ZLIB license, however the protocol
specifications are placed into the public domian using the CC0 License.
Copyright (c) 2018-2020 The Loki Project
Copyright (c) 2018-2020 Jeff Becker
Windows NT port and portions Copyright (c) 2018-2020 Rick V.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

@ -1,356 +0,0 @@
REPO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
NO_GIT := $(shell test -e $(REPO)/.git/ || echo 1)
ifeq ($(NO_GIT),1)
all: release
else
GIT_BRANCH ?= $(shell test -e $(REPO)/.git/ && git rev-parse --abbrev-ref HEAD)
ifeq ($(GIT_BRANCH),master)
all: release
else
all: test
endif
endif
BUILD_ROOT = $(REPO)/build
DESTDIR ?=
CC ?= cc
CXX ?= c++
BUILD_TYPE ?= Debug
PYTHON ?= python
PYTHON3 ?= python3
FORMAT ?= clang-format-8
SETCAP ?= which setcap && setcap cap_net_admin,cap_net_bind_service=+eip
SHADOW_ROOT ?= $(HOME)/.shadow
SHADOW_BIN=$(SHADOW_ROOT)/bin/shadow
SHADOW_CONFIG=$(REPO)/shadow.config.xml
SHADOW_PLUGIN=$(BUILD_ROOT)/libshadow-plugin-lokinet-shared.so
SHADOW_LOG=$(REPO)/shadow.log.txt
SHADOW_SRC ?= $(HOME)/local/shadow
SHADOW_PARSE ?= $(PYTHON) $(SHADOW_SRC)/src/tools/parse-shadow.py - -m 0 --packet-data
SHADOW_PLOT ?= $(PYTHON) $(SHADOW_SRC)/src/tools/plot-shadow.py -d $(REPO) LokiNET -c $(SHADOW_CONFIG) -r 10000 -e '.*'
SHADOW_OPTS ?=
LIBUV_VERSION ?= v1.30.1
LIBUV_PREFIX = $(BUILD_ROOT)/libuv
LIBCURL_PREFIX = $(BUILD_ROOT)/curl
LIBCURL_VERSION = 7.67.0
LIBCURL_URL = https://github.com/curl/curl/releases/download/curl-7_67_0/curl-7.67.0.tar.xz
LIBCURL_SHA256 = f5d2e7320379338c3952dcc7566a140abb49edb575f9f99272455785c40e536c
TESTNET_ROOT=/tmp/lokinet_testnet_tmp
TESTNET_CONF=$(TESTNET_ROOT)/supervisor.conf
TESTNET_LOG=$(TESTNET_ROOT)/testnet.log
TESTNET_VENV=$(TESTNET_ROOT)/v
TESTNET_EXE=$(REPO)/lokinet-testnet
TESTNET_CLIENTS ?= 50
TESTNET_SERVERS ?= 50
TESTNET_DEBUG ?= 0
TESTNET_IFNAME ?= lo
TESTNET_BASEPORT ?= 1900
TESTNET_IP ?= 127.0.0.1
TESTNET_NETID ?= loopback
ANDROID_NDK ?= $(HOME)/Android/Ndk
ANDROID_SDK ?= $(HOME)/Android/Sdk
ANDROID_ABI ?= armeabi-v7a
ANDROID_API_LEVEL ?= 24
ANDROID_DIR=$(REPO)/android
JNI_DIR=$(ANDROID_DIR)/jni
ANDROID_MK=$(JNI_DIR)/Android.mk
ANDROID_PROPS=$(ANDROID_DIR)/gradle.properties
ANDROID_LOCAL_PROPS=$(ANDROID_DIR)/local.properties
GRADLE ?= gradle
JAVA_HOME ?= /usr/lib/jvm/default-java
TOOLCHAIN ?=
# native avx2 code
AVX2 ?= OFF
# statically link everything
STATIC_LINK ?= OFF
# statically link dependencies
STATIC ?= OFF
# enable network namespace isolation
NETNS ?= OFF
# enable shell hooks callbacks
SHELL_HOOKS ?= OFF
# cross compile?
CROSS ?= OFF
# build liblokinet-shared.so
SHARED_LIB ?= OFF
# enable generating coverage
COVERAGE ?= OFF
# allow downloading libsodium if >= 1.0.18 not installed
DOWNLOAD_SODIUM ?= OFF
COVERAGE_OUTDIR ?= "$(TMPDIR)/lokinet-coverage"
# tracy profiler
TRACY_ROOT ?=
# enable sanitizer
XSAN ?= False
# cmake generator type
CMAKE_GEN ?= Unix Makefiles
ifdef NINJA
MAKE = $(NINJA)
CMAKE_GEN = Ninja
endif
SCAN_BUILD ?= scan-build
UNAME = $(shell which uname)
COMMON_CMAKE_OPTIONS = -DSTATIC_LINK_RUNTIME=$(STATIC_LINK) -DUSE_NETNS=$(NETNS) -DUSE_AVX2=$(AVX2) -DWITH_SHARED=$(SHARED_LIB) -DDOWNLOAD_SODIUM=$(DOWNLOAD_SODIUM) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DXSAN=$(XSAN)
ifeq ($(shell $(UNAME)),SunOS)
CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
CONFIG_CMD_WINDOWS = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
ANALYZE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "$(SCAN_BUILD) cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
COVERAGE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DWITH_COVERAGE=yes $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
else
CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DUSE_SHELLHOOKS=$(SHELL_HOOKS) -DTRACY_ROOT=$(TRACY_ROOT) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
CONFIG_CMD_WINDOWS = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
ANALYZE_CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "$(SCAN_BUILD) cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
COVERAGE_CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DWITH_COVERAGE=yes $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
endif
TARGETS = $(REPO)/lokinet
SIGS = $(TARGETS:=.sig)
EXE = $(BUILD_ROOT)/daemon/lokinet
TEST_EXE = $(BUILD_ROOT)/test/testAll
ABYSS_EXE = $(BUILD_ROOT)/abyss-main
LINT_FILES = $(wildcard llarp/*.cpp)
LINT_CHECK = $(LINT_FILES:.cpp=.cpp-check)
clean: android-clean
rm -f $(TARGETS)
rm -rf $(BUILD_ROOT)
rm -f $(SHADOW_PLUGIN) $(SHADOW_CONFIG)
rm -f *.sig
rm -f *.a *.so
android-clean:
rm -rf $(ANDROID_DIR)/.externalNativeBuild
debug-configure:
mkdir -p '$(BUILD_ROOT)'
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)') || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) )
release-configure: clean
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
debug: debug-configure
$(MAKE) -C $(BUILD_ROOT)
cp $(EXE) $(REPO)/lokinet
release-compile: release-configure
$(MAKE) -C $(BUILD_ROOT)
strip $(EXE)
$(TARGETS): release-compile
release: $(TARGETS)
make -C '$(BUILD_ROOT)' check
shadow-configure: clean
mkdir -p $(BUILD_ROOT)
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSHADOW=ON
shadow-build: shadow-configure
$(MAKE) -C $(BUILD_ROOT)
shadow-run: shadow-build
$(PYTHON3) $(REPO)/contrib/shadow/genconf.py $(SHADOW_CONFIG)
cp $(SHADOW_PLUGIN) $(REPO)/libshadow-plugin-lokinet.so
$(SHADOW_BIN) $(SHADOW_OPTS) $(SHADOW_CONFIG) | $(SHADOW_PARSE)
shadow-plot: shadow-run
$(SHADOW_PLOT)
shadow: shadow-plot
testnet-clean: clean
rm -rf $(TESTNET_ROOT)
testnet-configure: testnet-clean
mkdir -p $(BUILD_ROOT)
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=1
testnet-build: testnet-configure
$(MAKE) -C $(BUILD_ROOT)
$(TESTNET_VENV):
$(PYTHON3) -m venv $(TESTNET_VENV) --system-site-packages
$(TESTNET_VENV)/bin/pip install -r $(REPO)/contrib/testnet/requirements.txt
testnet: $(TESTNET_VENV)
cp $(EXE) $(TESTNET_EXE)
mkdir -p $(TESTNET_ROOT)
$(PYTHON3) $(REPO)/contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF) --ifname=$(TESTNET_IFNAME) --baseport=$(TESTNET_BASEPORT) --ip=$(TESTNET_IP) --netid=$(TESTNET_NETID) --lokid='$(TESTNET_VENV)/bin/python $(REPO)/contrib/testnet/lokid.py'
LLARP_DEBUG=$(TESTNET_DEBUG) supervisord -n -d $(TESTNET_ROOT) -l $(TESTNET_LOG) -c $(TESTNET_CONF)
gtest: debug
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) rungtest || test x$(CROSS) = xON
catch: debug
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) catch || test x$(CROSS) = xON
check: debug
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || test x$(CROSS) = xON
test: check
static-configure: $(LIBUV_PREFIX) $(LIBCURL_PREFIX)
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' ) || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) -DNATIVE_BUILD=OFF )
static: static-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp $(EXE) $(REPO)/lokinet-static
$(LIBCURL_PREFIX):
mkdir -p '$(BUILD_ROOT)'
wget '$(LIBCURL_URL)' -O '$(BUILD_ROOT)/curl.tar.xz'
bash -c 'sha256sum -c <<<"$(LIBCURL_SHA256) $(BUILD_ROOT)/curl.tar.xz"'
tar -xJf '$(BUILD_ROOT)/curl.tar.xz' -C '$(BUILD_ROOT)'
mv '$(BUILD_ROOT)/curl-$(LIBCURL_VERSION)' '$(LIBCURL_PREFIX)'
$(LIBUV_PREFIX):
mkdir -p $(BUILD_ROOT)
git clone -b "$(LIBUV_VERSION)" https://github.com/libuv/libuv "$(LIBUV_PREFIX)"
ios:
cmake -S ui-ios -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=$(shell pwd)/ui-ios/ios-toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=12.2 -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO -DCMAKE_IOS_INSTALL_COMBINED=YES
cmake --build build
android-gradle-prepare: $(LIBUV_PREFIX)
rm -f $(ANDROID_PROPS)
rm -f $(ANDROID_LOCAL_PROPS)
echo "#auto generated don't modify kthnx" >> $(ANDROID_PROPS)
echo "libuvsrc=$(LIBUV_PREFIX)" >> $(ANDROID_PROPS)
echo "lokinetCMake=$(REPO)/CMakeLists.txt" >> $(ANDROID_PROPS)
echo "org.gradle.parallel=true" >> $(ANDROID_PROPS)
echo "org.gradle.jvmargs=-Xmx1536M" >> $(ANDROID_PROPS)
echo "#auto generated don't modify kthnx" >> $(ANDROID_LOCAL_PROPS)
echo "sdk.dir=$(ANDROID_SDK)" >> $(ANDROID_LOCAL_PROPS)
echo "ndk.dir=$(ANDROID_NDK)" >> $(ANDROID_LOCAL_PROPS)
android-gradle: android-gradle-prepare
cd $(ANDROID_DIR) && JAVA_HOME=$(JAVA_HOME) $(GRADLE) clean assemble
android: android-gradle
cp -f $(ANDROID_DIR)/build/outputs/apk/*.apk $(REPO)
windows-debug-configure: $(LIBUV_PREFIX)
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD_WINDOWS) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$(LIBUV_PREFIX)
windows-debug: windows-debug-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp '$(BUILD_ROOT)/daemon/lokinet.exe' '$(REPO)/lokinet.exe'
windows-release-configure: $(LIBUV_PREFIX)
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD_WINDOWS) -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$(LIBUV_PREFIX)
windows-release: windows-release-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp '$(BUILD_ROOT)/daemon/lokinet.exe' '$(REPO)/lokinet.exe'
windows: windows-debug
abyss: debug
$(ABYSS_EXE)
format:
$(FORMAT) -i $$(find jni daemon llarp include libabyss | grep -E '\.[h,c](pp)?$$')
format-verify: format
(type $(FORMAT))
$(FORMAT) --version
git diff --quiet || (echo 'Please run make format!!' && git --no-pager diff ; exit 1)
analyze-config: clean
mkdir -p '$(BUILD_ROOT)'
$(ANALYZE_CONFIG_CMD)
analyze: analyze-config
$(SCAN_BUILD) $(MAKE) -C $(BUILD_ROOT)
coverage-config: clean
mkdir -p '$(BUILD_ROOT)'
$(COVERAGE_CONFIG_CMD)
coverage: coverage-config
$(MAKE) -C $(BUILD_ROOT)
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || true # continue even if tests fail
mkdir -p "$(COVERAGE_OUTDIR)"
ifeq ($(CLANG),OFF)
gcovr -r . --branches --html --html-details -o "$(COVERAGE_OUTDIR)/lokinet.html"
else
llvm-profdata merge default.profraw -output $(BUILD_ROOT)/profdata
llvm-cov show -format=html -output-dir="$(COVERAGE_OUTDIR)" -instr-profile "$(BUILD_ROOT)/profdata" "$(BUILD_ROOT)/testAll" $(shell find ./llarp -type f)
endif
lint: $(LINT_CHECK)
%.cpp-check: %.cpp
clang-tidy $^ -- -I$(REPO)/include -I$(REPO)/crypto/include -I$(REPO)/llarp -I$(REPO)/vendor/cppbackport-master/lib
docker-kubernetes:
docker build -f docker/loki-svc-kubernetes.Dockerfile .
install-pylokinet:
cd $(REPO)/contrib/py/pylokinet && $(PYTHON3) setup.py install
kubernetes-install: install install-pylokinet
docker-debian:
docker build -f docker/debian.Dockerfile .
docker-fedora:
docker build -f docker/fedora.Dockerfile .
debian-configure:
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DDEBIAN=ON -DRELEASE_MOTTO="$(shell cat $(REPO)/motto.txt)" -DCMAKE_BUILD_TYPE=Release
debian: debian-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp $(EXE) lokinet
debian-test:
test x$(CROSS) = xOFF && $(MAKE) -C $(BUILD_ROOT) check || test x$(CROSS) = xON
install:
DESTDIR=$(DESTDIR) $(MAKE) -C '$(BUILD_ROOT)' install
.PHONY: debian-install

18
android/.gitignore vendored

@ -1,18 +0,0 @@
gen
tests
bin
libs
log*
obj
.gradle
.idea
.externalNativeBuild
ant.properties
local.properties
build.sh
android.iml
build
gradle
gradlew
gradlew.bat
gradle.properties

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="network.loki.lokinet"
android:installLocation="auto"
android:versionCode="1"
android:versionName="0.3.2">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" /> <!-- normal perm, per https://developer.android.com/guide/topics/permissions/normal-permissions.html -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- normal perm -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
>
<receiver android:name=".NetworkStateChangeReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<activity
android:name=".LokiNetActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".LokinetService"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
</service>
</application>
</manifest>

@ -1,75 +0,0 @@
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.1"
defaultConfig {
applicationId "network.loki.lokinet"
targetSdkVersion 28
minSdkVersion 23
versionCode 1
versionName "0.4.0"
ndk {
abiFilters 'armeabi'
}
externalNativeBuild {
cmake {
targets "lokinetandroid"
arguments "-DANDROID=ON", "-DANDROID_STL=c++_static", "-DANDROID_ARM_NEON=TRUE", "-DLIBUV_ROOT=" + libuvsrc, "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_MODE=arm"
cppFlags "-fexceptions -std=c++14 -frtti"
}
}
packagingOptions{
doNotStrip "*/armeabi/*.so"
doNotStrip "*/armeabi-v7a/*.so"
doNotStrip "*/x86/*.so"
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
jniLibs.srcDirs = ['libs']
assets.srcDirs = ['assets']
}
}
signingConfigs {
jeff {
storeFile file("jeff-apk.jks")
keyAlias "jeff-apk"
}
}
buildTypes {
release {
minifyEnabled true
//signingConfig signingConfigs.jeff
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
externalNativeBuild {
cmake {
path lokinetCMake
}
}
}

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="lokinet" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Insert sdk.dir=... into './local.properties'. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<fail
message="ndk.dir is missing. Insert ndk.dir=... into './local.properties'."
unless="ndk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-28

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

@ -1,27 +0,0 @@
<LinearLayout android:id="@+id/main_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/vertical_page_margin"
android:paddingLeft="@dimen/horizontal_page_margin"
android:paddingRight="@dimen/horizontal_page_margin"
android:paddingTop="@dimen/vertical_page_margin"
tools:context=".PermsAskerActivity">
<TextView
android:id="@+id/textview_retry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/horizontal_page_margin"
android:visibility="gone"
/>
<Button
android:id="@+id/button_request_write_ext_storage_perms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Retry requesting VPN"
android:visibility="gone"/>
</LinearLayout>

@ -1,27 +0,0 @@
<LinearLayout android:id="@+id/layout_prompt"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/vertical_page_margin"
android:paddingLeft="@dimen/horizontal_page_margin"
android:paddingRight="@dimen/horizontal_page_margin"
android:paddingTop="@dimen/vertical_page_margin"
tools:context=".PermsAskerActivity">
<TextView
android:id="@+id/textview_explanation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/horizontal_page_margin"
android:text="VPN permissions are required for lokinet usage."
/>
<Button
android:id="@+id/button_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
/>
</LinearLayout>

@ -1,16 +0,0 @@
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".LokiNetActivity">
<item
android:id="@+id/action_start"
android:title="@string/action_start"
android:orderInCategory="98"
/>
<item
android:id="@+id/action_stop"
android:title="@string/action_stop"
android:orderInCategory="99"
/>
</menu>

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">lokinet</string>
<string name="action_start">Start</string>
<string name="action_stop">Stop</string>
<string name="already_stopped">Already stopped</string>
<string name="loaded">lokinet loaded</string>
<string name="starting">lokinet is starting</string>
<string name="jniLibraryLoaded">lokinet: loaded JNI libraries</string>
<string name="startedOkay">lokinet started</string>
<string name="startFailed">lokinet start failed</string>
<string name="stopped">lokinet has stopped</string>
<string name="remaining">remaining</string>
<string name="title_activity_perms_asker_prompt">Prompt</string>
<string name="bootstrap_ok">got bootstrap node info</string>
<string name="bootstrap_fail">failed to bootstrap</string>
<string name="netdb_create_fail">failed to create netdb directory</string>
<string name="vpn_setup_fail">failed to set up vpn tunnel</string>
</resources>

@ -1,16 +0,0 @@
<resources>
<!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
<dimen name="margin_tiny">4dp</dimen>
<dimen name="margin_small">8dp</dimen>
<dimen name="margin_medium">16dp</dimen>
<dimen name="margin_large">32dp</dimen>
<dimen name="margin_huge">64dp</dimen>
<!-- Semantic definitions -->
<dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
<dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
</resources>

@ -1 +0,0 @@
rootProject.name = "lokinet"

@ -1,157 +0,0 @@
package network.loki.lokinet;
import java.io.File;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.app.Activity;
import android.content.Context;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.AsyncTask;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class LokiNetActivity extends Activity {
private static final String TAG = "lokinet-activity";
private TextView textView;
private static final String DefaultBootstrapURL = "https://seed.lokinet.org/bootstrap.signed";
private AsyncBootstrap bootstrapper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
textView = new TextView(this);
setContentView(textView);
System.loadLibrary("lokinetandroid");
}
private static void writeFile(File out, InputStream instream) throws IOException {
OutputStream outstream = new FileOutputStream(out);
byte[] buffer = new byte[512];
int len;
try {
do {
len = instream.read(buffer);
if (len > 0) {
outstream.write(buffer, 0, len);
}
}
while (len != -1);
} finally {
outstream.close();
}
}
public void startLokinet()
{
if(bootstrapper != null)
return;
bootstrapper = new AsyncBootstrap();
bootstrapper.execute(DefaultBootstrapURL);
}
public void runLokinetService()
{
startService(new Intent(LokiNetActivity.this,
LokinetService.class));
}
@Override
protected void onDestroy() {
super.onDestroy();
textView = null;
}
public File getRootDir()
{
return getFilesDir();
}
private class AsyncBootstrap extends AsyncTask<String, String, String>
{
public String doInBackground(String ... urls) {
try
{
File bootstrapFile = new File(getRootDir(), "bootstrap.signed");
URL bootstrapURL = new URL(urls[0]);
InputStream instream = bootstrapURL.openStream();
writeFile(bootstrapFile, instream);
instream.close();
return getString(R.string.bootstrap_ok);
}
catch(Exception thrown)
{
return getString(R.string.bootstrap_fail) + ": " + throwableToString(thrown);
}
}
public void onPostExecute(String val) {
textView.setText(val);
if(val.equals(getString(R.string.bootstrap_ok)))
runLokinetService();
bootstrapDone();
}
}
private void bootstrapDone()
{
bootstrapper = null;
}
private CharSequence throwableToString(Throwable tr) {
StringWriter sw = new StringWriter(8192);
PrintWriter pw = new PrintWriter(sw);
tr.printStackTrace(pw);
pw.close();
return sw.toString();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.options_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch(id){
case R.id.action_start:
startLokinet();
return true;
case R.id.action_stop:
return true;
}
return super.onOptionsItemSelected(item);
}
}

@ -1,9 +0,0 @@
package network.loki.lokinet;
import android.net.VpnService;
public class LokinetService extends VpnService
{
}

@ -1,28 +0,0 @@
package network.loki.lokinet;
import android.util.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class NetworkStateChangeReceiver extends BroadcastReceiver {
private static final String TAG = "lokinet";
//api level 1
@Override
public void onReceive(final Context context, final Intent intent) {
Log.d(TAG,"Network state change");
try {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
boolean isConnected = activeNetworkInfo!=null && activeNetworkInfo.isConnected();
// https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html?hl=ru
// boolean isWiFi = activeNetworkInfo!=null && (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI);
} catch (Throwable tr) {
Log.d(TAG,"",tr);
}
}
}

@ -1,173 +0,0 @@
package network.loki.lokinet;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.lang.reflect.Method;
//dangerous perms, per https://developer.android.com/guide/topics/permissions/normal-permissions.html :
//android.permission.WRITE_EXTERNAL_STORAGE
public class PermsAskerActivity extends Activity {
private static final int PERMISSION_VPN = 0;
private Button button_request_write_ext_storage_perms;
private TextView textview_retry;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startMainActivity();
/*
//if less than Android 6, no runtime perms req system present
if (android.os.Build.VERSION.SDK_INT < 23) {
return;
}
setContentView(R.layout.activity_perms_asker);
button_request_write_ext_storage_perms = (Button) findViewById(R.id.button_request_write_ext_storage_perms);
textview_retry = (TextView) findViewById(R.id.textview_retry);
button_request_write_ext_storage_perms.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
request_write_ext_storage_perms();
}
});
request_write_ext_storage_perms();
*/
}
private void request_write_ext_storage_perms() {
textview_retry.setVisibility(TextView.GONE);
button_request_write_ext_storage_perms.setVisibility(Button.GONE);
Method methodCheckPermission;
Method method_shouldShowRequestPermissionRationale;
Method method_requestPermissions;
try {
methodCheckPermission = getClass().getMethod("checkSelfPermission", String.class);
method_shouldShowRequestPermissionRationale =
getClass().getMethod("shouldShowRequestPermissionRationale", String.class);
method_requestPermissions =
getClass().getMethod("requestPermissions", String[].class, int.class);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
Integer resultObj;
try {
resultObj = (Integer) methodCheckPermission.invoke(
this, Manifest.permission.BIND_VPN_SERVICE);
} catch (Throwable e) {
throw new RuntimeException(e);
}
if (resultObj != PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
Boolean aBoolean;
try {
aBoolean = (Boolean) method_shouldShowRequestPermissionRationale.invoke(this,
Manifest.permission.BIND_VPN_SERVICE);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (aBoolean) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
showExplanation();
} else {
// No explanation needed, we can request the permission.
try {
method_requestPermissions.invoke(this,
new String[]{Manifest.permission.BIND_VPN_SERVICE},
PERMISSION_VPN);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} else startMainActivity();
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case PERMISSION_VPN: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
startMainActivity();
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
textview_retry.setText("you need to allow this to continue");
textview_retry.setVisibility(TextView.VISIBLE);
button_request_write_ext_storage_perms.setVisibility(Button.VISIBLE);
}
return;
}
// other 'case' lines to check for other
// permissions this app might request.
}
}
private void startMainActivity() {
startActivity(new Intent(this, LokiNetActivity.class));
finish();
}
private static final int SHOW_EXPLANATION_REQUEST = 1; // The request code
private void showExplanation() {
Intent intent = new Intent(this, PermsExplanationActivity.class);
startActivityForResult(intent, SHOW_EXPLANATION_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Check which request we're responding to
if (requestCode == SHOW_EXPLANATION_REQUEST) {
// Make sure the request was successful
if (resultCode == RESULT_OK) {
// Request the permission
Method method_requestPermissions;
try {
method_requestPermissions =
getClass().getMethod("requestPermissions", String[].class, int.class);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
try {
method_requestPermissions.invoke(this,
new String[]{Manifest.permission.BIND_VPN_SERVICE},
PERMISSION_VPN);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
finish(); //close the app
}
}
}
}

@ -1,38 +0,0 @@
package network.loki.lokinet;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
public class PermsExplanationActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_perms_explanation);
ActionBar actionBar = getActionBar();
if(actionBar!=null)actionBar.setHomeButtonEnabled(false);
Button button_ok = (Button) findViewById(R.id.button_ok);
button_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
returnFromActivity();
}
});
}
private void returnFromActivity() {
Intent data = new Intent();
Activity parent = getParent();
if (parent == null) {
setResult(Activity.RESULT_OK, data);
} else {
parent.setResult(Activity.RESULT_OK, data);
}
finish();
}
}

@ -1,6 +0,0 @@
int
main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
{
return 0;
}

@ -0,0 +1,57 @@
set(LIBCURL_PREFIX ${CMAKE_BINARY_DIR}/libcurl)
set(LIBCURL_URL https://github.com/curl/curl/releases/download/curl-7_67_0/curl-7.67.0.tar.xz)
set(LIBCURL_HASH SHA256=f5d2e7320379338c3952dcc7566a140abb49edb575f9f99272455785c40e536c)
if(CURL_TARBALL_URL)
# make a build time override of the tarball url so we can fetch it if the original link goes away
set(LIBCURL_URL ${CURL_TARBALL_URL})
endif()
file(MAKE_DIRECTORY ${LIBCURL_PREFIX}/include)
include(ExternalProject)
include(ProcessorCount)
ProcessorCount(PROCESSOR_COUNT)
if(PROCESSOR_COUNT EQUAL 0)
set(PROCESSOR_COUNT 1)
endif()
set(libcurl_cc ${CMAKE_C_COMPILER})
if(CCACHE_PROGRAM)
set(libcurl_cc "${CCACHE_PROGRAM} ${libcurl_cc}")
endif()
set(CURL_CONFIGURE ./configure --prefix=${LIBCURL_PREFIX}
--without-ssl --without-nss --without-gnutls --without-mbedtls --without-wolfssl --without-mesalink
--without-bearssl --without-ca-bundle --without-libidn2 --without-zlib --without-nghttp2 --without-nghttp3
--without-quiche --without-zsh-functions-dir --without-fish-functions-dir
--without-librtmp --without-ca-fallback --without-ca-path --without-brotli --without-libpsl
--disable-manual --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-ldaps
--disable-pop3 --disable-rtsp --disable-smtp --disable-telnet --disable-tftp
--enable-static --disable-shared CC=${libcurl_cc})
if (CMAKE_C_COMPILER_ARG1)
set(CURL_CONFIGURE ${CURL_CONFIGURE} CPPFLAGS=${CMAKE_C_COMPILER_ARG1})
endif()
if (CROSS_TARGET)
set(CURL_CONFIGURE ${CURL_CONFIGURE} --target=${CROSS_TARGET} --host=${CROSS_TARGET})
endif()
ExternalProject_Add(libcurl_external
BUILD_IN_SOURCE ON
PREFIX ${LIBCURL_PREFIX}
URL ${LIBCURL_URL}
URL_HASH ${LIBCURL_HASH}
CONFIGURE_COMMAND ${CURL_CONFIGURE}
BUILD_COMMAND make -j${PROCESSOR_COUNT}
BUILD_BYPRODUCTS ${LIBCURL_PREFIX}/lib/libcurl.a ${LIBCURL_PREFIX}/include
)
add_library(curl_vendor STATIC IMPORTED GLOBAL)
add_dependencies(curl_vendor curl_external)
set_target_properties(curl_vendor PROPERTIES
IMPORTED_LOCATION ${LIBCURL_PREFIX}/lib/libcurl.a
INTERFACE_INCLUDE_DIRECTORIES ${LIBCURL_PREFIX}/include
)

@ -12,15 +12,22 @@ file(MAKE_DIRECTORY ${LIBSODIUM_PREFIX}/include)
include(ExternalProject)
include(ProcessorCount)
ProcessorCount(PROCESSOR_COUNT)
if(PROCESSOR_COUNT EQUAL 0)
set(PROCESSOR_COUNT 1)
endif()
set(sodium_cc ${CMAKE_C_COMPILER})
if(CCACHE_PROGRAM)
set(sodium_cc "${CCACHE_PROGRAM} ${sodium_cc}")
endif()
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared --with-pic --quiet CC=${sodium_cc})
if (CMAKE_C_COMPILER_ARG1)
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared CC=${CMAKE_C_COMPILER} CPPFLAGS=${CMAKE_C_COMPILER_ARG1})
else()
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared CC=${CMAKE_C_COMPILER})
set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} CPPFLAGS=${CMAKE_C_COMPILER_ARG1})
endif()
if (LIBSODIUM_CROSS_TARGET)
set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} --target=${LIBSODIUM_CROSS_TARGET} --host=${LIBSODIUM_CROSS_TARGET})
if (CROSS_TARGET)
set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} --target=${CROSS_TARGET} --host=${CROSS_TARGET})
endif()
@ -30,6 +37,7 @@ ExternalProject_Add(libsodium_external
URL ${LIBSODIUM_URL}
URL_HASH ${LIBSODIUM_HASH}
CONFIGURE_COMMAND ${SODIUM_CONFIGURE}
PATCH_COMMAND patch -p1 -d <SOURCE_DIR> < ${CMAKE_SOURCE_DIR}/win32-setup/libsodium-1.0.18-win32.patch
BUILD_COMMAND make -j${PROCESSOR_COUNT}
INSTALL_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${LIBSODIUM_PREFIX}/lib/libsodium.a ${LIBSODIUM_PREFIX}/include

@ -0,0 +1,57 @@
#
# Find the JEMALLOC client includes and library
#
# This module defines
# JEMALLOC_INCLUDE_DIR, where to find jemalloc.h
# JEMALLOC_LIBRARIES, the libraries to link against
# JEMALLOC_FOUND, if false, you cannot build anything that requires JEMALLOC
# also defined, but not for general use are
# JEMALLOC_LIBRARY, where to find the JEMALLOC library.
set( JEMALLOC_FOUND 0 )
if ( UNIX )
FIND_PATH( JEMALLOC_INCLUDE_DIR
NAMES
jemalloc/jemalloc.h
PATHS
/usr/include
/usr/include/jemalloc
/usr/local/include
/usr/local/include/jemalloc
$ENV{JEMALLOC_ROOT}
$ENV{JEMALLOC_ROOT}/include
DOC
"Specify include-directories that might contain jemalloc.h here."
)
FIND_LIBRARY( JEMALLOC_LIBRARY
NAMES
jemalloc libjemalloc JEMALLOC
PATHS
/usr/lib
/usr/lib/jemalloc
/usr/local/lib
/usr/local/lib/jemalloc
/usr/local/jemalloc/lib
$ENV{JEMALLOC_ROOT}/lib
$ENV{JEMALLOC_ROOT}
DOC "Specify library-locations that might contain the jemalloc library here."
)
if ( JEMALLOC_LIBRARY )
if ( JEMALLOC_INCLUDE_DIR )
set( JEMALLOC_FOUND 1 )
message( STATUS "Found JEMALLOC library: ${JEMALLOC_LIBRARY}")
message( STATUS "Found JEMALLOC headers: ${JEMALLOC_INCLUDE_DIR}")
else ( JEMALLOC_INCLUDE_DIR )
message(FATAL_ERROR "Could not find jemalloc headers! Please install jemalloc libraries and headers")
endif ( JEMALLOC_INCLUDE_DIR )
endif ( JEMALLOC_LIBRARY )
add_library(jemalloc SHARED IMPORTED)
set_target_properties(jemalloc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DUR}"
IMPORTED_LOCATION "${JEMALLOC_LIBRARY}")
mark_as_advanced( JEMALLOC_FOUND JEMALLOC_LIBRARY JEMALLOC_EXTRA_LIBRARIES JEMALLOC_INCLUDE_DIR )
endif (UNIX)

@ -1,288 +0,0 @@
# Written in 2016 by Henrik Steffen Gaßmann <henrik@gassmann.onl>
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication
# along with this software. If not, see
#
# http://creativecommons.org/publicdomain/zero/1.0/
#
########################################################################
# Tries to find the local libsodium installation.
#
# On Windows the sodium_DIR environment variable is used as a default
# hint which can be overridden by setting the corresponding cmake variable.
#
# Once done the following variables will be defined:
#
# sodium_FOUND
# sodium_INCLUDE_DIR
# sodium_LIBRARY_DEBUG
# sodium_LIBRARY_RELEASE
#
#
# Furthermore an imported "sodium" target is created.
#
if (CMAKE_C_COMPILER_ID STREQUAL "GNU"
OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(_GCC_COMPATIBLE 1)
endif()
# static library option
if (NOT DEFINED sodium_USE_STATIC_LIBS)
option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
endif()
if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST))
unset(sodium_LIBRARY CACHE)
unset(sodium_LIBRARY_DEBUG CACHE)
unset(sodium_LIBRARY_RELEASE CACHE)
unset(sodium_DLL_DEBUG CACHE)
unset(sodium_DLL_RELEASE CACHE)
set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable")
endif()
########################################################################
# UNIX
if (UNIX)
# import pkg-config
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(sodium_PKG QUIET libsodium>=${Sodium_FIND_VERSION})
endif()
if(sodium_USE_STATIC_LIBS)
foreach(_libname ${sodium_PKG_STATIC_LIBRARIES})
if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a
list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a")
endif()
endforeach()
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
# if pkgconfig for libsodium doesn't provide
# static lib info, then override PKG_STATIC here..
if (sodium_PKG_STATIC_LIBRARIES STREQUAL "")
set(sodium_PKG_STATIC_LIBRARIES libsodium.a)
endif()
set(XPREFIX sodium_PKG_STATIC)
else()
if (sodium_PKG_LIBRARIES STREQUAL "")
set(sodium_PKG_LIBRARIES sodium)
endif()
set(XPREFIX sodium_PKG)
endif()
find_path(sodium_INCLUDE_DIR sodium.h
HINTS ${${XPREFIX}_INCLUDE_DIRS} /usr/local/include
)
find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS} /usr/local/lib
)
find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES}
HINTS ${${XPREFIX}_LIBRARY_DIRS} /usr/local/lib
)
########################################################################
# Windows
elseif (WIN32)
set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory")
mark_as_advanced(sodium_DIR)
find_path(sodium_INCLUDE_DIR sodium.h
HINTS ${sodium_DIR}
PATH_SUFFIXES include
)
if (MSVC)
# detect target architecture
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.c" [=[
#if defined _M_IX86
#error ARCH_VALUE x86_32
#elif defined _M_X64
#error ARCH_VALUE x86_64
#endif
#error ARCH_VALUE unknown
]=])
try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.c"
OUTPUT_VARIABLE _COMPILATION_LOG
)
string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}")
# construct library path
if (_TARGET_ARCH STREQUAL "x86_32")
string(APPEND _PLATFORM_PATH "Win32")
elseif(_TARGET_ARCH STREQUAL "x86_64")
string(APPEND _PLATFORM_PATH "x64")
else()
message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.")
endif()
string(APPEND _PLATFORM_PATH "/$$CONFIG$$")
if (MSVC_VERSION LESS 1900)
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60")
else()
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50")
endif()
string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}")
if (sodium_USE_STATIC_LIBS)
string(APPEND _PLATFORM_PATH "/static")
else()
string(APPEND _PLATFORM_PATH "/dynamic")
endif()
string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}")
string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}")
find_library(sodium_LIBRARY_DEBUG libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}
)
find_library(sodium_LIBRARY_RELEASE libsodium.lib
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
if (NOT sodium_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(sodium_DLL_DEBUG libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX}
)
find_library(sodium_DLL_RELEASE libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX}
)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK})
endif()
elseif(_GCC_COMPATIBLE)
if (sodium_USE_STATIC_LIBS)
find_library(sodium_LIBRARY_DEBUG libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
find_library(sodium_LIBRARY_RELEASE libsodium.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
else()
find_library(sodium_LIBRARY_DEBUG libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
find_library(sodium_LIBRARY_RELEASE libsodium.dll.a
HINTS ${sodium_DIR}
PATH_SUFFIXES lib
)
file(GLOB _DLL
LIST_DIRECTORIES false
RELATIVE "${sodium_DIR}/bin"
"${sodium_DIR}/bin/libsodium*.dll"
)
find_library(sodium_DLL_DEBUG ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin
)
find_library(sodium_DLL_RELEASE ${_DLL} libsodium
HINTS ${sodium_DIR}
PATH_SUFFIXES bin
)
endif()
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
########################################################################
# unsupported
else()
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
endif()
########################################################################
# common stuff
# extract sodium version
if (sodium_INCLUDE_DIR)
set(_VERSION_HEADER "${sodium_INCLUDE_DIR}/sodium/version.h")
if (EXISTS "${_VERSION_HEADER}")
file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT)
string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1"
sodium_VERSION "${_VERSION_HEADER_CONTENT}")
set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE)
endif()
endif()
# communicate results
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(sodium
REQUIRED_VARS
sodium_LIBRARY_RELEASE
sodium_LIBRARY_DEBUG
sodium_INCLUDE_DIR
VERSION_VAR
sodium_VERSION
)
# mark file paths as advanced
mark_as_advanced(sodium_INCLUDE_DIR)
mark_as_advanced(sodium_LIBRARY_DEBUG)
mark_as_advanced(sodium_LIBRARY_RELEASE)
if (WIN32)
mark_as_advanced(sodium_DLL_DEBUG)
mark_as_advanced(sodium_DLL_RELEASE)
endif()
# create imported target
if(sodium_USE_STATIC_LIBS)
set(_LIB_TYPE STATIC)
else()
set(_LIB_TYPE SHARED)
endif()
add_library(sodium ${_LIB_TYPE} IMPORTED)
set_target_properties(sodium PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
)
if (sodium_USE_STATIC_LIBS)
set_target_properties(sodium PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC"
IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}"
)
else()
if (UNIX)
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}"
)
elseif (WIN32)
set_target_properties(sodium PROPERTIES
IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}"
IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}"
)
if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND"))
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}"
)
endif()
if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND"))
set_target_properties(sodium PROPERTIES
IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}"
IMPORTED_LOCATION_RELEASE "${sodium_DLL_RELEASE}"
)
endif()
endif()
endif()

@ -30,14 +30,13 @@
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
# Check what commit we're on
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
if(RET)
# Something went wrong, set the version tag to -unknown
message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
set(VERSIONTAG "unknown")
else()
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
message(STATUS "You are currently on commit ${COMMIT}")
# Get all the tags
@ -58,4 +57,4 @@ else()
endif()
endif()
configure_file("${SRC}" "${DEST}")
configure_file("${SRC}" "${DEST}" @ONLY)

@ -0,0 +1,482 @@
# cmake bits to do a full static build, downloading and building all dependencies.
# Most of these are CACHE STRINGs so that you can override them using -DWHATEVER during cmake
# invocation to override.
set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads")
set(OPENSSL_VERSION 3.0.7 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=83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e
CACHE STRING "openssl source hash")
set(EXPAT_VERSION 2.5.0 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 SHA512=2da73b991b7c0c54440485c787e5edeb3567230204e31b3cac1c3a6713ec6f9f1554d3afffc0f8336168dfd5df02db4a69bcf21b4d959723d14162d13ab87516
CACHE STRING "expat source hash")
set(UNBOUND_VERSION 1.17.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 SHA512=f6b9f279330fb19b5feca09524959940aad8c4e064528aa82b369c726d77e9e8e5ca23f366f6e9edcf2c061b96f482ed7a2c26ac70fc15ae5762b3d7e36a5284
CACHE STRING "unbound source hash")
set(SQLITE3_VERSION 3400000 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=7ee8f02b21edb4489df5082b5cf5b7ef47bcebcdb0e209bf14240db69633c878
CACHE STRING "sqlite3 source hash")
set(SODIUM_VERSION 1.0.18 CACHE STRING "libsodium version")
set(SODIUM_MIRROR ${LOCAL_MIRROR}
https://download.libsodium.org/libsodium/releases
https://github.com/jedisct1/libsodium/releases/download/${SODIUM_VERSION}-RELEASE
CACHE STRING "libsodium mirror(s)")
set(SODIUM_SOURCE libsodium-${SODIUM_VERSION}.tar.gz)
set(SODIUM_HASH SHA512=17e8638e46d8f6f7d024fe5559eccf2b8baf23e143fadd472a7d29d228b186d86686a5e6920385fe2020729119a5f12f989c3a782afbd05a8db4819bb18666ef
CACHE STRING "libsodium source hash")
set(ZMQ_VERSION 4.3.4 CACHE STRING "libzmq version")
set(ZMQ_MIRROR ${LOCAL_MIRROR} https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}
CACHE STRING "libzmq mirror(s)")
set(ZMQ_SOURCE zeromq-${ZMQ_VERSION}.tar.gz)
set(ZMQ_HASH SHA512=e198ef9f82d392754caadd547537666d4fba0afd7d027749b3adae450516bcf284d241d4616cad3cb4ad9af8c10373d456de92dc6d115b037941659f141e7c0e
CACHE STRING "libzmq source hash")
set(LIBUV_VERSION 1.44.2 CACHE STRING "libuv version")
set(LIBUV_MIRROR ${LOCAL_MIRROR} https://dist.libuv.org/dist/v${LIBUV_VERSION}
CACHE STRING "libuv mirror(s)")
set(LIBUV_SOURCE libuv-v${LIBUV_VERSION}.tar.gz)
set(LIBUV_HASH SHA512=91197ff9303112567bbb915bbb88058050e2ad1c048815a3b57c054635d5dc7df458b956089d785475290132236cb0edcfae830f5d749de29a9a3213eeaf0b20
CACHE STRING "libuv source hash")
set(ZLIB_VERSION 1.2.13 CACHE STRING "zlib version")
set(ZLIB_MIRROR ${LOCAL_MIRROR} https://zlib.net
CACHE STRING "zlib mirror(s)")
set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.xz)
set(ZLIB_HASH SHA256=d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98
CACHE STRING "zlib source hash")
set(CURL_VERSION 7.86.0 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 SHA512=18e03a3c00f22125e07bddb18becbf5acdca22baeb7b29f45ef189a5c56f95b2d51247813f7a9a90f04eb051739e9aa7d3a1c5be397bae75d763a2b918d1b656
CACHE STRING "curl source hash")
include(ExternalProject)
set(DEPS_DESTDIR ${CMAKE_BINARY_DIR}/static-deps)
set(DEPS_SOURCEDIR ${CMAKE_BINARY_DIR}/static-deps-sources)
include_directories(BEFORE SYSTEM ${DEPS_DESTDIR}/include)
file(MAKE_DIRECTORY ${DEPS_DESTDIR}/include)
set(deps_cc "${CMAKE_C_COMPILER}")
set(deps_cxx "${CMAKE_CXX_COMPILER}")
if(CMAKE_C_COMPILER_LAUNCHER)
set(deps_cc "${CMAKE_C_COMPILER_LAUNCHER} ${deps_cc}")
endif()
if(CMAKE_CXX_COMPILER_LAUNCHER)
set(deps_cxx "${CMAKE_CXX_COMPILER_LAUNCHER} ${deps_cxx}")
endif()
function(expand_urls output source_file)
set(expanded)
foreach(mirror ${ARGN})
list(APPEND expanded "${mirror}/${source_file}")
endforeach()
set(${output} "${expanded}" PARENT_SCOPE)
endfunction()
function(add_static_target target ext_target libname)
add_library(${target} STATIC IMPORTED GLOBAL)
add_dependencies(${target} ${ext_target})
set_target_properties(${target} PROPERTIES
IMPORTED_LOCATION ${DEPS_DESTDIR}/lib/${libname}
)
endfunction()
set(cross_host "")
set(cross_rc "")
if(CMAKE_CROSSCOMPILING)
set(cross_host "--host=${ARCH_TRIPLET}")
if (ARCH_TRIPLET MATCHES mingw AND CMAKE_RC_COMPILER)
set(cross_rc "WINDRES=${CMAKE_RC_COMPILER}")
endif()
endif()
if(ANDROID)
set(android_toolchain_suffix linux-android)
set(android_compiler_suffix linux-android23)
if(CMAKE_ANDROID_ARCH_ABI MATCHES x86_64)
set(android_machine x86_64)
set(cross_host "--host=x86_64-linux-android")
set(android_compiler_prefix x86_64)
set(android_compiler_suffix linux-android23)
set(android_toolchain_prefix x86_64)
set(android_toolchain_suffix linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES x86)
set(android_machine x86)
set(cross_host "--host=i686-linux-android")
set(android_compiler_prefix i686)
set(android_compiler_suffix linux-android23)
set(android_toolchain_prefix i686)
set(android_toolchain_suffix linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES armeabi-v7a)
set(android_machine arm)
set(cross_host "--host=armv7a-linux-androideabi")
set(android_compiler_prefix armv7a)
set(android_compiler_suffix linux-androideabi23)
set(android_toolchain_prefix arm)
set(android_toolchain_suffix linux-androideabi)
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES arm64-v8a)
set(android_machine arm64)
set(cross_host "--host=aarch64-linux-android")
set(android_compiler_prefix aarch64)
set(android_compiler_suffix linux-android23)
set(android_toolchain_prefix aarch64)
set(android_toolchain_suffix linux-android)
else()
message(FATAL_ERROR "unknown android arch: ${CMAKE_ANDROID_ARCH_ABI}")
endif()
set(deps_cc "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_compiler_suffix}-clang")
set(deps_cxx "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_compiler_suffix}-clang++")
set(deps_ld "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_toolchain_suffix}-ld")
set(deps_ranlib "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_toolchain_prefix}-${android_toolchain_suffix}-ranlib")
set(deps_ar "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_toolchain_prefix}-${android_toolchain_suffix}-ar")
endif()
set(deps_CFLAGS "-O2")
set(deps_CXXFLAGS "-O2")
if(WITH_LTO)
set(deps_CFLAGS "${deps_CFLAGS} -flto")
endif()
if(APPLE)
set(deps_CFLAGS "${deps_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(deps_CXXFLAGS "${deps_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(_winver)
set(deps_CFLAGS "${deps_CFLAGS} -D_WIN32_WINNT=${_winver}")
set(deps_CXXFLAGS "${deps_CXXFLAGS} -D_WIN32_WINNT=${_winver}")
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
set(_make $(MAKE))
else()
set(_make make)
endif()
# Builds a target; takes the target name (e.g. "readline") and builds it in an external project with
# target name suffixed with `_external`. Its upper-case value is used to get the download details
# (from the variables set above). The following options are supported and passed through to
# ExternalProject_Add if specified. If omitted, these defaults are used:
set(build_def_DEPENDS "")
set(build_def_PATCH_COMMAND "")
set(build_def_CONFIGURE_COMMAND ./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}" ${cross_rc})
set(build_def_BUILD_COMMAND ${_make})
set(build_def_INSTALL_COMMAND ${_make} install)
set(build_def_BUILD_BYPRODUCTS ${DEPS_DESTDIR}/lib/lib___TARGET___.a ${DEPS_DESTDIR}/include/___TARGET___.h)
function(build_external target)
set(options DEPENDS PATCH_COMMAND CONFIGURE_COMMAND BUILD_COMMAND INSTALL_COMMAND BUILD_BYPRODUCTS)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "${options}")
foreach(o ${options})
if(NOT DEFINED arg_${o})
set(arg_${o} ${build_def_${o}})
endif()
endforeach()
string(REPLACE ___TARGET___ ${target} arg_BUILD_BYPRODUCTS "${arg_BUILD_BYPRODUCTS}")
string(TOUPPER "${target}" prefix)
expand_urls(urls ${${prefix}_SOURCE} ${${prefix}_MIRROR})
ExternalProject_Add("${target}_external"
DEPENDS ${arg_DEPENDS}
BUILD_IN_SOURCE ON
PREFIX ${DEPS_SOURCEDIR}
URL ${urls}
URL_HASH ${${prefix}_HASH}
DOWNLOAD_NO_PROGRESS ON
PATCH_COMMAND ${arg_PATCH_COMMAND}
CONFIGURE_COMMAND ${arg_CONFIGURE_COMMAND}
BUILD_COMMAND ${arg_BUILD_COMMAND}
INSTALL_COMMAND ${arg_INSTALL_COMMAND}
BUILD_BYPRODUCTS ${arg_BUILD_BYPRODUCTS}
)
endfunction()
build_external(libuv
CONFIGURE_COMMAND ./autogen.sh && ./configure ${cross_host} ${cross_rc} --prefix=${DEPS_DESTDIR} --with-pic --disable-shared --enable-static "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}"
BUILD_BYPRODUCTS
${DEPS_DESTDIR}/lib/libuv.a
${DEPS_DESTDIR}/include/uv.h
)
add_static_target(libuv libuv_external libuv.a)
target_link_libraries(libuv INTERFACE ${CMAKE_DL_LIBS})
build_external(zlib
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS} -fPIC" ${cross_extra} ./configure --prefix=${DEPS_DESTDIR} --static
BUILD_BYPRODUCTS
${DEPS_DESTDIR}/lib/libz.a
${DEPS_DESTDIR}/include/zlib.h
)
add_static_target(zlib zlib_external libz.a)
set(openssl_system_env "")
set(openssl_arch "")
set(openssl_configure_command ./config)
set(openssl_flags "CFLAGS=${deps_CFLAGS}")
set(unbound_ldflags "")
if(CMAKE_CROSSCOMPILING)
if(ARCH_TRIPLET STREQUAL x86_64-w64-mingw32)
set(openssl_arch mingw64)
set(openssl_system_env RC=${CMAKE_RC_COMPILER} AR=${ARCH_TRIPLET}-ar RANLIB=${ARCH_TRIPLET}-ranlib)
elseif(ARCH_TRIPLET STREQUAL i686-w64-mingw32)
set(openssl_arch mingw)
set(openssl_system_env RC=${CMAKE_RC_COMPILER} AR=${ARCH_TRIPLET}-ar RANLIB=${ARCH_TRIPLET}-ranlib)
elseif(ANDROID)
set(openssl_arch android-${android_machine})
set(openssl_system_env LD=${deps_ld} RANLIB=${deps_ranlib} AR=${deps_ar} ANDROID_NDK_ROOT=${CMAKE_ANDROID_NDK} "PATH=${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin:$ENV{PATH}")
list(APPEND openssl_flags "CPPFLAGS=-D__ANDROID_API__=${ANDROID_API}")
set(openssl_extra_opts no-asm)
elseif(ARCH_TRIPLET STREQUAL mips64-linux-gnuabi64)
set(openssl_arch linux-mips64)
elseif(ARCH_TRIPLET STREQUAL mips-linux-gnu)
set(openssl_arch linux-mips32)
elseif(ARCH_TRIPLET STREQUAL mips-openwrt-linux)
set(unbound_ldflags "-latomic")
set(openssl_arch linux-mips32)
elseif(ARCH_TRIPLET STREQUAL mipsel-linux-gnu)
set(openssl_arch linux-mips)
elseif(ARCH_TRIPLET STREQUAL aarch64-linux-gnu OR ARCH_TRIPLET STREQUAL aarch64-openwrt-linux-musl)
# cross compile arm64
set(openssl_arch linux-aarch64)
elseif(ARCH_TRIPLET MATCHES arm-linux)
# cross compile armhf
set(openssl_arch linux-armv4)
elseif(ARCH_TRIPLET MATCHES powerpc64le)
# cross compile ppc64le
set(openssl_arch linux-ppc64le)
endif()
elseif(CMAKE_C_FLAGS MATCHES "-march=armv7")
# Help openssl figure out that we're building from armv7 even if on armv8 hardware:
set(openssl_arch linux-armv4)
endif()
build_external(openssl
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${deps_cc} ${openssl_system_env} ${openssl_configure_command}
--prefix=${DEPS_DESTDIR} --libdir=lib ${openssl_extra_opts}
no-shared no-capieng no-dso no-dtls1 no-ec_nistp_64_gcc_128 no-gost
no-md2 no-rc5 no-rdrand no-rfc3779 no-sctp no-ssl-trace no-ssl3
no-static-engine no-tests no-weak-ssl-ciphers no-zlib no-zlib-dynamic ${openssl_flags}
${openssl_arch}
BUILD_COMMAND ${CMAKE_COMMAND} -E env ${openssl_system_env} ${_make}
INSTALL_COMMAND ${_make} install_sw
BUILD_BYPRODUCTS
${DEPS_DESTDIR}/lib/libssl.a ${DEPS_DESTDIR}/lib/libcrypto.a
${DEPS_DESTDIR}/include/openssl/ssl.h ${DEPS_DESTDIR}/include/openssl/crypto.h
)
add_static_target(OpenSSL::SSL openssl_external libssl.a)
add_static_target(OpenSSL::Crypto openssl_external libcrypto.a)
if(WIN32)
target_link_libraries(OpenSSL::Crypto INTERFACE "ws2_32;crypt32;iphlpapi")
endif()
set(OPENSSL_INCLUDE_DIR ${DEPS_DESTDIR}/include)
set(OPENSSL_CRYPTO_LIBRARY ${DEPS_DESTDIR}/lib/libcrypto.a ${DEPS_DESTDIR}/lib/libssl.a)
set(OPENSSL_ROOT_DIR ${DEPS_DESTDIR})
build_external(expat
CONFIGURE_COMMAND ./configure ${cross_host} --prefix=${DEPS_DESTDIR} --enable-static
--disable-shared --with-pic --without-examples --without-tests --without-docbook --without-xmlwf
"CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}"
)
add_static_target(expat expat_external libexpat.a)
if(WIN32)
set(unbound_patch
PATCH_COMMAND ${PROJECT_SOURCE_DIR}/contrib/apply-patches.sh
${PROJECT_SOURCE_DIR}/contrib/patches/unbound-delete-crash-fix.patch)
endif()
build_external(unbound
DEPENDS openssl_external expat_external
${unbound_patch}
CONFIGURE_COMMAND ./configure ${cross_host} ${cross_rc} --prefix=${DEPS_DESTDIR} --disable-shared
--enable-static --with-libunbound-only --with-pic
--$<IF:$<BOOL:${WITH_LTO}>,enable,disable>-flto --with-ssl=${DEPS_DESTDIR}
--with-libexpat=${DEPS_DESTDIR}
"CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}" "LDFLAGS=${unbound_ldflags}"
)
add_static_target(libunbound unbound_external libunbound.a)
if(NOT WIN32)
set_target_properties(libunbound PROPERTIES INTERFACE_LINK_LIBRARIES "OpenSSL::SSL;OpenSSL::Crypto")
else()
set_target_properties(libunbound PROPERTIES INTERFACE_LINK_LIBRARIES "OpenSSL::SSL;OpenSSL::Crypto;ws2_32;crypt32;iphlpapi")
endif()
build_external(sodium CONFIGURE_COMMAND ./configure ${cross_host} ${cross_rc} --prefix=${DEPS_DESTDIR} --disable-shared
--enable-static --with-pic "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}")
add_static_target(sodium sodium_external libsodium.a)
if(WITH_PEERSTATS_BACKEND)
build_external(sqlite3)
add_static_target(sqlite3 sqlite3_external libsqlite3.a)
endif()
if(ARCH_TRIPLET MATCHES mingw)
option(WITH_WEPOLL "use wepoll zmq poller (crashy)" OFF)
if(WITH_WEPOLL)
set(zmq_extra --with-poller=wepoll)
endif()
endif()
if(CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw)
set(zmq_patch
PATCH_COMMAND ${PROJECT_SOURCE_DIR}/contrib/apply-patches.sh
${PROJECT_SOURCE_DIR}/contrib/patches/libzmq-mingw-wepoll.patch
${PROJECT_SOURCE_DIR}/contrib/patches/libzmq-mingw-unistd.patch)
endif()
build_external(zmq
DEPENDS sodium_external
${zmq_patch}
CONFIGURE_COMMAND ./configure ${cross_host} --prefix=${DEPS_DESTDIR} --enable-static --disable-shared
--disable-curve-keygen --enable-curve --disable-drafts --disable-libunwind --with-libsodium
--without-pgm --without-norm --without-vmci --without-docs --with-pic --disable-Werror --disable-libbsd ${zmq_extra}
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS} -fstack-protector" "CXXFLAGS=${deps_CXXFLAGS} -fstack-protector"
"sodium_CFLAGS=-I${DEPS_DESTDIR}/include" "sodium_LIBS=-L${DEPS_DESTDIR}/lib -lsodium"
)
add_static_target(libzmq zmq_external libzmq.a)
set(libzmq_link_libs "sodium")
if(CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw)
list(APPEND libzmq_link_libs iphlpapi)
endif()
set_target_properties(libzmq PROPERTIES
INTERFACE_LINK_LIBRARIES "${libzmq_link_libs}"
INTERFACE_COMPILE_DEFINITIONS "ZMQ_STATIC")
#
#
#
# Everything that follows is *only* for lokinet-bootstrap (i.e. if adding new deps put them *above*
# this).
#
#
#
if(NOT WITH_BOOTSTRAP)
return()
endif()
set(curl_extra)
if(WIN32)
set(curl_ssl_opts --without-ssl --with-schannel)
elseif(APPLE)
set(curl_ssl_opts --without-ssl --with-secure-transport)
if(IOS)
# This CPP crap shouldn't be necessary but is because Apple's toolchain is trash
set(curl_extra "LDFLAGS=-L${DEPS_DESTDIR}/lib -isysroot ${CMAKE_OSX_SYSROOT}" CPP=cpp)
endif()
else()
set(curl_ssl_opts --with-ssl=${DEPS_DESTDIR})
set(curl_extra "LIBS=-pthread")
endif()
set(curl_arches default)
set(curl_lib_outputs)
if(IOS)
# On iOS things get a little messy: curl won't build a multi-arch library (with `clang -arch arch1
# -arch arch2`) so we have to build them separately then glue them together if we're building
# multiple.
set(curl_arches ${CMAKE_OSX_ARCHITECTURES})
list(GET curl_arches 0 curl_arch0)
list(LENGTH CMAKE_OSX_ARCHITECTURES num_arches)
endif()
foreach(curl_arch ${curl_arches})
set(curl_target_suffix "")
set(curl_prefix "${DEPS_DESTDIR}")
if(curl_arch STREQUAL "default")
set(curl_cflags_extra "")
elseif(IOS)
set(cflags_extra " -arch ${curl_arch}")
if(num_arches GREATER 1)
set(curl_target_suffix "-${curl_arch}")
set(curl_prefix "${DEPS_DESTDIR}/tmp/${curl_arch}")
endif()
else()
message(FATAL_ERROR "unexpected curl_arch=${curl_arch}")
endif()
build_external(curl
TARGET_SUFFIX ${curl_target_suffix}
DEPENDS openssl_external zlib_external
CONFIGURE_COMMAND ./configure ${cross_host} ${cross_extra} --prefix=${curl_prefix} --disable-shared
--enable-static --disable-ares --disable-ftp --disable-ldap --disable-laps --disable-rtsp
--disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb
--disable-smtp --disable-gopher --disable-manual --disable-libcurl-option --enable-http
--enable-ipv6 --disable-threaded-resolver --disable-pthreads --disable-verbose --disable-sspi
--enable-crypto-auth --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-cookies
--enable-http-auth --enable-doh --disable-mime --enable-dateparse --disable-netrc --without-libidn2
--disable-progress-meter --without-brotli --with-zlib=${DEPS_DESTDIR} ${curl_ssl_opts}
--without-librtmp --disable-versioned-symbols --enable-hidden-symbols
--without-zsh-functions-dir --without-fish-functions-dir
--without-nghttp3 --without-zstd
"CC=${deps_cc}" "CFLAGS=${deps_noarch_CFLAGS}${cflags_extra}" ${curl_extra}
BUILD_COMMAND true
INSTALL_COMMAND ${_make} -C lib install && ${_make} -C include install
BUILD_BYPRODUCTS
${curl_prefix}/lib/libcurl.a
${curl_prefix}/include/curl/curl.h
)
list(APPEND curl_lib_targets curl${curl_target_suffix}_external)
list(APPEND curl_lib_outputs ${curl_prefix}/lib/libcurl.a)
endforeach()
if(IOS AND num_arches GREATER 1)
# We are building multiple architectures for different iOS devices, so we need to glue the
# separate libraries into one. (Normally multiple -arch values passed to clang does this for us,
# but curl refuses to build that way).
add_custom_target(curl_external
COMMAND lipo ${curl_lib_outputs} -create -output ${DEPS_DESTDIR}/libcurl.a
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPS_DESTDIR}/tmp/${curl_arch0}/include/curl ${DEPS_DESTDIR}/include/curl
BYPRODUCTS ${DEPS_DESTDIR}/lib/libcurl.a ${DEPS_DESTDIR}/include/curl/curl.h
DEPENDS ${curl_lib_targets})
endif()
add_static_target(CURL::libcurl curl_external libcurl.a)
set(libcurl_link_libs zlib)
if(CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw)
list(APPEND libcurl_link_libs crypt32)
elseif(APPLE)
list(APPEND libcurl_link_libs "-framework Security -framework CoreFoundation")
endif()
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_LINK_LIBRARIES "${libcurl_link_libs}"
INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB")

@ -1,22 +1,46 @@
# 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(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) )
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-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}")
if(LOKINET_VERSIONTAG)
set(VERSIONTAG "${LOKINET_VERSIONTAG}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
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")
set(VERSIONTAG "${GIT_VERSION}")
set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
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}"
${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()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
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)

@ -1,8 +0,0 @@
function(add_log_tag target)
if(TARGET ${target})
get_target_property(TARGET_SRCS ${target} SOURCES)
foreach(F ${TARGET_SRCS})
set_source_files_properties(${F} PROPERTIES COMPILE_FLAGS -DLOG_TAG=\\\"${F}\\\")
endforeach(F)
endif()
endfunction()

@ -1,20 +0,0 @@
# Basic definitions
set(LIB lokinet)
set(SHARED_LIB ${LIB}-shared)
set(STATIC_LIB ${LIB}-static)
set(CRYPTOGRAPHY_LIB ${LIB}-cryptography)
set(UTIL_LIB ${LIB}-util)
set(PLATFORM_LIB ${LIB}-platform)
set(ANDROID_LIB ${LIB}android)
set(ABYSS libabyss)
set(ABYSS_LIB abyss)
set(ABYSS_EXE ${ABYSS_LIB}-main)
get_filename_component(TT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../vendor/libtuntap-master" ABSOLUTE)
add_definitions(-D${CMAKE_SYSTEM_NAME})
get_filename_component(CORE_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include" ABSOLUTE)
get_filename_component(ABYSS_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include" ABSOLUTE)
set(LIBTUNTAP_SRC
${TT_ROOT}/tuntap.cpp
${TT_ROOT}/tuntap_log.cpp)

@ -0,0 +1,51 @@
# Figure out if we need -lstdc++fs or -lc++fs and add it to the `filesystem` interface, if needed
# (otherwise just leave it an empty interface library; linking to it will do nothing). The former
# is needed for gcc before v9, and the latter with libc++ before llvm v9. But this gets more
# complicated than just using the compiler, because clang on linux by default uses libstdc++, so
# we'll just give up and see what works.
add_library(filesystem INTERFACE)
set(filesystem_code [[
#include <filesystem>
int main() {
auto cwd = std::filesystem::current_path();
return !cwd.string().empty();
}
]])
if(CMAKE_CXX_COMPILER STREQUAL "AppleClang" AND CMAKE_OSX_DEPLOYMENT_TARGET)
# It seems that check_cxx_source_compiles doesn't respect the CMAKE_OSX_DEPLOYMENT_TARGET, so this
# check would pass on Catalina (10.15) and then later compilation would fail because you aren't
# allowed to use <filesystem> when the deployment target is anything before 10.15.
set(CMAKE_REQUIRED_FLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()
check_cxx_source_compiles("${filesystem_code}" filesystem_compiled)
if(filesystem_compiled)
message(STATUS "No extra link flag needed for std::filesystem")
set(filesystem_is_good 1)
else()
foreach(fslib stdc++fs c++fs)
set(CMAKE_REQUIRED_LIBRARIES -l${fslib})
check_cxx_source_compiles("${filesystem_code}" filesystem_compiled_${fslib})
if (filesystem_compiled_${fslib})
message(STATUS "Using -l${fslib} for std::filesystem support")
target_link_libraries(filesystem INTERFACE ${fslib})
set(filesystem_is_good 1)
break()
endif()
endforeach()
endif()
unset(CMAKE_REQUIRED_LIBRARIES)
if(filesystem_is_good EQUAL 1)
message(STATUS "we have std::filesystem")
else()
# Probably broken AF macos
message(STATUS "std::filesystem is not available, apparently this compiler isn't C++17 compliant; falling back to ghc::filesystem")
set(GHC_FILESYSTEM_WITH_INSTALL OFF CACHE INTERNAL "")
add_subdirectory(external/ghc-filesystem)
target_link_libraries(filesystem INTERFACE ghc_filesystem)
target_compile_definitions(filesystem INTERFACE USE_GHC_FILESYSTEM CLI11_HAS_FILESYSTEM=0)
endif()

@ -0,0 +1,18 @@
# check for std::optional because macos is broke af sometimes
set(std_optional_code [[
#include <optional>
int main() {
std::optional<int> maybe;
maybe = 1;
return *maybe == 1;
}
]])
check_cxx_source_compiles("${std_optional_code}" was_compiled)
if(was_compiled)
message(STATUS "we have std::optional")
else()
message(FATAL_ERROR "we dont have std::optional your compiler is broke af")
endif()

@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()

@ -0,0 +1,23 @@
# -flto
include(CheckIPOSupported)
option(WITH_LTO "enable lto on compile time" ON)
if(WITH_LTO)
if(WIN32)
message(FATAL_ERROR "LTO not supported on win32 targets, please set -DWITH_LTO=OFF")
endif()
check_ipo_supported(RESULT IPO_ENABLED OUTPUT ipo_error)
if(IPO_ENABLED)
message(STATUS "LTO enabled")
else()
message(WARNING "LTO not supported by compiler: ${ipo_error}")
endif()
else()
message(STATUS "LTO disabled")
set(IPO_ENABLED OFF)
endif()
function(enable_lto)
if(IPO_ENABLED)
set_target_properties(${ARGN} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
endif()
endfunction()

@ -0,0 +1,17 @@
set(default_build_gui OFF)
if(APPLE OR WIN32)
set(default_build_gui ON)
endif()
if(WIN32)
set(GUI_EXE "" CACHE FILEPATH "path to a pre-built Windows GUI .exe to use (implies -DBUILD_GUI=OFF)")
if(GUI_EXE)
set(default_build_gui OFF)
endif()
endif()
option(BUILD_GUI "build electron gui from 'gui' submodule source" ${default_build_gui})
if(BUILD_GUI AND GUI_EXE)
message(FATAL_ERROR "-DGUI_EXE=... and -DBUILD_GUI=ON are mutually exclusive")
endif()

@ -0,0 +1,67 @@
if(WIN32 AND GUI_EXE)
message(STATUS "using pre-built lokinet gui executable: ${GUI_EXE}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${GUI_EXE}" "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe")
elseif(BUILD_GUI)
message(STATUS "Building lokinet-gui from source")
set(default_gui_target pack)
if(APPLE)
set(default_gui_target macos:raw)
elseif(WIN32)
set(default_gui_target win32)
endif()
set(GUI_YARN_TARGET "${default_gui_target}" CACHE STRING "yarn target for building the GUI")
set(GUI_YARN_EXTRA_OPTS "" CACHE STRING "extra options to pass into the yarn build command")
# allow manually specifying yarn with -DYARN=
if(NOT YARN)
find_program(YARN NAMES yarnpkg yarn REQUIRED)
endif()
message(STATUS "Building lokinet-gui with yarn ${YARN}, target ${GUI_YARN_TARGET}")
if(NOT WIN32)
add_custom_target(lokinet-gui
COMMAND ${YARN} install --frozen-lockfile &&
${YARN} ${GUI_YARN_EXTRA_OPTS} ${GUI_YARN_TARGET}
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/gui")
endif()
if(APPLE)
add_custom_target(assemble_gui ALL
DEPENDS assemble lokinet-gui
COMMAND mkdir "${lokinet_app}/Contents/Helpers"
COMMAND cp -a "${PROJECT_SOURCE_DIR}/gui/release/mac/Lokinet-GUI.app" "${lokinet_app}/Contents/Helpers/"
COMMAND mkdir -p "${lokinet_app}/Contents/Resources/en.lproj"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Resources/en.lproj/"
COMMAND cp "${lokinet_app}/Contents/Resources/icon.icns" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/icon.icns"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/en.lproj/"
COMMAND /usr/libexec/PlistBuddy
-c "Delete :CFBundleDisplayName"
-c "Add :LSHasLocalizedDisplayName bool true"
-c "Add :CFBundleDevelopmentRegion string en"
-c "Set :CFBundleShortVersionString ${lokinet_VERSION}"
-c "Set :CFBundleVersion ${lokinet_VERSION}.${LOKINET_APPLE_BUILD}"
"${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Info.plist"
)
elseif(WIN32)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/gui")
add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe"
COMMAND ${YARN} install --frozen-lockfile &&
USE_SYSTEM_7ZA=true DISPLAY= WINEDEBUG=-all WINEPREFIX="${PROJECT_BINARY_DIR}/wineprefix" ${YARN} ${GUI_YARN_EXTRA_OPTS} ${GUI_YARN_TARGET}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/gui/release/Lokinet-GUI_portable.exe"
"${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/gui")
add_custom_target(assemble_gui ALL COMMAND "true" DEPENDS "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe")
else()
message(FATAL_ERROR "Building/bundling the GUI from this repository is not supported on this platform")
endif()
else()
message(STATUS "not building gui")
endif()
if(NOT TARGET assemble_gui)
add_custom_target(assemble_gui COMMAND "true")
endif()

@ -0,0 +1,46 @@
set(CPACK_PACKAGE_VENDOR "lokinet.org")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://lokinet.org/")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/contrib/readme-installer.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
if(WIN32)
include(cmake/win32_installer_deps.cmake)
install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-exit.ini DESTINATION share/conf.d COMPONENT exit_configs)
install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-keyfile.ini DESTINATION share/conf.d COMPONENT keyfile_configs)
install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-debug-log.ini DESTINATION share/conf.d COMPONENT debug_configs)
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified" "lokinet" "gui" "exit_configs" "keyfile_configs" "debug_configs")
list(APPEND CPACK_COMPONENTS_ALL "lokinet" "gui" "exit_configs" "keyfile_configs" "debug_configs")
elseif(APPLE)
set(CPACK_GENERATOR DragNDrop;ZIP)
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified")
endif()
include(CPack)
if(WIN32)
cpack_add_component(lokinet
DISPLAY_NAME "lokinet"
DESCRIPTION "core required lokinet files"
REQUIRED)
cpack_add_component(gui
DISPLAY_NAME "lokinet gui"
DESCRIPTION "electron based control panel for lokinet")
cpack_add_component(exit_configs
DISPLAY_NAME "auto-enable exit"
DESCRIPTION "automatically enable usage of exit.loki as an exit node\n"
DISABLED)
cpack_add_component(keyfile_configs
DISPLAY_NAME "persist address"
DESCRIPTION "persist .loki address across restarts of lokinet\nnot recommended when enabling exit nodes"
DISABLED)
cpack_add_component(debug_configs
DISPLAY_NAME "debug logging"
DESCRIPTION "enable debug spew log level by default"
DISABLED)
endif()

@ -1,49 +1,49 @@
function(check_working_cxx_atomics64 varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
if (EMBEDDED_CFG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m32 -march=i486")
elseif(MSVC OR MSVC_VERSION)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -arch:IA32 -std:c++14")
else()
# CMAKE_CXX_STANDARD does not propagate to cmake compile tests
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++14")
endif()
check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()
function(link_libatomic)
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
if(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
message(STATUS "Have working 64bit atomics")
return()
endif()
if (NOT MSVC AND NOT MSVC_VERSION)
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
if (HAVE_CXX_LIBATOMICS64)
message(STATUS "Have 64bit atomics via library")
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
if (HAVE_CXX_ATOMICS64_WITH_LIB)
message(STATUS "Can link with libatomic")
link_libraries(-latomic)
return()
endif()
endif()
endif()
if (MSVC OR MSVC_VERSION)
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic! (What does MSVC do to inline atomics?)")
else()
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
endif()
endfunction()
function(check_working_cxx_atomics64 varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
if (EMBEDDED_CFG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m32 -march=i486")
elseif(MSVC OR MSVC_VERSION)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -arch:IA32 -std:c++14")
else()
# CMAKE_CXX_STANDARD does not propagate to cmake compile tests
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++14")
endif()
check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()
function(link_libatomic)
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
if(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
message(STATUS "Have working 64bit atomics")
return()
endif()
if (NOT MSVC AND NOT MSVC_VERSION)
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
if (HAVE_CXX_LIBATOMICS64)
message(STATUS "Have 64bit atomics via library")
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
if (HAVE_CXX_ATOMICS64_WITH_LIB)
message(STATUS "Can link with libatomic")
link_libraries(-latomic)
return()
endif()
endif()
endif()
if (MSVC OR MSVC_VERSION)
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic! (What does MSVC do to inline atomics?)")
else()
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
endif()
endfunction()

@ -0,0 +1,214 @@
if(NOT APPLE)
return()
endif()
option(MACOS_SYSTEM_EXTENSION
"Build the network extension as a system extension rather than a plugin. This must be ON for non-app store release builds, and must be OFF for dev builds and Mac App Store distribution builds"
OFF)
option(CODESIGN "codesign the resulting app and extension" ON)
set(CODESIGN_ID "" CACHE STRING "codesign the macos app using this key identity; if empty we'll try to guess")
set(default_profile_type "dev")
if(MACOS_SYSTEM_EXTENSION)
set(default_profile_type "release")
endif()
set(CODESIGN_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet.${default_profile_type}.provisionprofile" CACHE FILEPATH
"Path to a .provisionprofile to use for the main app")
set(CODESIGN_EXT_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet-extension.${default_profile_type}.provisionprofile" CACHE FILEPATH
"Path to a .provisionprofile to use for the lokinet extension")
if(CODESIGN AND NOT CODESIGN_ID)
if(MACOS_SYSTEM_EXTENSION)
set(codesign_cert_pattern "Developer ID Application")
else()
set(codesign_cert_pattern "Apple Development")
endif()
execute_process(
COMMAND security find-identity -v -p codesigning
COMMAND sed -n "s/^ *[0-9][0-9]*) *\\([A-F0-9]\\{40\\}\\) *\"\\(${codesign_cert_pattern}.*\\)\"\$/\\1 \\2/p"
RESULT_VARIABLE find_id_exit_code
OUTPUT_VARIABLE find_id_output)
if(NOT find_id_exit_code EQUAL 0)
message(FATAL_ERROR "Finding signing identities with security find-identity failed; try specifying an id using -DCODESIGN_ID=...")
endif()
string(REGEX MATCHALL "(^|\n)[0-9A-F]+" find_id_sign_id "${find_id_output}")
if(NOT find_id_sign_id)
message(FATAL_ERROR "Did not find any \"${codesign_cert_pattern}\" identity; try specifying an id using -DCODESIGN_ID=...")
endif()
if (find_id_sign_id MATCHES ";")
message(FATAL_ERROR "Found multiple \"${codesign_cert_pattern}\" identities:\n${find_id_output}\nSpecify an identify using -DCODESIGN_ID=...")
endif()
set(CODESIGN_ID "${find_id_sign_id}" CACHE STRING "" FORCE)
endif()
if(CODESIGN)
message(STATUS "Codesigning using ${CODESIGN_ID}")
if (NOT MACOS_NOTARIZE_USER AND NOT MACOS_NOTARIZE_PASS AND NOT MACOS_NOTARIZE_ASC AND EXISTS "$ENV{HOME}/.notarization.cmake")
message(STATUS "Loading notarization info from ~/.notarization.cmake")
include("$ENV{HOME}/.notarization.cmake")
endif()
if (MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC)
message(STATUS "Enabling notarization with account ${MACOS_NOTARIZE_ASC}/${MACOS_NOTARIZE_USER}")
else()
message(WARNING "You have not set one or more of MACOS_NOTARIZE_USER, MACOS_NOTARIZE_PASS, MACOS_NOTARIZE_ASC: notarization will fail; see contrib/macos/README.txt")
endif()
else()
message(WARNING "Codesigning disabled; the resulting build will not run on most macOS systems")
endif()
foreach(prof IN ITEMS CODESIGN_PROFILE CODESIGN_EXT_PROFILE)
if(NOT ${prof})
message(WARNING "Missing a ${prof} provisioning profile: Apple will most likely log an uninformative error message to the system log and then kill harmless kittens if you try to run the result")
elseif(NOT EXISTS "${${prof}}")
message(FATAL_ERROR "Provisioning profile ${${prof}} does not exist; fix your -D${prof} path")
endif()
endforeach()
message(STATUS "Using ${CODESIGN_PROFILE} app provisioning profile")
message(STATUS "Using ${CODESIGN_EXT_PROFILE} extension provisioning profile")
set(lokinet_installer "${PROJECT_BINARY_DIR}/Lokinet ${PROJECT_VERSION}")
if(NOT CODESIGN)
set(lokinet_installer "${lokinet_installer}-UNSIGNED")
endif()
set(lokinet_app "${lokinet_installer}/Lokinet.app")
if(MACOS_SYSTEM_EXTENSION)
set(lokinet_ext_dir Contents/Library/SystemExtensions)
else()
set(lokinet_ext_dir Contents/PlugIns)
endif()
if(CODESIGN)
if(MACOS_SYSTEM_EXTENSION)
set(LOKINET_ENTITLEMENTS_TYPE sysext)
set(notarize_py_is_sysext True)
else()
set(LOKINET_ENTITLEMENTS_TYPE plugin)
set(notarize_py_is_sysext False)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/contrib/macos/sign.sh.in"
"${PROJECT_BINARY_DIR}/sign.sh"
@ONLY)
add_custom_target(
sign
DEPENDS "${PROJECT_BINARY_DIR}/sign.sh"
COMMAND "${PROJECT_BINARY_DIR}/sign.sh"
)
if(MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC)
configure_file(
"${PROJECT_SOURCE_DIR}/contrib/macos/notarize.py.in"
"${PROJECT_BINARY_DIR}/notarize.py"
@ONLY)
add_custom_target(
notarize
DEPENDS "${PROJECT_BINARY_DIR}/notarize.py" sign
COMMAND "${PROJECT_BINARY_DIR}/notarize.py"
)
else()
message(WARNING "You have not set one or more of MACOS_NOTARIZE_USER, MACOS_NOTARIZE_PASS, MACOS_NOTARIZE_ASC: notarization disabled")
endif()
else()
add_custom_target(sign COMMAND "true")
add_custom_target(notarize DEPENDS sign COMMAND "true")
endif()
set(mac_icon "${PROJECT_BINARY_DIR}/lokinet.icns")
add_custom_command(OUTPUT "${mac_icon}"
COMMAND ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg "${mac_icon}"
DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh)
add_custom_target(icon DEPENDS "${mac_icon}")
if(BUILD_PACKAGE)
add_executable(seticon "${PROJECT_SOURCE_DIR}/contrib/macos/seticon.swift")
add_custom_command(OUTPUT "${lokinet_installer}.dmg"
DEPENDS notarize seticon
COMMAND create-dmg
--volname "Lokinet ${PROJECT_VERSION}"
--volicon lokinet.icns
--background "${PROJECT_SOURCE_DIR}/contrib/macos/installer.tiff"
--text-size 16
--icon-size 128
--window-size 555 440
--icon Lokinet.app 151 196
--hide-extension Lokinet.app
--app-drop-link 403 196
--eula "${PROJECT_SOURCE_DIR}/LICENSE"
--no-internet-enable
"${lokinet_installer}.dmg"
"${lokinet_installer}"
COMMAND ./seticon lokinet.icns "${lokinet_installer}.dmg"
)
add_custom_target(dmg DEPENDS "${lokinet_installer}.dmg")
endif()
# Called later to set things up, after the main lokinet targets are set up
function(macos_target_setup)
if(MACOS_SYSTEM_EXTENSION)
target_compile_definitions(lokinet PRIVATE MACOS_SYSTEM_EXTENSION)
endif()
set_target_properties(lokinet
PROPERTIES
OUTPUT_NAME Lokinet
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_STRING "Lokinet IP Packet Onion Router"
MACOSX_BUNDLE_BUNDLE_NAME "Lokinet"
MACOSX_BUNDLE_BUNDLE_VERSION "${lokinet_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${lokinet_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${lokinet_VERSION_MAJOR}.${lokinet_VERSION_MINOR}"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.lokinet"
MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet.Info.plist.in"
MACOSX_BUNDLE_COPYRIGHT "© 2022, The Oxen Project"
)
add_custom_target(copy_bootstrap
DEPENDS lokinet-extension
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed
$<TARGET_BUNDLE_DIR:lokinet-extension>/Contents/Resources/bootstrap.signed
)
add_dependencies(lokinet lokinet-extension icon)
if(CODESIGN_PROFILE)
add_custom_target(copy_prov_prof
DEPENDS lokinet
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CODESIGN_PROFILE}
$<TARGET_BUNDLE_DIR:lokinet>/Contents/embedded.provisionprofile
)
else()
add_custom_target(copy_prov_prof COMMAND true)
endif()
add_custom_target(assemble ALL
DEPENDS lokinet lokinet-extension icon copy_prov_prof copy_bootstrap
COMMAND rm -rf "${lokinet_app}"
COMMAND mkdir -p "${lokinet_installer}"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet> "${lokinet_app}"
COMMAND mkdir -p "${lokinet_app}/${lokinet_ext_dir}"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet-extension> "${lokinet_app}/${lokinet_ext_dir}/"
COMMAND mkdir -p "${lokinet_app}/Contents/Resources"
COMMAND cp -a "${mac_icon}" "${lokinet_app}/Contents/Resources/icon.icns"
)
if(BUILD_GUI)
add_dependencies(sign assemble_gui)
else()
add_dependencies(sign assemble)
endif()
endfunction()

@ -0,0 +1,53 @@
# ngtcp2's top-level CMakeLists.txt loads a bunch of crap we don't want (examples, a conflicting
# 'check' target, etc.); instead we directly include it's lib subdirectory to build just the
# library, but we have to set up a couple things to make that work:
function(add_ngtcp2_lib)
file(STRINGS ngtcp2/CMakeLists.txt ngtcp2_project_line REGEX "^project\\(ngtcp2 ")
if(NOT ngtcp2_project_line MATCHES "^project\\(ngtcp2 VERSION ([0-9]+)\\.([0-9]+)\\.([0-9]+)\\)$")
message(FATAL_ERROR "Unable to extract ngtcp2 version from ngtcp2/CMakeLists.txt (found '${ngtcp2_project_line}')")
endif()
set(PACKAGE_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
include(ngtcp2/cmake/Version.cmake)
HexVersion(PACKAGE_VERSION_NUM ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${CMAKE_MATCH_3})
configure_file("ngtcp2/lib/includes/ngtcp2/version.h.in" "ngtcp2/lib/includes/ngtcp2/version.h" @ONLY)
set(BUILD_SHARED_LIBS OFF)
# Checks for header files.
include(CheckIncludeFile)
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file("stddef.h" HAVE_STDDEF_H)
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("stdlib.h" HAVE_STDLIB_H)
check_include_file("string.h" HAVE_STRING_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
check_include_file("endian.h" HAVE_ENDIAN_H)
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
include(CheckTypeSize)
check_type_size("ssize_t" SIZEOF_SSIZE_T)
if(SIZEOF_SSIZE_T STREQUAL "")
set(ssize_t ptrdiff_t)
endif()
include(CheckSymbolExists)
if(HAVE_ENDIAN_H)
check_symbol_exists(be64toh "endian.h" HAVE_BE64TOH)
endif()
if(NOT HAVE_BE64TO AND HAVE_SYS_ENDIAN_H)
check_symbol_exists(be64toh "sys/endian.h" HAVE_BE64TOH)
endif()
check_symbol_exists(bswap_64 "byteswap.h" HAVE_BSWAP_64)
configure_file(ngtcp2/cmakeconfig.h.in ngtcp2/config.h)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/ngtcp2") # for config.h
set(ENABLE_STATIC_LIB ON FORCE BOOL)
set(ENABLE_SHARED_LIB OFF FORCE BOOL)
add_subdirectory(ngtcp2/lib EXCLUDE_FROM_ALL)
target_compile_definitions(ngtcp2_static PRIVATE -DHAVE_CONFIG_H -D_GNU_SOURCE)
endfunction()

@ -1,18 +0,0 @@
set(WITH_STATIC OFF)
set(WITH_SHARED ON)
if("${SHADOW_ROOT}" STREQUAL "")
set(SHADOW_ROOT "$ENV{HOME}/.shadow")
endif("${SHADOW_ROOT}" STREQUAL "")
if(EXISTS "${SHADOW_ROOT}")
message(STATUS "SHADOW_ROOT = ${SHADOW_ROOT}")
else()
message(FATAL_ERROR "SHADOW_ROOT path does not exist: '${SHADOW_ROOT}'")
endif(EXISTS "${SHADOW_ROOT}")
set(CMAKE_MODULE_PATH "${SHADOW_ROOT}/share/cmake/Modules")
include_directories(${CMAKE_MODULE_PATH})
include(ShadowTools)
add_compile_options(-fno-inline -fno-strict-aliasing )
add_definitions(-DTESTNET=1)
add_definitions(-DLOKINET_SHADOW)
include_directories(${SHADOW_ROOT}/include)

@ -1,38 +1,7 @@
if(NOT STATIC_LINK)
return()
endif()
# not supported on Solaris - system libraries are not available as archives
# LTO is supported only for native builds
if(SOLARIS)
link_libraries( -static-libstdc++ -static-libgcc )
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
add_compile_options(-static -flto)
else()
add_compile_options(-static)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(APPLE)
link_libraries( -flto)
if(STATIC_LINK)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
link_libraries( -static-libstdc++ )
else()
link_libraries( -static -static-libstdc++ -pthread -flto )
link_libraries( -static-libstdc++ -static-libgcc )
endif()
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_AR "gcc-ar")
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "true")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "true")
link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} )
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static" )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endif()

@ -1,83 +1,21 @@
if(NOT UNIX)
return()
if(NOT ANDROID)
if(NOT UNIX)
return()
endif()
endif()
include(CheckCXXSourceCompiles)
include(CheckLibraryExists)
# can't have UNIX defined
# can't have the include paths for libuv either?
if(NOT IOS AND NOT ANDROID AND NOT WIN32)
if(LIBCURL_ROOT)
option(HTTP_ONLY "" ON)
option(SSL_ENABLED "" OFF)
option(BUILD_SHARED_LIBS "" OFF)
option(ENABLE_IPV6 "" OFF)
option(CMAKE_USE_OPENSSL "" OFF)
option(CURL_CA_PATH "" OFF)
set(CURL_CA_PATH none)
message(STATUS "using local curl: ${LIBCURL_ROOT}")
add_subdirectory(${LIBCURL_ROOT})
set(CURL_INCLUDE_DIRS ${LIBCURL_ROOT}/include)
set(CURL_LIBRARIES libcurl)
set(CURL_FOUND TRUE)
else()
include(FindCURL)
endif()
endif()
add_definitions(-DUNIX)
add_definitions(-DPOSIX)
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix.c)
if (STATIC_LINK_RUNTIME OR STATIC_LINK)
set(LIBUV_USE_STATIC ON)
endif()
if(LIBUV_ROOT)
add_subdirectory(${LIBUV_ROOT})
set(LIBUV_INCLUDE_DIRS ${LIBUV_ROOT}/include)
set(LIBUV_LIBRARY uv_a)
add_definitions(-D_LARGEFILE_SOURCE)
add_definitions(-D_FILE_OFFSET_BITS=64)
elseif(NOT LIBUV_IN_SOURCE)
find_package(LibUV 1.28.0 REQUIRED)
endif()
include_directories(${LIBUV_INCLUDE_DIRS})
if(EMBEDDED_CFG OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
link_libatomic()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
add_definitions(-D_BSD_SOURCE)
add_definitions(-D_GNU_SOURCE)
add_definitions(-D_XOPEN_SOURCE=700)
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "iOS")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-sunos.c)
# Apple C++ screws up name decorations in stdc++fs, causing link to fail
# Samsung does not build c++experimental or c++fs in their Apple libc++ pkgsrc build
if (LIBUV_USE_STATIC)
link_libraries(-lkstat -lsendfile)
endif()
else()
message(FATAL_ERROR "Your operating system - ${CMAKE_SYSTEM_NAME} is not supported yet")
endif()
set(EXE_LIBS ${STATIC_LIB})
if(RELEASE_MOTTO)
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
endif()

@ -1,62 +1,49 @@
if(NOT WIN32)
return()
endif()
if (NOT STATIC_LINK)
message(FATAL_ERROR "windows requires static builds (thanks balmer)")
endif()
enable_language(RC)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if(NOT MSVC_VERSION)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-cast-function-type>)
# unlike unix where you get a *single* compiler ID string in .comment
# GNU ld sees fit to merge *all* the .ident sections in object files
# to .r[o]data section one after the other!
add_compile_options(-fno-ident -Wa,-mbig-obj)
link_libraries( -lws2_32 -lshlwapi -ldbghelp -luser32 -liphlpapi -lpsapi -luserenv )
add_definitions(-DWINVER=0x0500 -D_WIN32_WINNT=0x0500)
if (CMAKE_C_COMPILER_AR AND STATIC_LINK_RUNTIME)
add_compile_options(-flto)
set(CMAKE_AR ${CMAKE_C_COMPILER_AR})
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "true")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "true")
link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} )
endif()
endif()
option(WITH_WINDOWS_32 "build 32 bit windows" OFF)
# unlike unix where you get a *single* compiler ID string in .comment
# GNU ld sees fit to merge *all* the .ident sections in object files
# to .r[o]data section one after the other!
add_compile_options(-fno-ident -Wa,-mbig-obj)
if(EMBEDDED_CFG)
link_libatomic()
endif()
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-windows.c)
get_filename_component(EV_SRC "llarp/ev/ev_libuv.cpp" ABSOLUTE)
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32)
set(EXE_LIBS ${STATIC_LIB} ws2_32 iphlpapi)
if(RELEASE_MOTTO)
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
add_definitions(-DRELEASE_MOTTO=${RELEASE_MOTTO})
endif()
if (NOT STATIC_LINK_RUNTIME AND NOT MSVC)
message("must ship compiler runtime libraries with this build: libwinpthread-1.dll, libgcc_s_dw2-1.dll, and libstdc++-6.dll")
message("for release builds, turn on STATIC_LINK_RUNTIME in cmake options")
endif()
if (STATIC_LINK_RUNTIME)
set(LIBUV_USE_STATIC ON)
endif()
if(LIBUV_ROOT)
add_subdirectory(${LIBUV_ROOT})
set(LIBUV_INCLUDE_DIRS ${LIBUV_ROOT}/include)
set(LIBUV_LIBRARY uv_a)
add_definitions(-D_LARGEFILE_SOURCE)
add_definitions(-D_FILE_OFFSET_BITS=64)
elseif(NOT LIBUV_IN_SOURCE)
find_package(LibUV 1.28.0 REQUIRED)
endif()
include_directories(${LIBUV_INCLUDE_DIRS})
set(WINTUN_VERSION 0.14.1 CACHE STRING "wintun version")
set(WINTUN_MIRROR https://www.wintun.net/builds
CACHE STRING "wintun mirror(s)")
set(WINTUN_SOURCE wintun-${WINTUN_VERSION}.zip)
set(WINTUN_HASH SHA256=07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51
CACHE STRING "wintun source hash")
set(WINDIVERT_VERSION 2.2.0-A CACHE STRING "windivert version")
set(WINDIVERT_MIRROR https://reqrypt.org/download
CACHE STRING "windivert mirror(s)")
set(WINDIVERT_SOURCE WinDivert-${WINDIVERT_VERSION}.zip)
set(WINDIVERT_HASH SHA256=2a7630aac0914746fbc565ac862fa096e3e54233883ac52d17c83107496b7a7f
CACHE STRING "windivert source hash")
set(WINTUN_URL ${WINTUN_MIRROR}/${WINTUN_SOURCE}
CACHE STRING "wintun download url")
set(WINDIVERT_URL ${WINDIVERT_MIRROR}/${WINDIVERT_SOURCE}
CACHE STRING "windivert download url")
message(STATUS "Downloading wintun from ${WINTUN_URL}")
file(DOWNLOAD ${WINTUN_URL} ${CMAKE_BINARY_DIR}/wintun.zip EXPECTED_HASH ${WINTUN_HASH})
message(STATUS "Downloading windivert from ${WINDIVERT_URL}")
file(DOWNLOAD ${WINDIVERT_URL} ${CMAKE_BINARY_DIR}/windivert.zip EXPECTED_HASH ${WINDIVERT_HASH})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar x ${CMAKE_BINARY_DIR}/wintun.zip
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar x ${CMAKE_BINARY_DIR}/windivert.zip
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

@ -0,0 +1,46 @@
install(DIRECTORY ${CMAKE_BINARY_DIR}/gui DESTINATION share COMPONENT gui)
if(WITH_WINDOWS_32)
install(FILES ${CMAKE_BINARY_DIR}/wintun/bin/x86/wintun.dll DESTINATION bin COMPONENT lokinet)
install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x86/WinDivert.sys DESTINATION lib COMPONENT lokinet)
install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x86/WinDivert.dll DESTINATION bin COMPONENT lokinet)
else()
install(FILES ${CMAKE_BINARY_DIR}/wintun/bin/amd64/wintun.dll DESTINATION bin COMPONENT lokinet)
install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x64/WinDivert64.sys DESTINATION lib COMPONENT lokinet)
install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x64/WinDivert.dll DESTINATION bin COMPONENT lokinet)
endif()
set(BOOTSTRAP_FILE "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed")
install(FILES ${BOOTSTRAP_FILE} DESTINATION share COMPONENT lokinet RENAME bootstrap.signed)
set(win_ico "${PROJECT_BINARY_DIR}/lokinet.ico")
add_custom_command(OUTPUT "${win_ico}"
COMMAND ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg "${win_ico}"
DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh)
add_custom_target(icon ALL DEPENDS "${win_ico}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet")
set(CPACK_NSIS_MUI_ICON "${PROJECT_BINARY_DIR}/lokinet.ico")
set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
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}")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")

@ -0,0 +1,13 @@
Place in `/etc/NetworkManager/dnsmasq.d/lokinet.conf`.
To make use of this, first install dnsmasq.
Then enable NetworkManager dnsmasq backend by editing `/etc/NetworkManager/NetworkManager.conf` to something like:
```
[main]
dns=dnsmasq
```
If NetworkManager is currently running, restart it for changes to take effect:
```
sudo systemctl restart NetworkManager
```

@ -0,0 +1 @@
server=/loki/snode/127.3.2.1

@ -0,0 +1,67 @@
#!/bin/bash
set -e
default_abis="armeabi-v7a arm64-v8a x86_64"
build_abis=${ABIS:-$default_abis}
test x$NDK = x && test -e /usr/lib/android-ndk && export NDK=/usr/lib/android-ndk
test x$NDK = x && exit 1
echo "building abis: $build_abis"
root=$(readlink -f "$1")
shift
build=$(readlink -f "$1")
shift
mkdir -p $build
cd $build
for abi in $build_abis; do
mkdir -p build-$abi
cd build-$abi
cmake \
-S "$root" -B . \
-G 'Unix Makefiles' \
-DANDROID=ON \
-DANDROID_ABI=$abi \
-DANDROID_ARM_MODE=arm \
-DANDROID_PLATFORM=android-23 \
-DANDROID_API=23 \
-DANDROID_STL=c++_static \
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DBUILD_STATIC_DEPS=ON \
-DBUILD_PACKAGE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DWITH_TESTS=OFF \
-DWITH_BOOTSTRAP=OFF \
-DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \
-DWITH_SYSTEMD=OFF \
-DFORCE_OXENMQ_SUBMODULE=ON \
-DFORCE_OXENC_SUBMODULE=ON \
-DFORCE_FMT_SUBMODULE=ON \
-DFORCE_SPDLOG_SUBMODULE=ON \
-DFORCE_NLOHMANN_SUBMODULE=ON \
-DSUBMODULE_CHECK=OFF \
-DWITH_LTO=OFF \
-DCMAKE_BUILD_TYPE=Release \
"$@"
cd -
done
rm -f $build/Makefile
echo "# generated makefile" >> $build/Makefile
echo "all: $build_abis" >> $build/Makefile
for abi in $build_abis; do
echo -ne "$abi:\n\t" >> $build/Makefile
echo -ne '$(MAKE) -C ' >> $build/Makefile
echo "build-$abi lokinet-android" >> $build/Makefile
echo -ne "\tmkdir -p out/$abi && cp build-$abi/jni/liblokinet-android.so out/$abi/liblokinet-android.so\n\n" >> $build/Makefile
echo -ne "clean-$abi:\n\t" >> $build/Makefile
echo -ne '$(MAKE) -C ' >> $build/Makefile
echo "build-$abi clean" >> $build/Makefile
done
echo -ne "clean:" >> $build/Makefile
for targ in $build_abis ; do echo -ne " clean-$targ" >> $build/Makefile ; done
echo "" >> $build/Makefile

@ -0,0 +1,8 @@
#!/bin/bash
set -e
set +x
root="$(readlink -f $(dirname $0)/../)"
cd "$root"
./contrib/android-configure.sh . build-android "$@"
make -C build-android -j ${JOBS:-$(nproc)}

@ -1,8 +1,9 @@
# Last Modified: Sat May 4 18:48:24 2019
# Last Modified: Fri 05 Feb 2021 08:13:58 PM UTC
#include <tunables/global>
/usr/bin/lokinet {
profile lokinet /usr/bin/lokinet {
#include <abstractions/base>
#include <abstractions/nameservice>
capability net_admin,
capability net_bind_service,
@ -11,14 +12,16 @@
network inet6 dgram,
network netlink raw,
/etc/loki/lokinet.ini r,
/dev/net/tun rw,
/lib/@{multiarch}/ld-*.so mr,
/usr/bin/lokinet mr,
owner /var/lib/lokinet/ rw,
owner /var/lib/lokinet/** rwk,
owner @{HOME}/.lokinet/ rw,
owner @{HOME}/.lokinet/** rwk,
owner /{var/,}lib/lokinet/ rw,
owner /{var/,}lib/lokinet/** rwk,
owner ${HOME}/.lokinet/ rw,
owner ${HOME}/.lokinet/** rwk,
owner @{PROC}/@{pid}/task/@{pid}/comm rw,
owner /tmp/lokinet.*/{**,} rw,
#include if exists <local/usr.bin.lokinet>
}

@ -0,0 +1,4 @@
#!/usr/bin/env bash
for f in "$@" ; do
patch -p1 -i "$f"
done

@ -0,0 +1,109 @@
#!/usr/bin/python3
import sys
import pprint
if len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == '-'):
f = sys.stdin.buffer
elif len(sys.argv) != 2 or sys.argv[1].startswith('-'):
print("Usage: {} FILE -- dumps a bencoded file".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
else:
f = open(sys.argv[1], 'rb')
initial = f.peek(2)
is_hex = False
if initial.startswith(b'64') or initial.startswith(b'6c'):
print("Input looks like hex bencoded data; parsing as hex input", file=sys.stderr)
is_hex = True
class HexPrinter():
def __init__(self, data):
self.data = data
def __repr__(self):
return "hex({} bytes):'{}'".format(len(self.data), self.data.hex())
def next_byte():
if is_hex:
pair = f.read(2)
assert pair is not None and len(pair) == 2
b = int(pair, 16).to_bytes(1, 'big')
else:
b = f.read(1)
assert b is not None and len(b) == 1
return b
def parse_int():
s = b''
x = next_byte()
while x in b"0123456789-":
s += x
x = next_byte()
assert x == b'e' and len(s) > 0, "Invalid integer encoding"
return int(s)
def parse_string(s):
x = next_byte()
while x in b"0123456789":
s += x
x = next_byte()
assert x == b':', "Invalid string encoding"
s = int(s)
if is_hex:
data = bytes.fromhex(f.read(2*s).decode('ascii'))
else:
data = f.read(s)
assert len(data) == s, "Truncated string data"
# If the string is ascii then convert to string:
if all(0x20 <= b <= 0x7e for b in data):
return data.decode()
# Otherwise display as hex:
return HexPrinter(data)
def parse_dict():
d = {}
last_key = None
while True:
t = next_byte()
if t == b'e':
return d
assert t in b"0123456789", "Invalid dict: dict keys must be strings"
key = parse_string(t)
raw_key = key.data if isinstance(key, HexPrinter) else key.encode()
if last_key is not None and raw_key <= last_key:
print("Warning: found out-of-order dict keys ({} after {})".format(raw_key, last_key), file=sys.stderr)
last_key = raw_key
t = next_byte()
d[key] = parse_thing(t)
def parse_list():
l = []
while True:
t = next_byte()
if t == b'e':
return l
l.append(parse_thing(t))
def parse_thing(t):
if t == b'd':
return parse_dict()
if t == b'l':
return parse_list()
if t == b'i':
return parse_int()
if t in b"0123456789":
return parse_string(t)
assert False, "Parsing error: encountered invalid type '{}'".format(t)
pprint.PrettyPrinter(
indent=2
).pprint(parse_thing(next_byte()))

@ -1 +0,0 @@
lokinet-bootserv

@ -1,29 +0,0 @@
# replace your.server.tld with your server's fqdn
server {
listen 80;
server_name your.server.tld;
location / {
return 302 https://your.server.tld$request_uri;
}
location /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
}
server {
listen 443 ssl;
server_name your.server.tld;
ssl_certificate /etc/letsencrypt/live/your.server.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your.server.tld/privkey.pem;
location / {
root /var/www/lokinet-bootserv;
}
location /bootstrap.signed {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/bin/lokinet-bootserv;
fastcgi_pass unix://tmp/cgi.sock;
}
}

@ -1,4 +0,0 @@
# set me to where the nodedb is for lokinet
#[nodedb]
#dir=/path/to/nodedb/

@ -1,20 +0,0 @@
SRC = $(sort $(wildcard src/*.cpp))
OBJS = $(SRC:.cpp=.cpp.o)
CGI_EXE = lokinet-bootserv
CXX = clang++
all: build
build: $(CGI_EXE)
%.cpp.o: %.cpp
$(CXX) -g -std=c++17 -c -Wall -Werror -Wpedantic $^ -o $^.o
$(CGI_EXE): $(OBJS)
$(CXX) -o $(CGI_EXE) $^
clean:
rm -f $(CGI_EXE) $(OBJS)

@ -1,35 +0,0 @@
# lokinet-bootserv
cgi executable for serving a random RC for bootstrap from a nodedb
## configuring
copy the example config (privileged)
# cp configs/lokinet-bootserv.ini /usr/local/etc/lokinet-bootserv.ini
edit config to have proper values,
specifically make sure the `[nodedb]` section has a `dir` value that points to a static copy of a healthy nodedb
## building
to build:
$ make
## installing (priviledged)
install cgi binary:
# cp lokinet-bootserv /usr/local/bin/lokinet-bootserv
set up with nginx cgi:
# cp configs/lokinet-bootserv-nginx.conf /etc/nginx/sites-available/lokinet-bootserv.conf
# ln -s /etc/nginx/sites-available/lokinet-bootserv.conf /etc/nginx/sites-enabled/
## maintainence
add the following to crontab
0 0 * * * /usr/local/bin/lokinet-bootserv --cron

@ -1,171 +0,0 @@
#include "lokinet-cgi.hpp"
#include <fstream>
#include <dirent.h>
#include <list>
#include <sstream>
namespace lokinet
{
namespace bootserv
{
CGIHandler::CGIHandler(std::ostream& o) : Handler(o)
{
}
CGIHandler::~CGIHandler()
{
}
int
CGIHandler::Exec(const Config& conf)
{
const char* e = getenv("REQUEST_METHOD");
if(e == nullptr)
return ReportError("$REQUEST_METHOD not set");
std::string_view method(e);
if(method != "GET")
{
out << "Content-Type: text/plain" << std::endl;
out << "Status: 405 Method Not Allowed" << std::endl << std::endl;
return 0;
}
std::string fname;
if(!conf.VisitSection(
"nodedb", [&](const Config::Section_t& sect) -> bool {
auto itr = sect.find("dir");
if(itr == sect.end())
return false;
fname = PickRandomFileInDir(
std::string(itr->second.data(), itr->second.size()));
return true;
}))
return ReportError("bad values in nodedb section of config");
if(fname.empty())
{
// no files in nodedb
out << "Content-Type: text/plain" << std::endl;
out << "Status: 404 Not Found" << std::endl << std::endl;
return 0;
}
return ServeFile(fname.c_str(), "application/octect-stream");
}
std::string
CGIHandler::PickRandomFileInDir(std::string dirname) const
{
// collect files
std::list< std::string > files;
{
DIR* d = opendir(dirname.c_str());
if(d == nullptr)
{
return "";
};
std::list< std::string > subdirs;
dirent* ent = nullptr;
while((ent = readdir(d)))
{
std::string_view f = ent->d_name;
if(f != "." && f != "..")
{
std::stringstream ss;
ss << dirname;
ss << '/';
ss << f;
subdirs.emplace_back(ss.str());
}
}
closedir(d);
for(const auto& subdir : subdirs)
{
d = opendir(subdir.c_str());
if(d)
{
while((ent = readdir(d)))
{
std::string_view f;
f = ent->d_name;
if(f != "." && f != ".."
&& f.find_last_of(".signed") != std::string_view::npos)
{
std::stringstream ss;
ss << subdir << "/" << f;
files.emplace_back(ss.str());
}
}
closedir(d);
}
}
}
uint32_t randint;
{
std::basic_ifstream< uint32_t > randf("/dev/urandom");
if(!randf.is_open())
return "";
randf.read(&randint, 1);
}
auto itr = files.begin();
if(files.size() > 1)
std::advance(itr, randint % files.size());
return *itr;
}
int
CGIHandler::ServeFile(const char* fname, const char* contentType) const
{
std::ifstream f(fname);
if(f.is_open())
{
f.seekg(0, std::ios::end);
auto sz = f.tellg();
f.seekg(0, std::ios::beg);
if(sz)
{
out << "Content-Type: " << contentType << std::endl;
out << "Status: 200 OK" << std::endl;
out << "Content-Length: " << std::to_string(sz) << std::endl
<< std::endl;
char buf[512] = {0};
size_t r = 0;
while((r = f.readsome(buf, sizeof(buf))) > 0)
out.write(buf, r);
out << std::flush;
}
else
{
out << "Content-Type: text/plain" << std::endl;
out << "Status: 500 Internal Server Error" << std::endl << std::endl;
out << "could not serve '" << fname << "' as it is an empty file"
<< std::endl;
}
}
else
{
out << "Content-Type: text/plain" << std::endl;
out << "Status: 404 Not Found" << std::endl << std::endl;
out << "could not serve '" << fname
<< "' as it does not exist on the filesystem" << std::endl;
}
return 0;
}
int
CGIHandler::ReportError(const char* err)
{
out << "Content-Type: text/plain" << std::endl;
out << "Status: 500 Internal Server Error" << std::endl << std::endl;
out << err << std::endl;
return 0;
}
Handler_ptr
NewCGIHandler(std::ostream& out)
{
return std::make_unique< CGIHandler >(out);
}
} // namespace bootserv
} // namespace lokinet

@ -1,43 +0,0 @@
#ifndef LOKINET_BOOTSERV_HANDLER_HPP
#define LOKINET_BOOTSERV_HANDLER_HPP
#include <iostream>
#include "lokinet-config.hpp"
namespace lokinet
{
namespace bootserv
{
struct Handler
{
Handler(std::ostream& o) : out(o){};
virtual ~Handler(){};
/// handle command
/// return exit code
virtual int
Exec(const Config& conf) = 0;
/// report an error to system however that is done
/// return exit code
virtual int
ReportError(const char* err) = 0;
protected:
std::ostream& out;
};
using Handler_ptr = std::unique_ptr< Handler >;
/// create cgi handler
Handler_ptr
NewCGIHandler(std::ostream& out);
/// create cron handler
Handler_ptr
NewCronHandler(std::ostream& out);
} // namespace bootserv
} // namespace lokinet
#endif

@ -1,31 +0,0 @@
#ifndef BOOTSERV_LOKINET_CRON_HPP
#define BOOTSERV_LOKINET_CRON_HPP
#include "handler.hpp"
namespace lokinet
{
namespace bootserv
{
struct CGIHandler final : public Handler
{
CGIHandler(std::ostream& o);
~CGIHandler();
int
Exec(const Config& conf) override;
int
ReportError(const char* err) override;
int
ServeFile(const char* fname, const char* mime) const;
std::string
PickRandomFileInDir(std::string dirname) const;
};
} // namespace bootserv
} // namespace lokinet
#endif

@ -1,132 +0,0 @@
#include "lokinet-config.hpp"
#include <fstream>
#include <list>
#include <iostream>
namespace lokinet
{
namespace bootserv
{
const char* Config::DefaultPath = "/usr/local/etc/lokinet-bootserv.ini";
bool
Config::LoadFile(const char* fname)
{
{
std::ifstream f(fname);
if(!f.is_open())
return false;
f.seekg(0, std::ios::end);
m_Data.resize(f.tellg());
f.seekg(0, std::ios::beg);
if(m_Data.size() == 0)
return false;
f.read(m_Data.data(), m_Data.size());
}
return Parse();
}
void
Config::Clear()
{
m_Config.clear();
m_Data.clear();
}
bool
Config::Parse()
{
std::list< String_t > lines;
{
auto itr = m_Data.begin();
// split into lines
while(itr != m_Data.end())
{
auto beg = itr;
while(itr != m_Data.end() && *itr != '\n' && *itr != '\r')
++itr;
lines.emplace_back(std::addressof(*beg), (itr - beg));
if(itr == m_Data.end())
break;
++itr;
}
}
String_t sectName;
for(const auto& line : lines)
{
String_t realLine;
auto comment = line.find_first_of(';');
if(comment == String_t::npos)
comment = line.find_first_of('#');
if(comment == String_t::npos)
realLine = line;
else
realLine = line.substr(0, comment);
// blank or commented line?
if(realLine.size() == 0)
continue;
// find delimiters
auto sectOpenPos = realLine.find_first_of('[');
auto sectClosPos = realLine.find_first_of(']');
auto kvDelim = realLine.find_first_of('=');
if(sectOpenPos != String_t::npos && sectClosPos != String_t::npos
&& kvDelim == String_t::npos)
{
// section header
// clamp whitespaces
++sectOpenPos;
while(std::isspace(realLine[sectOpenPos])
&& sectOpenPos != sectClosPos)
++sectOpenPos;
--sectClosPos;
while(std::isspace(realLine[sectClosPos])
&& sectClosPos != sectOpenPos)
--sectClosPos;
// set section name
sectName = realLine.substr(sectOpenPos, sectClosPos);
}
else if(kvDelim != String_t::npos)
{
// key value pair
String_t::size_type k_start = 0;
String_t::size_type k_end = kvDelim;
String_t::size_type v_start = kvDelim + 1;
String_t::size_type v_end = realLine.size() - 1;
// clamp whitespaces
while(std::isspace(realLine[k_start]) && k_start != kvDelim)
++k_start;
while(std::isspace(realLine[k_end]) && k_end != k_start)
--k_end;
while(std::isspace(realLine[v_start]) && v_start != v_end)
++v_start;
while(std::isspace(realLine[v_end]))
--v_end;
// sect.k = v
String_t k = realLine.substr(k_start, k_end);
String_t v = realLine.substr(v_start, v_end);
Section_t& sect = m_Config[sectName];
sect[k] = v;
}
else // malformed?
return false;
}
return true;
}
bool
Config::VisitSection(
const char* name,
std::function< bool(const Section_t& sect) > visit) const
{
auto itr = m_Config.find(name);
if(itr == m_Config.end())
return false;
return visit(itr->second);
}
} // namespace bootserv
} // namespace lokinet

@ -1,47 +0,0 @@
#ifndef LOKINET_BOOTSERV_CONFIG_HPP
#define LOKINET_BOOTSERV_CONFIG_HPP
#include <unordered_map>
#include <string_view>
#include <functional>
#include <memory>
#include <vector>
namespace lokinet
{
namespace bootserv
{
struct Config
{
using String_t = std::string_view;
using Section_t = std::unordered_map< String_t, String_t >;
using Config_impl_t = std::unordered_map< String_t, Section_t >;
static const char* DefaultPath;
/// clear config
void
Clear();
/// load config file for bootserv
/// return true on success
/// return false on error
bool
LoadFile(const char* fname);
/// visit a section in config read only by name
/// return false if no section or value propagated from visitor
bool
VisitSection(const char* name,
std::function< bool(const Section_t&) > visit) const;
private:
bool
Parse();
std::vector< char > m_Data;
Config_impl_t m_Config;
};
} // namespace bootserv
} // namespace lokinet
#endif

@ -1,37 +0,0 @@
#include "lokinet-cron.hpp"
namespace lokinet
{
namespace bootserv
{
CronHandler::CronHandler(std::ostream& o) : Handler(o)
{
}
CronHandler::~CronHandler()
{
}
int
CronHandler::Exec(const Config& conf)
{
// this runs the cron tasks
// TODO: implement me
return 0;
}
int
CronHandler::ReportError(const char* err)
{
out << "error: " << err << std::endl;
return 1;
}
Handler_ptr
NewCronHandler(std::ostream& out)
{
return std::make_unique< CronHandler >(out);
}
} // namespace bootserv
} // namespace lokinet

@ -1,25 +0,0 @@
#ifndef BOOTSERV_LOKINET_CRON_HPP
#define BOOTSERV_LOKINET_CRON_HPP
#include "handler.hpp"
namespace lokinet
{
namespace bootserv
{
struct CronHandler final : public Handler
{
CronHandler(std::ostream& o);
~CronHandler();
int
Exec(const Config& conf) override;
int
ReportError(const char* err) override;
};
} // namespace bootserv
} // namespace lokinet
#endif

@ -1,60 +0,0 @@
#include "handler.hpp"
#include "lokinet-config.hpp"
#include <getopt.h>
#include <string_view>
#include <sstream>
static int
printhelp(const char* exe)
{
std::cout << "usage: " << exe << " [--cron] [--conf /path/to/alt/config.ini]"
<< std::endl;
return 1;
}
int
main(int argc, char* argv[])
{
bool RunCron = false;
const char* confFile = lokinet::bootserv::Config::DefaultPath;
lokinet::bootserv::Config config;
lokinet::bootserv::Handler_ptr handler;
option longopts[] = {{"cron", no_argument, 0, 'C'},
{"help", no_argument, 0, 'h'},
{"conf", required_argument, 0, 'c'},
{0, 0, 0, 0}};
int c = 0;
int index = 0;
while((c = getopt_long(argc, argv, "hCc:", longopts, &index)) != -1)
{
switch(c)
{
case 'h':
return printhelp(argv[0]);
case 'C':
RunCron = true;
break;
case 'c':
confFile = optarg;
break;
}
}
if(RunCron)
handler = lokinet::bootserv::NewCronHandler(std::cout);
else
handler = lokinet::bootserv::NewCGIHandler(std::cout);
if(!config.LoadFile(confFile))
{
std::stringstream ss;
ss << "failed to load " << confFile;
return handler->ReportError(ss.str().c_str());
}
else
return handler->Exec(config);
}

Binary file not shown.

@ -0,0 +1 @@
ld1:ald1:ci2e1:d3:iwp1:e32:9ãxÚsX«l%ìû€ê<,sØ›•©÷ïå_1:i21:::ffff:144.76.164.2021:pi1666e1:vi0eee1:i5:gamma1:k32:ÞÊðòm=o„ZÐ1ÿßmcŒ%»¸ÿû¾™SĹ1:p32:!EÏâéz˜ý:Š‹úý… /0¡Ú„ Ãݪ„µNçB1:rli0ei0ei8ei3ee1:ui1614788310454e1:vi0e1:xle1:z64:Œ¤u G¿”D“=Œxµ¢{ïÌ51þ`í߀ùEâw m)q2Øg¯±˜øš ï³À)˜TÑP•´ò³ö—Á1ee

@ -0,0 +1,9 @@
## drone-ci docker jizz
To rebuild all ci images and push them to the oxen registry server do:
$ docker login registry.oxen.rocks
$ ./rebuild-docker-images.py
If you aren't part of the Oxen team, you'll likely need to set up your own registry and change
registry.oxen.rocks to your own domain name in order to do anything useful with this.

@ -0,0 +1,350 @@
#!/usr/bin/env python3
import subprocess
import tempfile
import optparse
import sys
from concurrent.futures import ThreadPoolExecutor
import threading
parser = optparse.OptionParser()
parser.add_option("--no-cache", action="store_true",
help="Run `docker build` with the `--no-cache` option to ignore existing images")
parser.add_option("--parallel", "-j", type="int", default=1,
help="Run up to this many builds in parallel")
parser.add_option("--distro", type="string", default="",
help="Build only this distro; should be DISTRO-CODE or DISTRO-CODE/ARCH, "
"e.g. debian-sid/amd64")
(options, args) = parser.parse_args()
registry_base = 'registry.oxen.rocks/lokinet-ci-'
distros = [*(('debian', x) for x in ('sid', 'stable', 'testing', 'bullseye', 'buster')),
*(('ubuntu', x) for x in ('rolling', 'lts', 'impish', 'hirsute', 'focal', 'bionic'))]
if options.distro:
d = options.distro.split('-')
if len(d) != 2 or d[0] not in ('debian', 'ubuntu') or not d[1]:
print("Bad --distro value '{}'".format(options.distro), file=sys.stderr)
sys.exit(1)
distros = [(d[0], d[1].split('/')[0])]
manifests = {} # "image:latest": ["image/amd64", "image/arm64v8", ...]
manifestlock = threading.Lock()
def arches(distro):
if options.distro and '/' in options.distro:
arch = options.distro.split('/')
if arch not in ('amd64', 'i386', 'arm64v8', 'arm32v7'):
print("Bad --distro value '{}'".format(options.distro), file=sys.stderr)
sys.exit(1)
return [arch]
a = ['amd64', 'arm64v8', 'arm32v7']
if distro[0] == 'debian' or distro == ('ubuntu', 'bionic'):
a.append('i386') # i386 builds don't work on later ubuntu
return a
hacks = {
registry_base + 'ubuntu-bionic-builder': """g++-8 \
&& mkdir -p /usr/lib/x86_64-linux-gnu/pgm-5.2/include""",
}
failure = False
lineno = 0
linelock = threading.Lock()
def print_line(myline, value):
linelock.acquire()
global lineno
if sys.__stdout__.isatty():
jump = lineno - myline
print("\033[{jump}A\r\033[K{value}\033[{jump}B\r".format(jump=jump, value=value), end='')
sys.stdout.flush()
else:
print(value)
linelock.release()
def run_or_report(*args, myline):
try:
subprocess.run(
args, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf8')
except subprocess.CalledProcessError as e:
with tempfile.NamedTemporaryFile(suffix=".log", delete=False) as log:
log.write("Error running {}: {}\n\nOutput:\n\n".format(' '.join(args), e).encode())
log.write(e.output.encode())
global failure
failure = True
print_line(myline, "\033[31;1mError! See {} for details".format(log.name))
raise e
def build_tag(tag_base, arch, contents):
if failure:
raise ChildProcessError()
linelock.acquire()
global lineno
myline = lineno
lineno += 1
print()
linelock.release()
with tempfile.NamedTemporaryFile() as dockerfile:
dockerfile.write(contents.encode())
dockerfile.flush()
tag = '{}/{}'.format(tag_base, arch)
print_line(myline, "\033[33;1mRebuilding \033[35;1m{}\033[0m".format(tag))
run_or_report('docker', 'build', '--pull', '-f', dockerfile.name, '-t', tag,
*(('--no-cache',) if options.no_cache else ()), '.', myline=myline)
print_line(myline, "\033[33;1mPushing \033[35;1m{}\033[0m".format(tag))
run_or_report('docker', 'push', tag, myline=myline)
print_line(myline, "\033[32;1mFinished build \033[35;1m{}\033[0m".format(tag))
latest = tag_base + ':latest'
global manifests
manifestlock.acquire()
if latest in manifests:
manifests[latest].append(tag)
else:
manifests[latest] = [tag]
manifestlock.release()
def base_distro_build(distro, arch):
tag = '{r}{distro[0]}-{distro[1]}-base'.format(r=registry_base, distro=distro)
codename = 'latest' if distro == ('ubuntu', 'lts') else distro[1]
build_tag(tag, arch, """
FROM {}/{}:{}
RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
&& apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
&& apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y \
{hacks}
""".format(arch, distro[0], codename, hacks=hacks.get(tag, '')))
def distro_build(distro, arch):
prefix = '{r}{distro[0]}-{distro[1]}'.format(r=registry_base, distro=distro)
fmtargs = dict(arch=arch, distro=distro, prefix=prefix)
# (distro)-(codename)-base: Base image from upstream: we sync the repos, but do nothing else.
if (distro, arch) != (('debian', 'stable'), 'amd64'): # debian-stable-base/amd64 already built
base_distro_build(distro, arch)
# (distro)-(codename)-builder: Deb builder image used for building debs; we add the basic tools
# we use to build debs, not including things that should come from the dependencies in the
# debian/control file.
build_tag(prefix + '-builder', arch, """
FROM {prefix}-base/{arch}
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
&& apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
&& apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \
ccache \
devscripts \
equivs \
g++ \
git \
git-buildpackage \
openssh-client \
{hacks}
""".format(**fmtargs, hacks=hacks.get(prefix + '-builder', '')))
# (distro)-(codename): Basic image we use for most builds. This takes the -builder and adds
# most dependencies found in our packages.
build_tag(prefix, arch, """
FROM {prefix}-builder/{arch}
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
&& apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
&& apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \
automake \
ccache \
cmake \
eatmydata \
g++ \
gdb \
git \
libboost-program-options-dev \
libboost-serialization-dev \
libboost-thread-dev \
libcurl4-openssl-dev \
libevent-dev \
libgtest-dev \
libhidapi-dev \
libjemalloc-dev \
libminiupnpc-dev \
libreadline-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libsystemd-dev \
libtool \
libunbound-dev \
libunwind8-dev \
libusb-1.0.0-dev \
libuv1-dev \
libzmq3-dev \
lsb-release \
make \
nettle-dev \
ninja-build \
openssh-client \
patch \
pkg-config \
pybind11-dev \
python3-dev \
python3-pip \
python3-pybind11 \
python3-pytest \
python3-setuptools \
qttools5-dev \
{hacks}
""".format(**fmtargs, hacks=hacks.get(prefix, '')))
# Android and flutter builds on top of debian-stable-base and adds a ton of android crap; we
# schedule this job as soon as the debian-sid-base/amd64 build finishes, because they easily take
# the longest and are by far the biggest images.
def android_builds():
build_tag(registry_base + 'android', 'amd64', """
FROM {r}debian-stable-base
RUN /bin/bash -c 'sed -i "s/main/main contrib/g" /etc/apt/sources.list'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
&& apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
&& apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
android-sdk \
automake \
ccache \
cmake \
curl \
git \
google-android-ndk-installer \
libtool \
make \
openssh-client \
patch \
pkg-config \
wget \
xz-utils \
zip \
&& git clone https://github.com/Shadowstyler/android-sdk-licenses.git /tmp/android-sdk-licenses \
&& cp -a /tmp/android-sdk-licenses/*-license /usr/lib/android-sdk/licenses \
&& rm -rf /tmp/android-sdk-licenses
""".format(r=registry_base))
build_tag(registry_base + 'flutter', 'amd64', """
FROM {r}android
RUN cd /opt \
&& curl https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.2.2-stable.tar.xz \
| tar xJv \
&& ln -s /opt/flutter/bin/flutter /usr/local/bin/ \
&& flutter precache
""".format(r=registry_base))
# lint is a tiny build (on top of debian-stable-base) with just formatting checking tools
def lint_build():
build_tag(registry_base + 'lint', 'amd64', """
FROM {r}debian-stable-base
RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
clang-format-11 \
eatmydata \
git \
jsonnet
""".format(r=registry_base))
def nodejs_build():
build_tag(registry_base + 'nodejs', 'amd64', """
FROM node:14.16.1
RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
&& apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
&& apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
ccache \
cmake \
eatmydata \
g++ \
gdb \
git \
make \
ninja-build \
openssh-client \
patch \
pkg-config \
wine
""")
# Start debian-stable-base/amd64 on its own, because other builds depend on it and we want to get
# those (especially android/flutter) fired off as soon as possible (because it's slow and huge).
if ('debian', 'stable') in distros:
base_distro_build(['debian', 'stable'], 'amd64')
executor = ThreadPoolExecutor(max_workers=max(options.parallel, 1))
if options.distro:
jobs = []
else:
jobs = [executor.submit(b) for b in (android_builds, lint_build, nodejs_build)]
for d in distros:
for a in arches(d):
jobs.append(executor.submit(distro_build, d, a))
while len(jobs):
j = jobs.pop(0)
try:
j.result()
except (ChildProcessError, subprocess.CalledProcessError):
for k in jobs:
k.cancel()
if failure:
print("Error(s) occured, aborting!", file=sys.stderr)
sys.exit(1)
print("\n\n\033[32;1mAll builds finished successfully; pushing manifests...\033[0m\n")
def push_manifest(latest, tags):
if failure:
raise ChildProcessError()
linelock.acquire()
global lineno
myline = lineno
lineno += 1
print()
linelock.release()
subprocess.run(['docker', 'manifest', 'rm', latest], stderr=subprocess.DEVNULL, check=False)
print_line(myline, "\033[33;1mCreating manifest \033[35;1m{}\033[0m".format(latest))
run_or_report('docker', 'manifest', 'create', latest, *tags, myline=myline)
print_line(myline, "\033[33;1mPushing manifest \033[35;1m{}\033[0m".format(latest))
run_or_report('docker', 'manifest', 'push', latest, myline=myline)
print_line(myline, "\033[32;1mFinished manifest \033[35;1m{}\033[0m".format(latest))
for latest, tags in manifests.items():
jobs.append(executor.submit(push_manifest, latest, tags))
while len(jobs):
j = jobs.pop(0)
try:
j.result()
except (ChildProcessError, subprocess.CalledProcessError):
for k in jobs:
k.cancel()
print("\n\n\033[32;1mAll done!\n")

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Script used with Drone CI to check that a statically build lokinet only links against the expected
# base system libraries. Expects to be run with pwd of the build directory.
set -o errexit
bad=
if [ "$DRONE_STAGE_OS" == "darwin" ]; then
if otool -L llarp/apple/org.lokinet.network-extension.systemextension/Contents/MacOS/org.lokinet.network-extension | \
grep -Ev '^llarp/apple:|^\t(/usr/lib/lib(System\.|c\+\+|objc))|/System/Library/Frameworks/(CoreFoundation|NetworkExtension|Foundation|Network)\.framework'; then
bad=1
fi
elif [ "$DRONE_STAGE_OS" == "linux" ]; then
if ldd daemon/lokinet | grep -Ev '(linux-vdso|ld-linux-(x86-64|armhf|aarch64)|lib(pthread|dl|rt|stdc\+\+|gcc_s|c|m))\.so'; then
bad=1
fi
else
echo -e "\n\n\n\n\e[31;1mDon't know how to check linked libs on $DRONE_STAGE_OS\e[0m\n\n\n"
exit 1
fi
if [ -n "$bad" ]; then
echo -e "\n\n\n\n\e[31;1mlokinet links to unexpected libraries\e[0m\n\n\n"
exit 1
fi
echo -e "\n\n\n\n\e[32;1mNo unexpected linked libraries found\e[0m\n\n\n"

@ -0,0 +1,50 @@
#!/bin/bash
# Script used with Drone CI to upload debs from the deb building pipelines (because specifying all
# this in .drone.jsonnet is too painful). This is expected to run from the base project dir after
# having build with debuild (which will leave the debs in ..).
set -o errexit
distro="$1"
if [ -z "$distro" ]; then
echo "Bad usage: need distro name as first argument"
exit 1
fi
if [ -z "$SSH_KEY" ]; then
echo -e "\n\n\n\e[31;1mUnable to upload debs: SSH_KEY not set\e[0m"
# Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
exit 0
fi
echo "$SSH_KEY" >~/ssh_key
set -o xtrace # Don't start tracing until *after* we write the ssh key
chmod 600 ~/ssh_key
upload_to="oxen.rocks/debs/${DRONE_REPO// /_}@${DRONE_BRANCH// /_}/$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}/$distro/$DRONE_STAGE_ARCH"
# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands. The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
dir_tmp="$dir_tmp$p/"
mkdirs="$mkdirs
-mkdir $dir_tmp"
done
sftp -i ~/ssh_key -b - -o StrictHostKeyChecking=off drone@oxen.rocks <<SFTP
$mkdirs
put ../*.*deb $upload_to
SFTP
set +o xtrace
echo -e "\n\n\n\n\e[32;1mUploaded debs to https://${upload_to}/\e[0m\n\n\n"

@ -0,0 +1,9 @@
#!/usr/bin/env bash
test "x$IGNORE" != "x" && exit 0
. $(dirname $0)/../format-version.sh
repo=$(readlink -e $(dirname $0)/../../)
$CLANG_FORMAT -i $(find $repo/jni $repo/daemon $repo/llarp $repo/include $repo/pybind | grep -E '\.[hc](pp)?$')
jsonnetfmt -i $repo/.drone.jsonnet
git --no-pager diff --exit-code --color || (echo -ne '\n\n\e[31;1mLint check failed; please run ./contrib/format.sh\e[0m\n\n' ; exit 1)

@ -0,0 +1,5 @@
#!/usr/bin/env bash
rm -f crash.out.txt exit.out.txt
gdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args $@
test -e crash.out.txt && cat crash.out.txt
exit $(cat exit.out.txt)

@ -0,0 +1,6 @@
#!/usr/bin/env bash
export PYTHONPATH=pybind
rm -f crash.out.txt exit.out.txt
gdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args /usr/bin/python3 -m pytest ../test/
test -e crash.out.txt && cat crash.out.txt
exit $(cat exit.out.txt)

@ -0,0 +1,96 @@
#!/usr/bin/env bash
# Script used with Drone CI to upload build artifacts (because specifying all this in
# .drone.jsonnet is too painful).
set -o errexit
if [ -z "$SSH_KEY" ]; then
echo -e "\n\n\n\e[31;1mUnable to upload artifact: SSH_KEY not set\e[0m"
# Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
exit 0
fi
echo "$SSH_KEY" >ssh_key
set -o xtrace # Don't start tracing until *after* we write the ssh key
chmod 600 ssh_key
os="$UPLOAD_OS"
if [ -z "$os" ]; then
if [ "$DRONE_STAGE_OS" == "darwin" ]; then
os="macos-$DRONE_STAGE_ARCH"
elif [ -n "$WINDOWS_BUILD_NAME" ]; then
os="windows-$WINDOWS_BUILD_NAME"
else
os="$DRONE_STAGE_OS-$DRONE_STAGE_ARCH"
fi
fi
if [ -n "$DRONE_TAG" ]; then
# For a tag build use something like `lokinet-linux-amd64-v1.2.3`
base="lokinet-$os-$DRONE_TAG"
else
# Otherwise build a length name from the datetime and commit hash, such as:
# lokinet-linux-amd64-20200522T212342Z-04d7dcc54
base="lokinet-$os-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}"
fi
mkdir -v "$base"
if [ -e build/win32 ]; then
# save debug symbols
cp -av build/win32/daemon/debug-symbols.tar.xz "$base-debug-symbols.tar.xz"
# save installer
cp -av build/win32/*.exe "$base"
# zipit up yo
archive="$base.zip"
zip -r "$archive" "$base"
elif [ -e lokinet.apk ] ; then
# android af ngl
archive="$base.apk"
cp -av lokinet.apk "$archive"
elif [ -e build-docs ]; then
archive="$base.tar.xz"
cp -av build-docs/docs/mkdocs.yml build-docs/docs/markdown "$base"
tar cJvf "$archive" "$base"
elif [ -e build-mac ]; then
archive="$base.tar.xz"
mv build-mac/Lokinet*/ "$base"
tar cJvf "$archive" "$base"
else
cp -av build/daemon/lokinet{,-vpn} "$base"
cp -av contrib/bootstrap/mainnet.signed "$base/bootstrap.signed"
# tar dat shiz up yo
archive="$base.tar.xz"
tar cJvf "$archive" "$base"
fi
upload_to="oxen.rocks/${DRONE_REPO// /_}/${DRONE_BRANCH// /_}"
# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands. The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
put_debug=
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
dir_tmp="$dir_tmp$p/"
mkdirs="$mkdirs
-mkdir $dir_tmp"
done
if [ -e "$base-debug-symbols.tar.xz" ] ; then
put_debug="put $base-debug-symbols.tar.xz $upload_to"
fi
sftp -i ssh_key -b - -o StrictHostKeyChecking=off drone@oxen.rocks <<SFTP
$mkdirs
put $archive $upload_to
$put_debug
SFTP
set +o xtrace
echo -e "\n\n\n\n\e[32;1mUploaded to https://${upload_to}/${archive}\e[0m\n\n\n"

@ -0,0 +1,36 @@
def exit_handler (event):
"""
write exit code of the program running in gdb to a file called exit.out.txt
"""
code = 1
if hasattr(event, "exit_code"):
code = event.exit_code
with open("exit.out.txt", 'w') as f:
f.write("{}".format(code))
def gdb_execmany(*cmds):
"""
run multiple gdb commands
"""
for cmd in cmds:
gdb.execute(cmd)
def crash_handler (event):
"""
handle a crash from the program running in gdb
"""
if isinstance(event, gdb.SignalEvent):
log_file_name = "crash.out.txt"
# poop out log file for stack trace of all threads
gdb_execmany("set logging file {}".format(log_file_name), "set logging on", "set logging redirect on", "thread apply all bt full")
# quit gdb
gdb.execute("q")
# set up event handlers to catch shit
gdb.events.stop.connect(crash_handler)
gdb.events.exited.connect(exit_handler)
# run settings setup
gdb_execmany("set confirm off", "set pagination off", "set print thread-events off")
# run program and exit
gdb_execmany("r", "q")

@ -1,3 +0,0 @@
#!/bin/sh
rm -fr loki*/tmp-nodes
rm loki*/profile.dat

@ -1,9 +0,0 @@
#!/bin/sh
# copy a lokinet binary into this cluster
cp ../../lokinet .
# generate default config file
./lokinet -g -r lokinet.ini
# make seed node
./makenode.sh 1
# establish bootstrap
ln -s loki1/self.signed bootstrap.signed

@ -1,7 +0,0 @@
mkdir loki$1
cd loki$1
ln -s ../lokinet lokinet$1
cp ../lokinet.ini .
nano lokinet.ini
cd ..
echo "killall -9 lokinet$1" >> ../stop.sh

@ -1,16 +0,0 @@
#!/bin/bash
set +x
cd loki1
nohup ./lokinet1 $PWD/lokinet.ini &
# seed node needs some time to write RC to make sure it's not expired on load for the rest
sleep 1
cd ../loki2
nohup ./lokinet2 $PWD/lokinet.ini &
cd ../loki3
nohup ./lokinet3 $PWD/lokinet.ini &
cd ../loki4
nohup ./lokinet4 $PWD/lokinet.ini &
cd ../loki5
nohup ./lokinet5 $PWD/lokinet.ini &
cd ..
tail -f loki*/nohup.out

@ -1,7 +0,0 @@
#!/bin/sh
killall -9 lokinet1
killall -9 lokinet2
killall -9 lokinet3
killall -9 lokinet4
killall -9 lokinet5
killall -9 lokinet6

@ -0,0 +1,2 @@
[logging]
level=debug

@ -0,0 +1,5 @@
#
# "suggested" default exit node config
#
[network]
exit-node=exit.loki

@ -0,0 +1,5 @@
#
# persist .loki address in a private key file in the data dir
#
[network]
keyfile=lokinet-addr.privkey

@ -0,0 +1,65 @@
#!/bin/bash
#
# helper script for me for when i cross compile
# t. jeff
#
set -e
die() {
echo $@
exit 1
}
platform=${PLATFORM:-Linux}
root="$(readlink -e $(dirname $0)/../)"
cd $root
mkdir -p build-cross
targets=()
cmake_extra=()
while [ "$#" -gt 0 ]; do
if [ "$1" = "--" ]; then
shift
cmake_extra=("$@")
break
fi
targets+=("$1")
shift
done
test ${#targets[@]} = 0 && die no targets provided
archs="${targets[@]}"
echo "all: $archs" > build-cross/Makefile
for arch in $archs ; do
mkdir -p $root/build-cross/build-$arch
cd $root/build-cross/build-$arch
cmake \
-G 'Unix Makefiles' \
-DCROSS_PLATFORM=$platform \
-DCROSS_PREFIX=$arch \
-DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \
-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always \
-DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/cross.toolchain.cmake \
-DBUILD_STATIC_DEPS=ON \
-DSTATIC_LINK=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \
-DWITH_SYSTEMD=OFF \
-DFORCE_OXENMQ_SUBMODULE=ON \
-DSUBMODULE_CHECK=OFF \
-DWITH_LTO=OFF \
-DWITH_BOOTSTRAP=OFF \
-DCMAKE_BUILD_TYPE=RelWithDeb \
"${cmake_extra[@]}" \
$root
cd $root/build-cross
echo -ne "$arch:\n\t\$(MAKE) -C build-$arch\n" >> $root/build-cross/Makefile
done
cd $root
make -j${JOBS:-$(nproc)} -C build-cross

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save