Commit Graph

24 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
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 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 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 5909ad0386
add MarkAddressOutbound to plainquic 3 years ago
Jeff Becker cf7603f20e
temp commit, closeReset -> close 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
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 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 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 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 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
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 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
Jeff Becker 59891d5d5f
wire up snode traffic to quic 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
Jeff Becker 4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
3 years ago
Jason Rhinelander 818b4042e9
Migrate plainquic logging to llarp logging 3 years ago
Jason Rhinelander aa0f54fa07
WIP plainquic tunnels 3 years ago