Commit Graph

419 Commits (b81f7025c9a619409bb1c3f39e0c56e2084fd7be)

Author SHA1 Message Date
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 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 b09298e211
Replace llarp/util/endian.hpp with oxenc/endian.h 2 years ago
Jeff 5050cd0299 add hashed password capability to endpoint auth by file 2 years ago
Jeff a082ba4e77 add file auth for tokens 2 years ago
Jeff 9a6bfe6013 static endpoint auth codes 2 years ago
Jeff b4c4c3977a oxenc 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
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
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 687b54f860 Abstract & simplify logic 3 years ago
Jason Rhinelander 711038d150 Remove debug comment 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
Jeff Becker 2ee43c2162
set ipv6 address on apple to hardcoded value 3 years ago
Jeff Becker b52cf97e11
override ShouldHandlePacket on android to bypass non .snode/.loki dns hooking. 3 years ago
Jason Rhinelander 38335f13a2 Remove debugging 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
jeff 7db2459469
macos sort of works now 3 years ago
Jeff Becker a4a9062f12
dont save addrmap on android as it hangs 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 Becker dace0224ec
fix dns on android 3 years ago
Jeff Becker aa48a1de1b
lower log level 3 years ago
Jeff Becker 872a8d8045
use exisitng convotag first instead of trying to send to directly 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 a6fbaa7c7a
add dns hosts file option for user side dns filtering 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 9a51e4d9b5
forgot to pump on wakeup 3 years ago
Jeff Becker 7dc1061461
mark ip active on successful send 3 years ago
Jeff Becker 07e29da5c0
when we map an address forever mark it as outbound 3 years ago
Jeff Becker cce15b13c8
dont establish paths to inbound sessions to try and address state race condition 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 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 97df84994e
make packet sending logic not attempt to align back to inbound sessions. 3 years ago
Jeff Becker 5e761235d6
improve log message clairity by printing the address not hex 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 c5350ab2c4
DefaultPathAlignmentTimeout -> PathAlignmentTimeout 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 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 c6320724d3
parameterize traffic alignement timeout in dns lookups 3 years ago
Jason Rhinelander 1d48cd6d35 format 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
Jeff Becker 714f6b0183
macos variant fixes 3 years ago
Jeff Becker 71391957c5
set up accept any plainquic handlers 3 years ago
Jeff Becker b721b8d65b
finish wiring up config for #1595 3 years ago