Commit Graph

611 Commits

Author SHA1 Message Date
Stephen Shelton
aeb0c2be3a
Remove ability to stop routers from gossiping for now 2020-07-02 10:22:03 -06:00
Stephen Shelton
bdac43e19f
Peer stats test which artificially stops a router from gossiping its RC 2020-07-02 10:22:03 -06:00
Stephen Shelton
d1b629f494
RouterHive ConnectionAttemptEvent 2020-07-02 10:22:02 -06:00
Stephen Shelton
b2a72dd46a
Initial test_peer_stats hive test 2020-07-02 10:16:19 -06:00
Stephen Shelton
2453fff10b
Piggyback on link callbacks to add peer stats 2020-07-02 10:13:26 -06:00
Stephen Shelton
023e061146
Make [router]:enable-peer-stats only valid for client 2020-07-02 10:13:25 -06:00
Stephen Shelton
d897099e1d
Track traffic peerstats 2020-07-02 10:13:24 -06:00
Stephen Shelton
5e05defc76
Add API query for peer stats, other related fixes 2020-07-02 10:13:22 -06:00
Stephen Shelton
595288e046
Add PeerDb::handleGossipedRC 2020-07-02 10:13:22 -06:00
Stephen Shelton
2a30e7dac2
Add PeerDb to Router 2020-07-02 10:13:21 -06:00
Jeff Becker
d7ff6c579c
address feedback from jason
* split up ipv6 netmask
* revert iwp ack interval change
* c++17-isms in ip range map
* lambda-ize nodedb
* mutable lambdas in transit hops
* perfect forwarding of args in abstract router
* mutable lambdas in lokid rpc client
* notes in readme about nproc
2020-07-02 11:13:32 -04:00
Jeff Becker
a9109aa91b
* deprecate old unused lokid rpc options
* use lokimq::address in config and in lokid rpc
* bump lokimq submodule
2020-07-02 11:13:31 -04:00
Jeff Becker
80919a3b76
address feedback.
* use exceptions when fetching identity key instead of std::optional, will throw on fail
* fix up config options for endpoint auth and add better docs
* add llarp::serive::AuthType enum for controlling what kind of endpoint auth to use
2020-07-02 11:13:31 -04:00
Jason Rhinelander
a7c42ab2bd
Use lokimq's hex/base32z encoding/decoding 2020-07-02 11:13:31 -04:00
Jeff Becker
e13e886df9
fix up event loop crap so that unit tests pass 2020-07-02 11:10:06 -04:00
Jeff Becker
1779f33506
fix makefile fromat target
use lokimq::address instead of std::string or std::string_view
2020-07-02 11:07:34 -04:00
Jeff Becker
397d558af8
wtf 2020-07-02 11:07:34 -04:00
Jeff Becker
59eb1b0842
make format 2020-07-02 11:07:34 -04:00
Jeff Becker
f1e7fc2cba
make format and update submodule 2020-07-02 11:07:34 -04:00
Jeff Becker
f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 2020-07-02 11:07:34 -04:00
Jeff Becker
be01808a6b
more 2020-07-02 11:07:33 -04:00
Jeff Becker
c5dbb670ca
set sane defaults for config, implement lmq rpc server, update lokinetmon 2020-07-02 11:07:33 -04:00
Jeff Becker
6bbf7beaf5
add stubs for lmq rpc server 2020-07-02 11:07:33 -04:00
Jeff Becker
1175a583d2
initial working code 2020-07-02 11:07:32 -04:00
Jeff Becker
9bfff61d08
initial wack at lokimq 2020-07-02 11:07:32 -04:00
Stephen Shelton
fd4b03f896
WIP: LokidRpcClient 2020-07-02 11:07:32 -04:00
Stephen Shelton
17026a0b21
Remove libabyss and rpc::Caller/rpc::Server 2020-07-02 11:07:32 -04:00
Jeff Becker
d5b4dbe052
more 2020-07-02 11:07:32 -04:00
Jeff Becker
b1259e25c5
set sane defaults for config, implement lmq rpc server, update lokinetmon 2020-07-02 11:07:31 -04:00
Jeff Becker
fb8b8e2e56
add stubs for lmq rpc server 2020-07-02 11:07:31 -04:00
Jeff Becker
ad882d0d70
initial working code 2020-07-02 11:07:31 -04:00
Jeff Becker
0006751d80
initial wack at lokimq 2020-07-02 11:07:31 -04:00
Stephen Shelton
91725a8530
WIP: LokidRpcClient 2020-07-02 11:07:31 -04:00
Stephen Shelton
11951510bf
Remove libabyss and rpc::Caller/rpc::Server 2020-07-02 11:07:30 -04:00
Jeff Becker
800668348a
add regression test for key backup bug 2020-06-08 08:42:10 -04:00
Jeff Becker
019168fef0
remove unused local variable 2020-06-05 11:40:19 -04:00
Jeff Becker
1899debfb5
unfug transit hops 2020-06-05 11:40:18 -04:00
Stephen Shelton
193060d602
Undo client-related changes to RC creation
This partially reverts changes from
1497b829bd and intsead only prevents
clients from saving their RC to disk.
2020-06-04 15:02:05 -06:00
Stephen Shelton
980853804d
Remove log statement 2020-06-04 13:34:15 -06:00
Stephen Shelton
cecafb3215
Undo unintentional revert? 2020-06-04 13:32:38 -06:00
Stephen Shelton
d8b12ce764
Let KeyManager assemble key filenames 2020-06-04 12:38:35 -06:00
Stephen Shelton
1497b829bd
Ignore our self.signed file if we're a client 2020-06-04 11:05:23 -06:00
Jeff
45cda241f0
Merge pull request #1272 from majestrate/exit-nodes-2020-05-16
exit traffic via snapps
2020-06-01 14:42:43 -04:00
Jeff Becker
acecb23eb3
make libuv event loop logic queue size configurable.
remove logic constructor that is no-op.
add constant for default logic queue size
add constant for transit hop queue size
2020-06-01 09:17:44 -04:00
Rick V
1340cd0dce remove some string conversions entirely 2020-05-26 23:09:16 -05:00
Rick V
f62214cf8c
first pass fix wstring path conversions 2020-05-26 20:48:07 -05:00
Jeff Becker
39f8f17b53
dont set callback if non provided 2020-05-23 16:07:21 -04:00
Jeff Becker
c826d0a0b1
increase transit hop limits 2020-05-23 16:07:20 -04:00
Jason Rhinelander
3bb24580a4 make format 2020-05-20 19:48:13 -03:00
Jason Rhinelander
ebd2142114 Don't use std::optional::value() because f u macos
This replaces all use of std::optional's `opt.value()` with `*opt`
because macOS is great and the ghost of Steve Jobs says that actually
supporting std::optional's value() method is not for chumps before macOS
10.14.  So don't use it because Apple is great.

Pretty much all of our use of it actually is done better with operator*
anyway (since operator* doesn't do a check that the optional has a
value).

Also replaced *most* of the `has_value()` calls with direct bool
context, except for one in the config section which looked really
confusing at a glance without a has_value().
2020-05-20 19:18:28 -03:00
Jeff Becker
1780e86faa
fix up unit tests, make them all pass 2020-05-15 08:38:04 -04:00
Jason Rhinelander
dccc663f31 Miss Match demands her name be removed from the code
(i.e. fix speeling mistack: missmatch -> mismatch)
2020-05-13 22:35:15 -03:00
Jeff
e6a85d7176
Merge pull request #1263 from jagerman/c++17-niceties
C++17 niceties
2020-05-12 16:07:27 -04:00
Jason Rhinelander
e470a6d73e C++17 niceties
- class template argument deduction lets us write `std::unique_lock
  foo{mutex}` instead of `std::unique_lock<mutex_type> foo{mutex}` which
  makes the `unique_lock` and `shared_lock` functions unnecessary.

- Replace GNU-specific warn_unused_result attribute with C++17-standard
  [[nodiscard]]

- Remove pre-C++17 workaround code for fold expressions, void_t
2020-05-12 16:42:35 -03:00
Jeff
a5b09c47e1
Merge pull request #1262 from notlesh/bandaids-for-sockaddr-refactor-2020-05-11
Bandaids for sockaddr refactor 2020 05 11
2020-05-12 12:04:59 -04:00
Stephen Shelton
aee96e53a3
Refactor Addr -> IpAddress/SockAddr 2020-05-06 14:38:44 -06:00
Jeff Becker
01cc2c86bf
format 2020-05-06 11:37:15 -04:00
Jeff Becker
f1edca9fa1
additional cleanup of cruft 2020-05-04 14:39:14 -04:00
Jeff Becker
1cbf50296c
only add endpoint for hidden service if not service node 2020-05-04 12:58:46 -04:00
Jeff Becker
6aa79b7ca9
set network section 2020-05-04 12:36:29 -04:00
Jason Rhinelander
cd7fd1b6ad FIXME fix the FIXME 2020-05-04 13:27:14 -03:00
Stephen Shelton
960dc37c1f
Refactor TunEndpoint::Configure() (partially) 2020-05-04 11:07:21 -04:00
Stephen Shelton
f2a26adcaa
Move all [endpoint] options to [network] 2020-05-04 11:07:21 -04:00
Stephen Shelton
dd9ab0f1d5
Remove ability to have multiple endpoints/snodes from config 2020-05-04 11:07:21 -04:00
Stephen Shelton
2bc908cd40
Remove [dns]:local-dns in favor of [dns]:bind 2020-05-04 11:05:52 -04:00
Stephen Shelton
779658edd0
Refactor ExitEndpoint's config, mv dns ops from [network] to [dns] 2020-05-04 11:05:51 -04:00
Stephen Shelton
21ad442b55
Remove NetConfig_t 2020-05-04 11:05:51 -04:00
Stephen Shelton
df01770466
Rename SnappConfig -> EndpointConfig 2020-05-04 11:05:51 -04:00
Stephen Shelton
93b35c92a7
Eradicate service::Config 2020-05-04 11:05:51 -04:00
Jason Rhinelander
1697bf90fe C++17
Compiles with C++17, replaces ghc::filesystem with std::filesystem,
nonstd::optional with std::optional, and llarp::string_view with
std::string_view.
2020-05-01 17:43:27 -03:00
Stephen Shelton
f8439dab61
Misc aesthetic tweaks 2020-04-29 14:19:48 -06:00
Stephen Shelton
526b1320b7
Some maybe-fixes for RouterHive post config cleanup 2020-04-24 11:18:25 -06:00
Jeff
54a7843bc5
Merge pull request #1186 from notlesh/config-cleanup-2020-03-13
Config cleanup
2020-04-24 12:49:08 -04:00
Jason Rhinelander
3c6aa002b8 Fix errors and warnings compiling on mac 2020-04-10 14:26:50 -03:00
Stephen Shelton
ca24f25665
Make fewer assumptions about config state
This handles values missing when config is created through RouterHive.
2020-04-07 17:52:14 -06:00
Stephen Shelton
de8e44ba21
Re-apply clang-format rules after rebasing 2020-04-07 14:41:11 -06:00
Stephen Shelton
be014175e9
Consolidate logging initialization logic 2020-04-07 14:27:31 -06:00
Stephen Shelton
6909e20588
Fix logging initialization and flush at program exit 2020-04-07 14:27:30 -06:00
Stephen Shelton
d3bcc05aa6
Organize some constants and default values 2020-04-07 14:26:32 -06:00
Stephen Shelton
91206725cb
Inject a default bootstrap file if none in conf 2020-04-07 14:26:31 -06:00
Stephen Shelton
7ea8d62640
Use fs::path over std::string for files 2020-04-07 14:26:30 -06:00
Stephen Shelton
4f77080f75
Remove optional<> from block-bogons 2020-04-07 14:23:53 -06:00
Stephen Shelton
adfcbd1d0b
Slight cleanup of k:v option maps 2020-04-07 14:23:11 -06:00
Stephen Shelton
6fd270ba09
Rip out link type spec and factory
We only support IWP now, so this is all effectively dead code.
2020-04-07 14:22:53 -06:00
Stephen Shelton
733efbab40
Reflect removal of accessors on config structs 2020-04-07 14:20:31 -06:00
Stephen Shelton
5b520a4dff
Simplify connection limit constants 2020-04-07 14:13:27 -06:00
Stephen Shelton
ffc58fcedb
Remove dead code (serverOptions) 2020-04-07 14:09:13 -06:00
Stephen Shelton
2e47262350
Demystify LinksConfig 2020-04-07 14:08:45 -06:00
Stephen Shelton
cd1e7713de
Clean up / consolidate config logging logic 2020-04-07 14:07:40 -06: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
Jeff
d3091cf9fc
Merge pull request #1167 from tewinget/tooling
RouterHive initial PR
2020-04-07 13:13:02 -04:00
Stephen Shelton
ea835405c5
Refactor NotifyRouterEvent() to forward args, event code cleanup
This template-ifies Router::NotifyRouterEvent() up so that it accepts
the arguments to instantiate the specified event type, forwarding them
to std::make_unique. This would allow (in the future) the function to
no-op the call and avoid memory allocation. It also slightly reduces
the amount of code required to fire an event.

This commit also simplifies some of the RouterEvent code to reduce
redundancy.
2020-03-12 11:50:46 -06:00
Jeff Becker
5191af1525
typo fix 2020-03-09 17:06:25 -04:00
Jeff Becker
5d86587aab
typo fix 2020-03-09 17:06:25 -04:00
Jeff Becker
bce5cd7b0f
add additional case check and documentation comments for pruning logic 2020-03-09 17:06:24 -04:00
Jeff Becker
b3f2c71617
add comment 2020-03-09 17:06:24 -04:00
Jeff Becker
d8da3f0a83
simplify logic 2020-03-09 17:06:24 -04:00
Jeff Becker
327ab6f178
prune nodedb as client and service node with no whitelist 2020-03-09 17:06:24 -04:00
Thomas Winget
84a1d7dbcc clang format....... 2020-03-06 20:20:11 -05:00
Rick V
b449e03f43
So as of GCC 9.2, std::random_device on Windows is RtlGenRandom()
....which is precisely the thing i patch out in libsodium to use CryptoAPI
documented interfaces instead (which fall through to RtlGenRandom() on
such devices _anyway_)
we can just use libsodium directly, i happened to patch it out in libstdc++
as a side effect (since my local toolchain can target any version of windows)
2020-03-05 12:47:49 -06:00
Thomas Winget
6d472d2423 rc gossip delay adjustment for hive
allows enough time for every relay (at least in a hive of 50) to connect
to the bootstrap node so all will get all gossips, but not too long so
tests can run relatively quickly.
2020-03-04 00:54:30 -05:00
Jeff Becker
08de84d40b
remove non public routers from nodedb 2020-03-03 20:01:24 -05:00
Thomas Winget
6fc05ca1ff RCGossipSentEvent 2020-03-03 19:57:09 -05:00
Thomas Winget
a58a8c9a61 hive.py now defaults to 1000 relays because f your box.
also check for error on uv_async_init...

may want to `ulimit -Sn $(ulimit -Hn)`...
2020-03-03 19:57:09 -05:00
Thomas Winget
c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 2020-03-03 19:57:09 -05:00
Jeff Becker
877443d95c more introspection code 2020-03-03 19:57:09 -05:00
Thomas Winget
931ff521d1 working toward full testnet of routers (not clients yet) in hive/pybind setup
Not working yet -- some sort of RC issue.  Checkout the commit prior to this if you want something that 'works' that you can play with.
2020-03-03 19:57:09 -05:00
Thomas Winget
0f34a950a9 pybind config object, working 2020-03-03 19:57:09 -05:00
Thomas Winget
f712acc486 huzzah it builds, time to test soon! 2020-03-03 19:57:09 -05:00
Jeff Becker
da79b14703 make it compile 2020-03-03 19:57:09 -05:00
Thomas Winget
8dc5dabe49 working toward compilation, still has include issue 2020-03-03 19:57:09 -05:00
Thomas Winget
8d03e6dd3c more router hive stuff, read below the fold
Router now has a hive pointer if LOKINET_HIVE is set.
llarp::Context has a method InjectHive to give Router the pointer.
Router has a method NotifyRouterEvent which does:
  - when LOKINET_HIVE is set, passes the event to RouterHive
  - else when LOKINET_DEBUG is set, prints the event at a low log level
  - else NOP
2020-03-03 19:57:09 -05:00
Jeff Becker
61ffbc0643
std::vector reserve does not resize 2020-03-03 15:25:18 -05:00
jeff
49e69d7087 remove uneeded code 2020-02-29 15:48:51 -05:00
Jason Rhinelander
df7a173649 Shorten version and prefix with v
So we get `v0.7.0` instead of `lokinet-0.7.0-abcdef12`; the latter is
useful for devs, but not so much for random operators (and you can
always go get the full version from the binary).
2020-02-26 16:16:57 -04:00
Jason Rhinelander
d5eed90a3c Fix systemd compilation & enable systemd on travis 2020-02-25 22:35:06 -04:00
Jeff Becker
66181d8a8f
systemd status 2020-02-25 17:32:57 -05:00
Jeff Becker
bf0416cab8
remove Time_t, add operator overload for printing llarp_time_t and add to_json function for serializing llarp_time_t to json 2020-02-25 12:05:13 -05:00
Jeff Becker
d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
Jeff Becker
f4520ac920
make decaying hashset use llarp::Time_t and move unit tests to use catch2 2020-02-24 15:22:49 -05:00
Jason Rhinelander
089056ca5b Remove all ABSL_ATTRIBUTE_UNUSED uses 2020-02-24 14:27:44 -04:00
Jason Rhinelander
5c95971335 Make C++ literals available everywhere in llarp 2020-02-24 14:27:44 -04:00
Jason Rhinelander
f84ce61d66 Removed empty cpp files
These aren't needed: CMake already knows how to follow #includes and
rebuild when headers change as long as the headers are included
*somewhere*.  The extra .cpp files here just require building a bunch of
.cpp files with just header content that we just end up throw away
during linking (since the same things will also be compiled in whatever
other compilation units include the same headers).
2020-02-21 23:39:11 -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
Thomas Winget
74d421ac2d PathBuildNumber -> NextPathBuildNumber because increment side-effect 2020-02-20 16:57:48 -05:00
Thomas Winget
fc56a018e5 path builder prints hops, rest print short name 2020-02-20 16:37:39 -05:00
Jason Rhinelander
6a8d4aca38 Fix signed/unsigned comparison warning and make more std::chrono-y 2020-02-13 10:55:14 -04:00
Jeff Becker
837998eb88
rename variable 2020-02-12 12:53:53 -05:00
Jeff Becker
28561cd654
use Time_t 2020-02-12 12:10:48 -05:00
Jeff Becker
96c5553e34
rename variables 2020-02-12 12:10:48 -05:00
Jeff Becker
434ce56553
* get rid of dht explore for service nodes
* add Time_t using std::chrono for future uses
* make decaying hashset constructor with llarp_time_t explicit
* add decaying hashset implicit constructor using Time_t
* add timeouts for gossiper replay
* allow regossip of our RC
2020-02-12 12:10:48 -05:00
Jeff Becker
154be464ea
rc gossiping 2020-02-12 12:10:48 -05:00
Jeff Becker
7ad47f2dba
* get rid of dht explore for service nodes
* add Time_t using std::chrono for future uses
* make decaying hashset constructor with llarp_time_t explicit
* add decaying hashset implicit constructor using Time_t
* add timeouts for gossiper replay
* allow regossip of our RC
2020-02-12 12:10:48 -05:00
Jeff Becker
ea3851d15f
rc gossiping 2020-02-12 12:10:48 -05:00
Jeff
1403cff805
Merge pull request #1079 from majestrate/remove-dht-message-limit-2020-02-03
make message queue unbound for direct dht messages
2020-02-12 12:10:11 -05:00
Stephen Shelton
bc3184a126
s/LogInfo/LogDebug/ @ explore message 2020-02-06 11:57:39 -07:00
Jeff Becker
80f8363386
don't drop messages with pathid zero which belong to snode to snode dht and path build requests. 2020-02-03 16:24:45 -05:00
Jeff Becker
9efd796145
initial wack at 0.7.0 dht fixes 2020-01-27 11:54:51 -05:00
jeff
816070be62 dont inherit std::array 2020-01-25 12:21:28 -05:00
jeff
f728e6016b router version 2020-01-25 11:28:07 -05:00
Jeff Becker
b280bac141
don't always use bootstrap when exploring 2020-01-23 12:49:33 -05:00
Jeff Becker
3b66cf6e75
dht fixes, disable iterative lookups on clients, revert "fixes" from 0.6.3, pass in recursion depth from introset lookup 2020-01-22 17:08:05 -05:00
Stephen Shelton
fba12093ac
Remove dead code (AbstractRouter::EnsureRouter()) 2020-01-22 11:15:40 -07:00
Jeff Becker
1165466d56
don't deadlock when we want to remove lots of paths, flush queue instead when full 2020-01-21 12:28:23 -05:00
Jeff Becker
12899701c5
inform congestion on tail drop 2020-01-18 17:03:24 -05:00
Jeff Becker
860891b6a6
tail drop 2020-01-18 16:59:50 -05:00
Jeff Becker
4185d47d4b
link layer message priority 2020-01-18 16:55:45 -05:00
Jeff Becker
c3f99e1b5c
make format 2020-01-18 16:53:42 -05:00
jeff
79fd08e559
fix typo 2020-01-18 15:56:29 -05:00
jeff
4a761be52d
use std::chrono 2020-01-18 15:56:29 -05:00