1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
Commit graph

513 commits

Author SHA1 Message Date
Jeff Becker
85cd1b6863
use inbound sessions we don't have paths to in GetBestConvoTagFor just so we can give the caller SOMETHING. 2021-06-08 14:36:31 -04:00
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
2021-06-08 14:36:30 -04:00
Jeff Becker
97df84994e
make packet sending logic not attempt to align back to inbound sessions. 2021-06-08 14:36:29 -04:00
Jeff Becker
4994208fbc
don't cache dns result if we have an address mapped.
we want to use dns to trigger a call to EnsurePathTo
2021-06-08 14:36:29 -04:00
Jeff Becker
5e761235d6
improve log message clairity by printing the address not hex 2021-06-08 14:36:29 -04:00
Jeff Becker
95537804cd
separate white/grey list for active/decommissioned nodes.
allow sessions to decommissioned nodes but not paths.
2021-06-07 10:57:33 -04:00
Jeff Becker
7c6bb9a24c
simplify loop and correct logic, we want to bail out of the loop on first match. 2021-05-15 15:27:28 -04:00
Jeff Becker
ae97b87111
exits don't rewrite ip addresses, fix this and add note 2021-05-15 15:27:28 -04:00
Jeff Becker
c5350ab2c4
DefaultPathAlignmentTimeout -> PathAlignmentTimeout 2021-05-11 05:12:27 -04:00
Jeff Becker
c834414b47
when we have to reestablish an outbound session use a much much higher timeout for restablishment
so it doesn't time out and get into a state that's totally screwed.

add virtual function service::Endpont::DefaultPathAlignmentTimeout() to get the timeout for path alignment
and use it for resetablishing outbound sessions
2021-05-11 05:12:27 -04:00
Jeff Becker
6bb31468d7
don't send nx if we have an address already mapped 2021-05-06 16:34:37 -04:00
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
2021-05-03 09:22:06 -04:00
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.
2021-05-01 16:25:32 -04:00
Jeff Becker
c6320724d3
parameterize traffic alignement timeout in dns lookups 2021-05-01 08:55:54 -04:00
Jason Rhinelander
1d48cd6d35 format 2021-04-28 17:07:44 -03:00
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.
2021-04-28 16:48:10 -03:00
Jeff Becker
714f6b0183
macos variant fixes 2021-04-20 09:44:52 -04:00
Jeff Becker
71391957c5
set up accept any plainquic handlers 2021-04-19 11:20:46 -04:00
Jeff Becker
b721b8d65b
finish wiring up config for #1595 2021-04-19 07:03:56 -04:00
Jeff Becker
fedc56e3f1
initial commit for #1595 2021-04-19 07:02:46 -04:00
Jeff Becker
545021aa3d
temp commit 2021-04-19 07:02:46 -04:00
Jeff Becker
a7a886e670
fix infinite iteration 2021-04-19 07:02:45 -04:00
Jeff Becker
07eaeb681a
try fixing deadlock 2021-04-19 07:02:45 -04:00
Jeff Becker
1ea77e6a68
more client to snode quic fixes 2021-04-19 07:02:44 -04:00
Jeff Becker
e1f90e5e5a
use rx id on snode side of paths
set protocol on reply routing messages
2021-04-19 07:02:44 -04:00
Jeff Becker
2e8f47a7fa
various cleanups 2021-04-19 07:02:44 -04:00
Jeff Becker
b36f87a4d2
stop crashing when we send dns reply for snode on service nodes 2021-04-19 07:02:44 -04:00
Jeff Becker
25e338d621
srv records
* add srv records in RCs if we have any
* add mechanism to add SRV records for plainquic exposed ports
* resign and republish rc or introset on srv record changes
2021-04-19 07:02:43 -04:00
Jeff Becker
94ecf02a62
add option to run lokinet traffic only with no exit and drop all non lokinet traffic
triggered by: exit-node=null
2021-04-19 07:00:27 -04:00
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
2021-04-19 06:59:07 -04:00
Jeff Becker
853cc52efb
wire up liblokinet 2021-04-19 06:59:06 -04:00
Jason Rhinelander
2a809c7a30
Add trace debugging of inbound packet type 2021-04-19 06:59:06 -04:00
Jeff Becker
309a899c9f
mark loopback convotags as forever
make null handler mark discard data as activity for convotag
2021-04-19 06:59:06 -04:00
Jeff Becker
5b05d22bad
refactors
* add path sequence numbers on routing messages
* reduce log level in debug mode
* wire up loopback style sending to ourself
2021-04-19 06:59:06 -04:00
Jeff Becker
f86a2daf83
fixes
* Add service::Endpoint::HasOutboundConvo
* dont mark outbound convos as inbound
* order quic packets
2021-04-19 06:59:06 -04:00
Jeff Becker
73572b317b
stuff 2021-04-19 06:59:04 -04:00
Jeff Becker
708e408c30
various fixups and cleanups
* wire up last of the quic stuff
* clean up udp packet generation code
* pass EndpointBase not quic tunnel for quic stuff
* add {n,h}uint16_t::FromString
* add nuint_t::FromString
* make AlignedBuffer::IsZero non constant time call for speed
2021-04-19 06:58:37 -04:00
Jeff Becker
100a953a23
make the lokinet endpoint code work
still needs the quic sides to work
2021-04-19 06:58:37 -04:00
Jeff Becker
7098f46d60
rpc endpoint for triggering quic tunnel 2021-04-19 06:58:37 -04:00
Jeff Becker
f5700c560e
try inbound paths first 2021-04-19 06:58:37 -04:00
Jeff Becker
59891d5d5f
wire up snode traffic to quic 2021-04-19 06:58:36 -04:00
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
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
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
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
fc9b09bdbc
clean up address/ip management code to use std::variant and std::optional 2021-04-19 06:58:05 -04:00
Jeff
6bd53484da
Merge pull request #1541 from majestrate/lns-consensus-2021-02-19
lns lookup consensus
2021-03-26 19:24:29 -04:00
Jeff
cb2254ba46
Merge pull request #1573 from jagerman/more-code-refactors
More code refactors
2021-03-23 16:22:23 -04:00
Jeff Becker
b7f72601ce
move stuff to var::variant 2021-03-20 14:30:18 -04:00
Jeff Becker
ba9dca6c5d
use var::variant and var::visit shims because apple is sux 2021-03-20 11:47:36 -04:00