Commit Graph

53 Commits

Author SHA1 Message Date
Jeff Becker
59c9e997f2
build paths faster and limit path builds at edge router instead of via a time counter for all edges 2021-04-19 06:59:05 -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
Jason Rhinelander
181953b4a6 Replace ::Hash nested structs with std::hash specializations 2021-03-10 11:19:52 -04:00
Thomas Winget
7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
2021-03-09 19:01:41 -05:00
Jason Rhinelander
89b582bf60 Modernize [[maybe_unused]] attribute 2021-03-04 16:51:18 -04:00
Jeff Becker
df4ea34a56
nodedb refactor
* bump zmq static dep
* lokimq -> oxenmq
* llarp_nodedb -> llarp::NodeDB
* remove all crufty api parts of NodeDB
* make NodeDB rc selection api not suck
* make path builder api not suck
* propagate all above changes so that unit tests work and it all compiles
2021-02-02 09:35:40 -05:00
Jeff
5f0f4e0c70
prevent crash by removing duplicate logic (#1515)
when a path expires or fails or something causes its lifecycle to end we have cleanup
logic that handles clean up for it. this removes a code path that was crashing that
is duplicated elsewhere and is thus probably safe to bin. yolo.
2021-01-19 07:39:22 -05:00
Jeff
e66522b9dd
fix path reference leak (#1451) 2020-11-04 11:08:29 -05:00
Jeff
4c7d52ac20
more aggressive path building. (#1423)
* more aggressive path building.

* do more than one in parallel path builds at a time

* correct last commit's logic

* rename numPaths -> numDesiredPaths to clarify intent

* revert string change as it will break a lot

* don't prematurly short circuit on snode builds

Co-authored-by: Thomas Winget <tewinget@gmail.com>
2020-10-27 16:27:14 -04:00
Jeff
21930cf667
LNS (#1342)
* initial relay side lns

* fix typo

* add reserved names and refactor test for dns

* lns name decryption

* all wired up (allegedly)

* refact to use service::EncryptedName for LNS responses to include nonce with ciphertext

* fully rwemove tag_lookup_job

* replace lns cache with DecayingHashTable

* check for lns name validity against the following rules:

* not localhost.loki, loki.loki, or snode.loki

* if it contains no dash then max 32 characters long, not including the .loki tld (and also assuming a leading subdomain has been stripped)

* These are from general DNS requirements, and also enforced in
registrations:

* Must be all [A-Za-z0-9-]. (A-Z will be lower-cased by the RPC call).

* cannot start or end with a -

* max 63 characters long if it does contain a dash

* cannot contain -- in the third and fourth characters unless it starts with xn--

* handle timeout in name lookup job by calling the right handler with std::nullopt
2020-09-17 15:18:08 -04:00
Jeff Becker
a45f92dca7
use random good path for outbound traffic so that it uses an even spread accross
all paths
2020-05-23 16:07:20 -04:00
Jeff Becker
6af498092b
exit traffic via loki addresses 2020-05-23 16:07:19 -04:00
Stephen Shelton
273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
2020-04-07 12:38:56 -06:00
Jason Rhinelander
f1aa27e616 fix speeling mistack 2020-02-25 22:27:34 -04:00
Jason Rhinelander
b4440094b0 De-abseil, part 2: mutex, locks, (most) time
- util::Mutex is now a std::shared_timed_mutex, which is capable of
  exclusive and shared locks.

- util::Lock is still present as a std::lock_guard<util::Mutex>.

- the locking annotations are preserved, but updated to the latest
  supported by clang rather than using abseil's older/deprecated ones.

- ACQUIRE_LOCK macro is gone since we don't pass mutexes by pointer into
  locks anymore (WTF abseil).

- ReleasableLock is gone.  Instead there are now some llarp::util helper
  methods to obtain unique and/or shared locks:
    - `auto lock = util::unique_lock(mutex);` gets an RAII-but-also
      unlockable object (std::unique_lock<T>, with T inferred from
      `mutex`).
    - `auto lock = util::shared_lock(mutex);` gets an RAII shared (i.e.
      "reader") lock of the mutex.
    - `auto lock = util::unique_locks(mutex1, mutex2, mutex3);` can be
      used to atomically lock multiple mutexes at once (returning a
      tuple of the locks).
  This are templated on the mutex which makes them a bit more flexible
  than using a concrete type: they can be used for any type of lockable
  mutex, not only util::Mutex.  (Some of the code here uses them for
  getting locks around a std::mutex).  Until C++17, using the RAII types
  is painfully verbose:

  ```C++
  // pre-C++17 - needing to figure out the mutex type here is annoying:
  std::unique_lock<util::Mutex> lock(mutex);
  // pre-C++17 and even more verbose (but at least the type isn't needed):
  std::unique_lock<decltype(mutex)> lock(mutex);
  // our compromise:
  auto lock = util::unique_lock(mutex);
  // C++17:
  std::unique_lock lock(mutex);
  ```

  All of these functions will also warn (under gcc or clang) if you
  discard the return value.  You can also do fancy things like
  `auto l = util::unique_lock(mutex, std::adopt_lock)` (which lets a
  lock take over an already-locked mutex).

- metrics code is gone, which also removes a big pile of code that was
  only used by metrics:
  - llarp::util::Scheduler
  - llarp:🧵:TimerQueue
  - llarp::util::Stopwatch
2020-02-21 23:22:47 -04:00
Jeff Becker
99eb7726ff
initial dht key blinding 2020-01-27 16:30:41 -05:00
Jeff Becker
8b8d636ded
make format 2019-12-22 09:16:28 -05:00
Thomas Winget
71bb0dd520 implement timers using libuv
So far only a bit of the code using timers has been modified to use
the new libuv-based timers.  Also only the non-Windows case has been
implemented.  Seems to be working though, so it's a good time to commit.
2019-12-18 13:11:13 -05:00
Jeff Becker
1a864832c8
make format 2019-11-14 10:07:40 -05:00
Thomas Winget
23a9773e1e
remove our paths from outbound queues 2019-11-07 13:23:14 -05:00
Thomas Winget
ef1a5652ef
remove our paths from outbound queues 2019-11-07 13:23:06 -05:00
Jeff Becker
7ee026fa50
make path builds work again 2019-11-05 11:58:53 -05:00
Jeff Becker
327c545530
finish multithread cryptography first pass 2019-09-16 12:12:05 -04:00
jeff
14c9ef15ed try calling stuff in logic thread from event loop 2019-09-16 06:21:12 -04:00
Jeff Becker
4bf6882c8a
more async cryptography 2019-09-05 13:39:09 -04:00
Michael
edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Jeff Becker
aa0a795689
call path build fail stuff in logic thread 2019-07-31 08:51:24 -04:00
Thomas Winget
38fd0552d3 Adds Link-Relay Status Messages
Success case:
  - the path endpoint creates and sends a LR_StatusMessage upon
    successful path creation

Failure case:
  - an intermediate hop creates and sends a LR_StatusMessage upon
    failure to forward the path to the next hop for any reason

Both cases:
  - transit hops receive LR_StatusMessages and add a frame
    to them reflecting their "status" with respect to that path
  - the path creator receives LR_StatusMessages and decrypts/parses
    the LR_StatusRecord frames from the path hops.  If all is good,
    the Path does as it would when receiving a PathConfirmMessage.
    If not, the Path marks the new path as failed.

LR_StatusMessage is now used/sent in place of PathConfirmMessage
2019-07-25 17:46:56 -04:00
Jeff Becker
7a3c8e5ca0
set limits correctly 2019-07-18 12:32:26 -04:00
Jeff Becker
f48754c45d
make hop count and length configurable 2019-07-18 12:28:17 -04:00
Jeff Becker
64e9622270
start seperating tun and endpoint 2019-07-01 09:44:25 -04:00
Michael
b6b400baef
Tidy up pathbuilder code 2019-06-20 17:35:40 +01:00
Jeff Becker
9ea13a9ee3
ingore paths that drop exit traffic 2019-05-31 06:57:41 -04:00
Jeff Becker
df322e1149
don't include duplicate hops in paths 2019-05-08 10:01:31 -04:00
Jeff Becker
a53da68700
start work on sighup 2019-05-07 13:46:38 -04:00
Jeff Becker
34533db620
add urgent build that builds over an existing path for an endpoint 2019-05-07 08:31:34 -04:00
Jeff Becker
5fa85acaf7
rebuild exit paths if they die 2019-05-06 10:54:05 -04:00
Jeff Becker
d423ee02d2
use shared_ptr 2019-05-03 09:15:03 -04:00
Jeff Becker
6711296b26
finish converting to shared_ptr 2019-04-23 12:13:22 -04:00
Jeff Becker
99c29cf05a
prepare for ios/android jazz
move to use std::shared_ptr instead of bare pointers so we can
multithread everything.
2019-04-23 10:28:59 -04:00
Michael
98e691f315
Tidy up more parts of the service/ directory 2019-04-22 22:28:10 +01:00
Jeff Becker
b849ff9a94
handle path death better 2019-03-30 09:02:10 -04:00
Jeff Becker
ce126166af
more logging info 2019-03-22 10:10:30 -04:00
Jeff Becker
6489ea2152
make it work 2019-03-08 12:26:29 -05:00
Michael
61f3273dc4
Add threading annotations and fix potential deadlocks 2019-03-04 00:03:52 +00:00
Michael
c5a129ddff
Convert to use abseil synchronisation primitives 2019-03-03 21:20:38 +00:00
Michael
887fb4ac62
Replace insert(make_pair()) with emplace() 2019-02-18 10:35:23 +00:00
Michael
048fa83c39
Finish replacement of Router with AbstractRouter 2019-02-14 22:31:31 +00:00
Jeff Becker
66753430ad
fix it 2019-02-08 16:29:56 -05:00
Jeff Becker
e1522faeaa
add introspection rpc endpoint 2019-02-08 14:43:25 -05:00