Commit Graph

338 Commits (dev)

Author SHA1 Message Date
Jeff Becker 4508c59cd3
redo includes to be consistent 1 year 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
Jason Rhinelander d011f8fb4a
Bump clang-format to 14 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
Jason Rhinelander eec8244a6c
Remote util::Printer and related cruft 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
Jeff 1eba0f836e
replace LLARP_PROTO_VERSION macro 2 years ago
Jason Rhinelander b09298e211
Replace llarp/util/endian.hpp with oxenc/endian.h 2 years ago
Jeff ffadcb2e93 clean up paths that are ignored and inactive 2 years ago
Jeff 38a157808e Cache best paths determined by GetPathByRouter to reduce cpu usage 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
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 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 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 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
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
Jeff Becker 5cdb1afa0d
increase timer timeout interval because 1 seconds RTT can happen but 2 seconds is pretty bad 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 Becker 719dd38cf5
more shit 3 years ago
Jeff Becker 046e02ebe7
fixes for loopback testnet 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 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 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 a86152e03c
decay path build limiter per path builder every tick 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 b1d30f9803
updates to lokinetmon
* add introset inspector mode
* add required parts for introset insecptor mode to rpc introspection
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 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 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 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 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 6b115913bc
lokinetmon updates
* add country flags to lokinetmon
* expose hop ip addresses via rpc introspection for geoip in lokinetmon
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 Becker 545021aa3d
temp commit 3 years ago
Jeff Becker bb7b46c43d
fixes for testnet 3 years ago
Jeff Becker 07eaeb681a
try fixing deadlock 3 years ago
Jeff Becker 8b2ede5fc5
use rxid 3 years ago
Jeff Becker 1677ed40f6
dont persist sessions if we failed to build 3 years ago
Jeff Becker 2e8f47a7fa
various cleanups 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