Commit Graph

7979 Commits

Author SHA1 Message Date
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.
2022-11-01 11:06:00 -04:00
Jason Rhinelander
4ad66ac2a5
Remove unused VERSION_STR constant 2022-11-01 11:06:00 -04:00
Jason Rhinelander
5be7dbf8ec
Move log init even earlier 2022-11-01 11:06:00 -04:00
Jeff Becker
3b6cbec08e
fix typo in filename 2022-11-01 11:06:00 -04:00
Jeff Becker
a16af792d2
simplify logic for disabling service manager on windows 2022-11-01 11:06:00 -04:00
majestrate
84834089d1
Update llarp/router/router.cpp
use `fmt::join` for lokinet version string in status

Co-authored-by: Jason Rhinelander <jason@imaginary.ca>
2022-11-01 11:05:59 -04:00
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.
2022-11-01 11:05:59 -04:00
Jason Rhinelander
71bea4f0fc
Add networkReady to stats result 2022-11-01 11:05:59 -04:00
Jason Rhinelander
bd5efd8149
Update gui to latest 2022-11-01 11:05:59 -04:00
Jason Rhinelander
5c12110e93
Add some more debugging 2022-11-01 11:05:58 -04:00
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
2022-11-01 11:05:58 -04:00
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)
2022-11-01 11:05:58 -04:00
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).
2022-11-01 11:04:58 -04:00
Jeff Becker
a7f3c3595b
fix comment to reflect reality 2022-10-27 11:03:45 -04:00
Thomas Winget
7ddad87dbf some useful log statements 2022-10-27 11:00:40 -04:00
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.
2022-10-27 10:54:43 -04:00
Thomas Winget
a9a2a115bc
debian missing yacc apparently all of a sudden 2022-10-27 09:32:06 -04:00
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.
2022-10-27 09:32:06 -04:00
majestrate
e8055a05ad
Merge pull request #2039 from jagerman/shorter-gossip-times
Shorten gossip times in systemd status line
2022-10-27 08:44:58 -04:00
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.
2022-10-26 21:20:14 -03:00
majestrate
d91c82c623
Merge pull request #2038 from majestrate/bind-fix-2022-10-26
proper handling of public ips
2022-10-26 17:04:21 -04:00
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).
2022-10-26 17:19:00 -03:00
Jason Rhinelander
9f10e8003e
Remove useless iterator assignments
A back_inserter doesn't change when you insert onto it.
2022-10-26 17:18:47 -03:00
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
2022-10-26 15:24:28 -04:00
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.
2022-10-26 14:58:32 -04:00
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.
2022-10-26 15:27:22 -03:00
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.
2022-10-26 14:17:18 -03:00
Jason Rhinelander
11e052cb39
Add rsvg-convert dep to windows readme 2022-10-26 13:44:53 -03:00
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.
2022-10-26 13:24:34 -03:00
Jason Rhinelander
09c05d8206
Merge pull request #2036 from jagerman/win-x64
Use Windows-y 'x64' instead of '64bit' in static upload
2022-10-26 13:24:24 -03:00
Jason Rhinelander
6be4621aea
Use Windows-y 'x64' instead of '64bit' in static upload 2022-10-26 11:42:56 -03:00
majestrate
4c9d076c10
Merge pull request #2034 from jagerman/fix-router-startup
Fix router startup
2022-10-25 21:01:35 -04:00
majestrate
359ea1a3cd
Merge pull request #2033 from jagerman/fix-conf-backcompat
Fix backwards compatible config option handler
2022-10-25 21:01:20 -04:00
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.
2022-10-25 20:11:23 -03:00
Jason Rhinelander
a828ef3f6d Remove obsolete junk
This stuff is already set earlier, in Configure.
2022-10-25 20:10:56 -03:00
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.
2022-10-25 20:10:01 -03:00
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.
2022-10-25 18:06:25 -03:00
majestrate
e8a27d1db3
Merge pull request #2032 from tewinget/pinned_node_config_cleanup
clarify strict-connect usage and enforce minimum of 2 nodes
2022-10-25 14:07:09 -04:00
majestrate
36dbbd19bf
Merge pull request #2031 from tewinget/get_status_ready_flag
add 'networkReady' to endpoint status
2022-10-25 14:07:00 -04:00
Thomas Winget
3b6953badc clarify strict-connect usage and enforce minimum of 2 nodes 2022-10-24 21:58:50 -04:00
Thomas Winget
1231d4e6c4 add 'networkReady' to endpoint status 2022-10-24 20:46:00 -04:00
majestrate
cc2bbc20ca
Merge pull request #2030 from majestrate/issue-2029-keyfile-errors-2022-10-24
llarp_buffer_t idiocy
2022-10-24 15:04:40 -04:00
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.
2022-10-24 14:10:52 -04:00
majestrate
cd858a00ea
Merge pull request #2027 from jagerman/clang-format-14
Bump clang-format to 14
2022-10-21 12:57:12 -04:00
majestrate
37ddecbd20
Merge pull request #2024 from jagerman/dep-updates
Dep updates
2022-10-21 12:56:31 -04:00
majestrate
bb904294b1
Merge pull request #2023 from jagerman/drone-fixes
Drone fixes
2022-10-21 12:56:14 -04:00
Jason Rhinelander
d011f8fb4a
Bump clang-format to 14 2022-10-20 19:53:52 -03:00
Jason Rhinelander
02108f0504
Merge pull request #2021 from tewinget/route-metric-preference
select gateway with lowest metric
2022-10-20 14:43:45 -03:00
Jason Rhinelander
f01b075d3e
Rename darwin -> macos in uploaded build file 2022-10-20 13:43:00 -03:00
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.
2022-10-20 13:38:36 -03:00