Commit Graph

6778 Commits

Author SHA1 Message Date
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.
2021-04-19 06:58:36 -04:00
Jason Rhinelander
158ea4a951
Add isIPv4/isIPv6 to SockAddr 2021-04-19 06:58:36 -04:00
Jason Rhinelander
2ca7ef7f5f
Rename isRouter -> isSNode
The isRouter wording was quite confusing, especially in a call such as:

    router->Configure(config, opts.isRouter, nodedb)
2021-04-19 06:58:36 -04:00
Jason Rhinelander
1d6ad7284c
Fix cursed formatting 2021-04-19 06:58:36 -04:00
Jason Rhinelander
d588f777c7
Fix logging of std::byte values
They were failing to compile if output because implicit integer
promotion doesn't work for std::byte's (but rather needs an explicit
std::to_integer call).
2021-04-19 06:58:36 -04:00
Jason Rhinelander
e27fdf4c9a
Simplify/unify SendTo* methods
Overload them to the same name to make it easier to call and/or visit
them with either a RouterID, Address, Variant, or ConvoTag.
2021-04-19 06:58:36 -04:00
Jason Rhinelander
104f63543f
Change MaybeGetLoop to a virtual member func
Minor simplification.
2021-04-19 06:58:36 -04:00
Jeff Becker
a1a1b2e2bc
remove superflous include 2021-04-19 06:58:36 -04:00
Jeff Becker
a61f846d33
* add convotags to ensure path to snode
* add service::Endpoint::EnsurePathTo which gives you a std::optional<Convotag>
2021-04-19 06:58:35 -04:00
Jeff Becker
fe32475cad
use more variants 2021-04-19 06:58:35 -04:00
Jeff Becker
9d483a12db
* add protocol type to snode traffic
* make path::PathSet::SendPacketToRemote know about protocol type
2021-04-19 06:58:35 -04:00
Jeff Becker
e4ca7ce4de
get rid of uneeded type 2021-04-19 06:58:35 -04:00
Jeff Becker
618881e65c
update ngtcp2 address/path structs 2021-04-19 06:58:35 -04:00
Jeff Becker
eb965c8323
fix link error in ngtcp2 2021-04-19 06:58:35 -04:00
Jeff Becker
fc9b09bdbc
clean up address/ip management code to use std::variant and std::optional 2021-04-19 06:58:05 -04:00
Jeff Becker
1885b1cae9
more 2021-04-19 06:58:05 -04:00
Jeff Becker
4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
2021-04-19 06:57:46 -04:00
Jason Rhinelander
39d31df059
no-op LogTrace(); print chars as ints
- LogTrace() (and LogTraceTag, etc.) are now no-ops for release builds.
(hoping there are no side effects in trace logging!)
- renamed llarp::_Log to llarp::_log because _Log is a reserved keyword
- change logging code to implicitly convert 1-byte types (char, unsigned
char, uint8_t) to ints so that we print them as numeric values rather
than raw chars because, more often than not, printing a single char is
trying to log an 8-bit value.
2021-04-19 06:57:46 -04:00
Jason Rhinelander
b61bd82b4b
Add llarp::buffer_printer for pretty buffer logs 2021-04-19 06:57:46 -04:00
Jason Rhinelander
818b4042e9
Migrate plainquic logging to llarp logging 2021-04-19 06:57:46 -04:00
Jason Rhinelander
5d897781ef
Replace custom random with llarp/sodium random 2021-04-19 06:57:45 -04:00
Jason Rhinelander
aa0f54fa07
WIP plainquic tunnels 2021-04-19 06:57:45 -04:00
Jason Rhinelander
46c619c49f
Move external/ cmake bits into external/CMakeLists.txt
- Move uvw target to external instead of llarp/CMakeLists.txt

- Add sqlite_orm headers via interface library rather than shoving it
  into the global include search path.

- Find sqlite3 as part of the sqlite_orm target deps rather than linking
  it separately.  (Also don't link it into lokinet-util, which doesn't
  appear to actually need it).
2021-04-19 06:57:45 -04:00
Jason Rhinelander
442fa951fc
Add ngtcp2 submodule 2021-04-19 06:56:26 -04:00
Jason Rhinelander
9df6cd74c7
Add draft liblokinet TCP-over-QUIC design doc 2021-04-19 06:55:36 -04:00
Jeff Becker
8ee80bc13d
don't build liblokinet in android we have liblokinet-android for that 2021-04-19 06:55:36 -04:00
Jeff Becker
079604c6cf
get rid of deprecated vpnio code in android 2021-04-19 06:52:24 -04:00
Jeff Becker
b45a268dbc
fix windows dll link-ism 2021-04-19 06:52:24 -04:00
Jeff Becker
2fa7a54e86
fix pybind layer compile errors from missing llarp.h header 2021-04-19 06:52:24 -04:00
Jeff Becker
e4841917ba
redo cmake parts
* add liblokinet.so target
* make every library we build except liblokinet.so static
* wire up parts of liblokinet
2021-04-19 06:52:24 -04:00
Jeff Becker
affd2e23f7
flesh out lokinet.h more 2021-04-19 06:52:24 -04:00
Jeff Becker
414c2d42e6
add lokinet.h header for liblokinet api 2021-04-19 06:52:24 -04:00
Jeff Becker
e11249d158
remove llarp.h header references 2021-04-19 06:52:24 -04:00
Jeff Becker
9e2cfd90cb
remove unneeded header 2021-04-19 06:52:23 -04:00
Jeff Becker
a6715a1f75
remove old vpnio bits 2021-04-19 06:52:23 -04:00
Jeff Becker
c92894804c
Merge remote-tracking branch 'origin/stable' into dev 2021-04-17 09:18:37 -04:00
Jeff Becker
68826f10bb use binary mode for writing files 2021-04-16 18:52:18 -03:00
Jeff
9f2f9e0f05
Merge pull request #1598 from majestrate/cherry-pick-for-stable-2021-04-15
new logos and new lokinet-bootstrap backport for stable
2021-04-16 15:10:35 -04:00
Jeff Becker
4daebc0141
catch exception and print out error 2021-04-16 15:01:00 -04:00
Jeff Becker
a0d3ab125a
throw on failed writing and port fs namespace changes from oxen-core 2021-04-16 14:47:17 -04:00
Jeff Becker
6cde9062b5
build lokinet-android target only on android 2021-04-16 14:17:39 -04:00
Jeff Becker
a80d8b95b3
update lokinet-bootstrap
* compat with old shell script curl wrapper's arguments
* do lazy validation of fetched data
2021-04-16 14:16:16 -04:00
Jeff Becker
77de60af91
require openssl explicitly for lokinet-bootstrap 2021-04-16 09:40:36 -04:00
Jeff Becker
27c80a2638
add include directory for daemon directory so llarp/* includes work 2021-04-16 05:51:34 -04:00
Jeff Becker
e8178a032e
lokinet-bootstrap native binary 2021-04-15 20:06:15 -04:00
Jeff Becker
3af465bb5f
rebrand and bump version 2021-04-15 20:06:07 -04:00
Jeff
6e05f7ad13
Merge pull request #1597 from majestrate/lokinet-bootstrap-native-2021-04-15
Lokinet bootstrap native binary
2021-04-15 19:52:16 -04:00
Jeff Becker
0c37cc7f60
lokinet-bootstrap native binary 2021-04-15 13:39:45 -04:00
Jeff
ac7cf68dbe
Merge pull request #1596 from majestrate/rebrand-2021-04-14
rebranding assets
2021-04-15 07:43:41 -04:00
Jeff
189a746dfa
Merge pull request #1594 from majestrate/plug-leak-2021-04-12
call delivery status hook on overload
2021-04-14 13:24:41 -04:00