Commit Graph

505 Commits

Author SHA1 Message Date
Stephen Shelton
a6787657be
Refactor config comments to take list of strings 2020-04-07 14:24:49 -06:00
Stephen Shelton
a8671cf9c7
Rename config classes for clarity
ConfigDefinition -> OptionDefiniton
Configuration -> ConfigDefinition
2020-04-07 14:24:49 -06:00
Stephen Shelton
9e850705b4
Add 'AssignmentAcceptor' convenience for simple config acceptors 2020-04-07 14:20:59 -06:00
Stephen Shelton
733efbab40
Reflect removal of accessors on config structs 2020-04-07 14:20:31 -06:00
Stephen Shelton
028e55e997
Remove pre-refactor config test 2020-04-07 14:14:33 -06:00
Stephen Shelton
14e7789847
Add padding to config file generated output 2020-04-07 14:12:31 -06:00
Stephen Shelton
18ee23c2a3
Support for comments in config definition 2020-04-07 14:11:58 -06:00
Stephen Shelton
c5ff672c79
Use 'undeclared handler' for multi-valued 'add-node' config option 2020-04-07 14:10:11 -06:00
Stephen Shelton
9a1b7b20de
Add "undeclared value" handler to Configuration 2020-04-07 14:09:14 -06:00
Stephen Shelton
e9708a5d1c
Add split(string_view, char) util function 2020-04-07 14:09:14 -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
a44eb73baa
Add config INI output unit tests 2020-04-07 14:01:46 -06:00
Stephen Shelton
69331f1571
Remove multiValued as an argument to ConfigDefinition 2020-04-07 14:01:45 -06:00
Stephen Shelton
f6d000838f
Clarity and convenience for defining config options 2020-04-07 14:01:45 -06:00
Stephen Shelton
02e31f3867
Introduce acceptor function in ConfigDefinition 2020-04-07 14:01:44 -06:00
Stephen Shelton
60d0bf2a9b
Rename function for clarity 2020-04-07 14:01:44 -06:00
Stephen Shelton
8352de7bd4
Config documentation, clarity 2020-04-07 14:01:43 -06:00
Stephen Shelton
1b19314278
Implement Configuration::generateDefaultConfig(), maintain insertion order 2020-04-07 14:01:43 -06:00
Stephen Shelton
105dd30fd9
More ConfigDefinition unit tests, fixes, support std::string as type 2020-04-07 14:01:42 -06:00
Stephen Shelton
25212b929c
Add ConfigDefinition unit tests, fixes 2020-04-07 14:01:41 -06:00
Stephen Shelton
0fb888890f
First pass at Configuration definition classes 2020-04-07 14:01:41 -06:00
Stephen Shelton
9d71228e74
Replace config visit pattern with explicit lookups
This is an initial pass at doing explicit value checks when handling
config parsing, as opposed to using a visiting pattern. The latter
made it difficult to check for conditions such as missing required
values, multiple values, etc.

It was also generally less readable (think declarative) which further
made it difficult to get a grasp for what our actual configuration file
requirements were.
2020-04-07 14:01:40 -06:00
Jeff
d3091cf9fc
Merge pull request #1167 from tewinget/tooling
RouterHive initial PR
2020-04-07 13:13:02 -04:00
Jeff Becker
99c814e6b0
fix dns rebinding vuln in jsonrpc 2020-03-04 13:59:33 -05:00
Thomas Winget
695784b2b6 more hive things
DHT PubIntroSentEvent
some helper functions added to RouterHive (C++ class) as well as RouterHive(Python class)
hive.py main() continues to be a testbed for new event types
some more internal classes in pybind
2020-03-04 00:57:26 -05:00
Thomas Winget
7e0e8ab7bf hive.py upgrades, now with more cli args! 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
Thomas Winget
912e4267e4 I'm a muppet. 2020-03-03 19:57:09 -05:00
Thomas Winget
df0380e746 LRSM RouterEvent, added to hive test and test passes. 2020-03-03 19:57:09 -05:00
Thomas Winget
771d0b4489 hive pytest framework in place (and path build test works)! 2020-03-03 19:57:09 -05:00
Jeff Becker
e3b5fb4dd9
add local publish intro message to send reply down path 2020-03-01 12:30:05 -05:00
Stephen Shelton
deac8e74ea
Remove dead unit tests 2020-02-28 17:05:58 -07:00
Stephen Shelton
6b906de00d
Judicious removal of dead code 2020-02-28 16:26:45 -07:00
Jeff Becker
dea78d2326
change function signature for dht context to exclude time parameter 2020-02-27 11:37:23 -05:00
Jeff Becker
e8f262ba1c
disable flawed unit test 2020-02-25 17:43:08 -05:00
Jeff
a8a6c175fc
Merge pull request #1128 from majestrate/use-std-chrono-2020-02-24
make llarp_time_t use std::chrono::milliseconds
2020-02-25 15:36:00 -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
Jason Rhinelander
3bd400f6fe Fix string_view C++17 compatibility
string_view was implicitly convertible to std::string, but
std::string_view is only explicitly convertible.  This makes the
`operator std::string` explicit to be more compatible, and re-adds a
bunch of explicit string casts to the code where needed.

(This also fixes the build if changing the standard to c++17)
2020-02-25 11:52:43 -04: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
18a2444c50 Add gcc5 workaround for catch2 GENERATE(table
stdlibc++'s before v6 erroneously have the tuple constructor as
explicit, which causes the initializer lists here to fail.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
1232f34f90 Rewrite generate expressions to make clang-7 happy 2020-02-24 14:27:44 -04:00
Jason Rhinelander
0839c16f19 Final abseil purge
Bye-bye Google Boost.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
46242ba69b TrimWhiteSpace -> TrimWhitespace
Fix my dumb initial capitalization choice.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
74d4afad51 Remove metric config parsing 2020-02-24 14:27:44 -04:00
Jason Rhinelander
54186c4a89 Replace absl string_view with string_view from lokimq
When we add loki-mq has a dependency we can just alias it, but for now
it's easier to copy the header than add the whole submodule library.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
561bfe24c0 Add cmake "check" target to run all tests
Renames the cmake Catch2 test target to "catch" (instead of "check") and
adds a "rungtest" for gtest (because the "gtest" target is already taken
by the gtest library itself), and then repurposes the "check" target to
run both test suite binaries.

Also updates the top-level Makefile to do the same thing, except that
there the gtest target is just "gtest" instead of "rungtest".
2020-02-24 14:27:44 -04:00
Jason Rhinelander
98c34d995b De-abseil: Add our own llarp::TrimWhiteSpace
Adds a TrimWhiteSpace instead of using abseil's.

Adds Catch2 tests for it, and also converts the existing str tests to
catch (which look much, much nicer than the gtest ones).
2020-02-24 14:27:44 -04:00
Jason Rhinelander
fe61367a87 Vastly simplified llarp::util::memFn
There is a huge pile of unnecessary machinery here that can be solved
with a few lambdas and some member function pointer type deduction.
2020-02-21 23:24:33 -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
Stephen Shelton
16be86a5c3
Merge pull request #1116 from tewinget/short-path-names
path builder prints hops, rest print short name
2020-02-21 08:58:05 -08:00
Thomas Winget
fc56a018e5 path builder prints hops, rest print short name 2020-02-20 16:37:39 -05:00
Jeff
7c5a721457
Merge pull request #1114 from notlesh/redundant-introset-lookup-improvements-2020-02-20
Redundant introset lookup improvements
2020-02-20 15:25:09 -05:00
Stephen Shelton
0429bafbb3
Merge pull request #1111 from notlesh/redundant-introset-propagation-2020-02-19
Redundant introset propagation
2020-02-20 10:50:06 -08:00
Stephen Shelton
66cb30fa58
Refactor: remove recursionDepth from DHT lookups 2020-02-20 11:18:05 -07:00
Stephen Shelton
dff9aeb250
Propagate Introset publishing redundantly 2020-02-19 17:07:46 -07:00
Jason Rhinelander
ac1486d0be Replace absl::optional with optional-lite
Step 1 of removing abseil from lokinet.

For the most part this is a drop-in replacement, but there are also a
few changes here to the JSONRPC layer that were needed to work around
current gcc 10 dev snapshot:

- JSONRPC returns a json now instead of an optional<json>.  It doesn't
  make any sense to have a json rpc call that just closes the connection
  with returning anything.  Invoked functions can return a null (default
  constructed) result now if they don't have anything to return (such a
  null value won't be added as "result").
2020-02-19 18:21:25 -04:00
Jeff Becker
827ca0bda7
make catch2 a submodule 2020-02-17 08:26:20 -05:00
Stephen Shelton
7842889fef Add NodeDB tests around FindClosestTo() 2020-02-14 17:45:22 -04:00
Stephen Shelton
9dfcfbc3ac Bencode/decode relayOrder in lexigraphical order, make it uint64_t 2020-02-14 17:43:13 -04:00
Stephen Shelton
906803e387 Refactor DHT introset lookups to use redundant lookup strategy 2020-02-14 17:43:13 -04:00
Jeff Becker
e35d17764a * add path::Path::UniqueEndpointSet_t
* start using check2 for new unit tests
* unit test for path::Path::UniqueEndpointSet_t
2020-02-14 17:41:31 -04:00
Jason Rhinelander
8aacc2d317 Update deprecated gtest macros
gtest ~renamed INSTANTIATE_TEST_CASE_P to INSTANTIATE_TEST_SUITE_P and
added a "backwards compatibility" shim, but the shim fails at compile
time if you pass in an empty fourth argument.
2020-02-13 15:15:36 -04:00
Jeff
186dba45cb
Merge pull request #956 from notlesh/km-testing
Implement KeyManager tests
2020-02-13 14:04:42 -05:00
Jason Rhinelander
0497fb9ccb Another big-endian fix 2020-02-07 03:46:46 -04:00
Jason Rhinelander
5f642e4f01 Zero-initialize test array 2020-02-06 14:33:53 -04:00
Jeff
8230b1152e
Merge pull request #1072 from majestrate/2020-01-25-router-version
add router version
2020-02-04 17:40:46 -05:00
Jeff Becker
1318846a08
test/service/test_llarp_service_identity.cpp:
* remove failing irrelevent test
* add expect_call in EnsureKeys to match expected bevahior
2020-02-04 06:44:48 -05:00
Stephen Shelton
8921125924
Fix buffer overflow when version encodes too many integers 2020-01-31 14:48:00 -07:00
Jason Rhinelander
46f3459b79 Fixed EncryptedIntroSet signing to use PrivateKey
We can generate both root and derived signatures from a PrivateKey, but
only root from a SecretKey, so just change it to use a PrivateKey.
2020-01-31 16:47:25 -04:00
Jason Rhinelander
cd8f26deff Use hash instead of random for signing hash data
This makes PrivateKey store both the key followed by the hash.  For
PrivateKeys based on SecretKeys this just means the second half of the
SHA-512 of the seed, and makes a PrivateKey constructed from a SecretKey
give an identical signature to signing directly with sodium.

For derived keys we use a ShortHash of the root key's signing hash
concatenated with the publicly known hash value, so that our derived key
signing hash will be different from the root signing hash and also
different for different derivation parameters.

This also changed one of the asserts in crypto_noop, but upon closer
inspection the copying of the secret key into the signature seems really
wrong, so just changed them to fill with 0s.
2020-01-31 16:47:25 -04:00
Jeff Becker
9153f726c5 const correctness 2020-01-31 16:47:25 -04:00
Stephen Shelton
cfabe72587
Fix RouterVersion::IsEmpty() and RouterVersion::Clear() 2020-01-31 13:31:00 -07:00
Stephen Shelton
f0571a9f2c
Fix IsCompatableWith() logic WRT emptyRouterVersion, add unit tests 2020-01-31 13:23:48 -07:00
Thomas Winget
a487982c49 initial implementation of blinded sign -- not working yet 2020-01-31 12:05:20 -04:00
Jason Rhinelander
860c5efd47 Derived key fixes
The reason things weren't working here is because libsodium does
something completely unintuitive and called the seed the "secret key"
when it isn't, it's the seed.

This adds a new PrivateKey class (alongside the existing SecretKey and
PubKey) that holds just a private key value but no seed -- which we need
to do because there is no way we can get a seed after calculating a
derived keypair.

With these changes, we now generate exactly the same keys and subkeys as
Tor (and a new test case uses values generated in Tor to verify this).

This is incomplete -- the subkey signing code is still not implemented;
it has to be adapted to create a signature from a PrivateKey rather than
a SecretKey which will probably requiring working around/reimplementing
some of what libsodium does for creating a signature since it expects
"secret keys" i.e. the seed.
2020-01-30 12:34:05 -04:00
Jeff Becker
0f13591802
does not work 2020-01-28 16:55:36 -05:00
Jeff Becker
99eb7726ff
initial dht key blinding 2020-01-27 16:30:41 -05:00
Jeff Becker
9efd796145
initial wack at 0.7.0 dht fixes 2020-01-27 11:54:51 -05:00
Jeff Becker
2c0dc12f39
refactor single char variables in DHT (mostly) 2020-01-23 12:10:58 -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
9a65f19bb0
Add test to ensure config loading impacts runtime log level 2020-01-21 12:33:04 -07:00
Stephen Shelton
43998f97c8
Add unit tests for LogLevelToName and LogLevelToString 2020-01-21 12:15:04 -07:00
Jeff Becker
28752f85b7
improve test cases 2020-01-21 13:35:52 -05:00
Jeff Becker
8d11519eb2
unit tests for logging levels 2020-01-21 13:21:11 -05:00
Rick V
636957f3f9
happy new year 2020-01-05 20:40:34 -06:00
Jeff Becker
562f3f07ab
add unit test for decaying hash set 2019-12-30 15:52:10 -05:00
Jason Rhinelander
1b710455a7 Disallow AlignedBuffer < 8 bytes; add oddball buffer sizes 2019-12-19 16:17:02 -04:00
Jeff Becker
16c7e7dd33 fix unit tests 2019-12-19 10:25:52 -05:00
Thomas Winget
f4c9e09d44 remove obsolete timer-related code 2019-12-18 19:05:33 -05:00
Rick V
ccd936feb1
the internal windows toolchain _already_ provides a default manifest 2019-12-16 11:32:50 -06:00
Rick V
fd6602bf05
fix versiontag 2019-12-16 11:32:42 -06:00
Rick V
e144d9e762
fix test suite 2019-12-16 11:28:47 -06:00
Rick V
6d49ffd60b
include all platform dependencies transitively 2019-12-16 11:28:46 -06:00
Rick V
e15c57c114
get ready for v0.6
bump version

don't ship the shared object
2019-12-16 11:28:21 -06:00
Jeff Becker
9fa2b5c92a
remove undeeded test case 2019-12-15 07:05:17 -05:00
Jeff Becker
fcf0ae2b9e
prune unused files. 2019-12-15 07:02:17 -05:00
Stephen Shelton
332f33b049 Remove FS_LIB conditionals 2019-12-12 12:58:46 -07:00