Commit Graph

273 Commits

Author SHA1 Message Date
Stephen Shelton
1fc7c61d1f
Share common conf comments for client and relay 2020-04-07 14:24:50 -06:00
Stephen Shelton
3739fc1d70
Reinstate multi-valued option 2020-04-07 14:24:50 -06:00
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
f250b7adcb
Remove pidfile support 2020-04-07 14:24:48 -06:00
Stephen Shelton
4f77080f75
Remove optional<> from block-bogons 2020-04-07 14:23:53 -06:00
Stephen Shelton
4d053231d3
Define config defaults as constexpr 2020-04-07 14:23:32 -06:00
Stephen Shelton
adfcbd1d0b
Slight cleanup of k:v option maps 2020-04-07 14:23:11 -06:00
Stephen Shelton
e06c2e4502
Check that [router]min-connections <= [router]max 2020-04-07 14:22:53 -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
9e850705b4
Add 'AssignmentAcceptor' convenience for simple config acceptors 2020-04-07 14:20:59 -06:00
Stephen Shelton
f2a8dd10ce
Modernize Snapp config 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
c8c940b0f5
Replace individual file locations with dataDir 2020-04-07 14:19:21 -06:00
Stephen Shelton
5d0b53e1be
Remove environment variable support in config 2020-04-07 14:19:21 -06:00
Stephen Shelton
05257126fe
Make distinction between config dir and data dir 2020-04-07 14:18:14 -06:00
Stephen Shelton
923e73f693
Plumb isRelay CLI arg through to config 2020-04-07 14:17:13 -06:00
Stephen Shelton
028e55e997
Remove pre-refactor config test 2020-04-07 14:14:33 -06:00
Stephen Shelton
6301fefd43
Add router-specific config comments 2020-04-07 14:14:01 -06:00
Stephen Shelton
5b520a4dff
Simplify connection limit constants 2020-04-07 14:13:27 -06:00
Stephen Shelton
14e7789847
Add padding to config file generated output 2020-04-07 14:12:31 -06:00
Stephen Shelton
1273f11ce8
First pass at updating comments to lokinet config 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
1653b73ee5
Clean up the logic around generating default confs 2020-04-07 14:11:57 -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
feacde7864
Hook up 'undeclared handlers' to mop up loosely-structured INI values 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
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
4c00c6238e
Join config definition and config parser 2020-04-07 14:06:10 -06:00
Stephen Shelton
653a650cf9
Fix typo 2020-04-07 14:05:11 -06:00
Stephen Shelton
9f0ae43149
Remove dead code 2020-04-07 14:05:11 -06:00
Stephen Shelton
d82f5e6b93
First pass at replacing config value logic 2020-04-07 14:04:36 -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
8160c13458
More documentation around Configuration/ConfigDefinition 2020-04-07 14:01:44 -06:00
Stephen Shelton
8352de7bd4
Config documentation, clarity 2020-04-07 14:01:43 -06:00
Stephen Shelton
d9340a873e
Consolidate Configuration generate INI functions 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
7dacc30862
Conveience and clarity around config definiton maps 2020-04-07 14:01:42 -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
a856e772c8
Stylistic clean up 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
Stephen Shelton
ca67c12928
Why template when we only use one type?? 2020-04-07 13:56:01 -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
Jeff
bf82740c08
only try fetching identity key once so we can interrupt lokinet (#1178) 2020-03-11 13:05:46 -03:00
Thomas Winget
84a1d7dbcc clang format....... 2020-03-06 20:20:11 -05:00
Thomas Winget
0f34a950a9 pybind config object, working 2020-03-03 19:57:09 -05:00
Jeff Becker
a5dc41b049 OMG IT DOES STUFF :DDDDDD 2020-03-03 19:57:09 -05:00
Jason Rhinelander
04c618ddae gcc 5 compatibility workaround 2020-02-25 13:33:39 -04: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
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
089056ca5b Remove all ABSL_ATTRIBUTE_UNUSED uses 2020-02-24 14:27:44 -04:00
Jason Rhinelander
5efcd49a3b Deabseil: remove absl::StrCat, de-templatize fromEnv
fromEnv here wasn't usefully templatized (the base template basically
couldn't be used for anything except a string anyway), so just replaced
it with the overloads we need and moved the implementations out of the
header.
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
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
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
40876a6e3f
configurable log level 2020-01-20 16:00:08 -05:00
Stephen Shelton
1300de2387 Enable the JSON RPC API by default 2019-12-19 14:54:09 -07:00
Jeff Becker
c4f08e5145
finish remaining changes 2019-12-11 16:18:47 -05:00
Jeff Becker
e90cb2929e
disable metrics by default 2019-12-09 08:13:38 -05:00
Stephen Shelton
2c6226f54a Backup SNApp keys when migrating to new ed25519 crypto 2019-12-06 11:21:14 -07:00
Stephen Shelton
11410a2748 Avoid trivial getters/setters in KeyManager 2019-12-06 10:31:19 -07:00
Stephen Shelton
66a058a2af Make format 2019-12-06 10:13:09 -07:00
Stephen Shelton
eb5184ee09 Reinstate link test / update to use KeyManager 2019-12-04 13:13:41 -07:00
Stephen Shelton
23fc2ad042 Init key manager before InitOutboundLinks are configured 2019-12-03 16:55:16 -07:00
Stephen Shelton
af2259db5f Move lokid key API request to KeyManager 2019-12-03 12:32:19 -07:00
Stephen Shelton
93b8832026
Merge branch 'dev' into private-keys-backup-support 2019-12-03 11:20:45 -07:00
Stephen Shelton
521ef9b5bb Handle link transport key in KeyManager 2019-12-03 10:58:53 -07:00
Rick V
cf3469e11a
crash on wine, we support linux, ucb_unix, svr4
natively ffs. i tested this patch on wine 4.4 on fuckin
Solaris 11 snv_151
2019-12-01 19:01:40 -06:00
Stephen Shelton
a0699ad229 Undo adding of crypto version to RouterContact, other fixes 2019-11-27 11:30:19 -07:00
Stephen Shelton
e8e2e21fa2 Reorganize priv key file loading a bit and hook KeyManager into Router 2019-11-26 12:42:41 -07:00
Jeff Becker
dd48b149ca
make job queue size configurable 2019-11-25 16:30:34 -05:00
Stephen Shelton
7084dae79a Implement code to move old key files out of the way 2019-11-22 16:11:59 -07:00
Stephen Shelton
fd02e3e149 Stub out KeyManager class 2019-11-21 20:57:41 -07:00
Michael
f6adacf936
Review fixes 2019-10-09 23:00:50 +01:00
Michael
3371da98cf
Use libcurl (optional dependency) to hit jsonrpc 2019-10-09 23:00:50 +01:00
Michael
86a07e2a80
Enable more sanitisers 2019-09-23 11:47:58 +01:00
Michael
4d8fe2a8a8
Move meta programming to subdirectory 2019-09-03 20:52:28 +01:00
Michael
1aec0dfa2b
Move logging to subdirectory 2019-09-03 20:52:27 +01:00
Jeff Becker
b5402dc6c3
Merge remote-tracking branch 'origin/master' into iwp-redux 2019-08-27 08:15:41 -04:00
Jeff Becker
0241851b72
add likn layer delivery timeout notification for iwp 2019-08-27 08:07:48 -04:00
Michael
70937ab503
Fix docker-compose isolated network 2019-08-27 01:57:37 +01:00
Jeff Becker
94f8531776
more fixups 2019-08-26 10:29:29 -04:00
Jeff Becker
6a48a3b402
code review fixes:
* use std::unordered_set
* use default for ctor/dtor
* don't crash on short packet with nack
2019-08-26 07:16:46 -04:00
Jeff Becker
4ac07ea9fb
use std::make_tuple 2019-08-23 08:40:56 -04:00
Jeff Becker
ba316f85ba
default to iwp 2019-08-22 16:56:27 -04:00
Jeff Becker
3c3338e801
Merge remote-tracking branch 'origin/master' into memlink 2019-08-21 10:53:25 -04:00
Michael
cd27f96832
replace endl with '\n in config.cpp 2019-08-19 23:56:02 +01:00
Jeff
ecf3c37d2e
Merge pull request #768 from majestrate/sane-limits
Sane limits
2019-08-14 06:28:28 -04:00
Michael
16cdfbd5f0
clang-tidy modernize pass 2019-08-12 16:52:58 +01:00
Jeff Becker
2345dd3239
try adding proper limits 2019-08-12 07:20:57 -04:00
Jeff Becker
c1f33bb1ac
initial mempipe implementation 2019-08-07 12:33:29 -04:00
Michael
91c1ba87cc
Change ConfigParser too 2019-07-21 16:57:11 +01:00
Michael
8fd4ceb55b
Don't use LoadFromString 2019-07-21 16:57:11 +01:00
Michael
71c6aca820
include cctype 2019-07-21 16:57:11 +01:00
Michael
5300568da5
Fix config builds 2019-07-15 22:46:57 +01:00
Jeff Becker
9a2ffb85e6
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-14 08:10:09 -04:00
Jeff Becker
750397d085
use std::string instead of fs::path 2019-07-14 07:25:33 -04:00
Jeff
b9cdfd116e correct worker threads amounts 2019-07-13 07:54:58 -04:00
Jeff Becker
8dab4b87bb
more logging 2019-07-12 13:39:13 -04:00
Jeff Becker
1fd6b5ae74
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-12 09:53:52 -04:00
Jeff Becker
fcc3c05124
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-10 10:07:19 -04:00
Michael
488695047f
Remove redundant else blocks 2019-07-09 22:54:46 +01:00
Michael
3ce90b678e
Allow override of the rest of the config 2019-07-09 00:29:43 +01:00
Michael
fbb83704a0
Allow override of some config via env variables 2019-07-09 00:29:43 +01:00
Michael
08d306f6e9
Have fromSection return void 2019-07-09 00:29:43 +01:00
Michael
937f28f75d
Move router config to be encapsulated 2019-07-09 00:29:43 +01:00
Jeff Becker
0eb6431eb1
initialize tun with 0 and set defaults in correct places 2019-07-08 11:26:06 -04:00
Michael
f310160065
Fixup and add tests 2019-07-06 14:46:25 +01:00
Michael
a2326efa37
Revert "Merge pull request #679 from tewinget/revert-config-refactor"
This reverts commit 2996a7f29c, reversing
changes made to 10df3bd4b3.
2019-07-06 14:46:25 +01:00
Thomas Winget
d044d60101 Reverts #678 #677 and #669 with hashes:
10df3bd
766ece8
979f095

See those commits for further details
2019-07-02 11:02:20 -04:00
Michael
b51f7d8015
Convert to load config in config loader 2019-07-02 01:58:39 +01:00
Michael
bd78471dae
Move ini parser as well 2019-07-02 01:58:38 +01:00
Michael
00c237dc6d
Move config class to its own dir 2019-07-02 01:58:38 +01:00