Commit Graph

551 Commits (871c3e3281d15ce876fcd85a02228b4e70453bac)

Author SHA1 Message Date
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 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 4341b8c684 do not clear out entries that are valid from nodedb when we are a service node.
this logic was inverted.
2 years ago
Jason Rhinelander f230a3f695
Add debug logging for RC removal 2 years ago
Jason Rhinelander a190c14889
Fix comment 2 years ago
Jeff 3337125110
re enable rc expiration 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 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 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 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
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 3cd699fa7f
Show router pubkey at startup 2 years ago
Jeff 1eba0f836e
replace LLARP_PROTO_VERSION macro 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
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 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
Audric Ackermann ad6d206aa6
add version and uptime to summary status endpoint 2 years ago
Audric Ackermann d9467f4dee fix numPaths value in Router::ExtractSummaryStatus 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 205584acdf redo systemd status line to include number of paths and endpoint count. optionally warn about low path success. 2 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.
2 years ago
Jason Rhinelander 09c2b31b25 Move paths pumping into PumpLL 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 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 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 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 633431be66 Make outbound message queue PumpLL again if it doesn't send all 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
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
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 Becker 64cd2990bc
remove old routing table maniuplation code 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 5074dd5f2b
re-enable multithreading on clients but not on service nodes 3 years ago