Commit Graph

147 Commits (af6caf776a4a7a8580d96d5e72cb9e037708e3c4)

Author SHA1 Message Date
Jason Rhinelander af6caf776a
Config file improvements (#1397)
* Config file API/comment improvements

API improvements:
=================

Make the config API use position-independent tag parameters (Required,
Default{123}, MultiValue) rather than a sequence of bools with
overloads.  For example, instead of:

    conf.defineOption<int>("a", "b", false, true, 123, [] { ... });

you now write:

    conf.defineOption<int>("a", "b", MultiValue, Default{123}, [] { ... });

The tags are:
- Required
- MultiValue
- Default{value}
plus new abilities (see below):
- Hidden
- RelayOnly
- ClientOnly
- Comment{"line1", "line2", "line3"}

Made option definition more powerful:
=====================================

- `Hidden` allows you to define an option that won't show up in the
  generated config file if it isn't set.

- `RelayOnly`/`ClientOnly` sets up an option that is only accepted and
  only shows up for relay or client configs.  (If neither is specified
  the option shows up in both modes).

- `Comment{...}` lets the option comments be specified as part of the
  defineOption.

Comment improvements
====================

- Rewrote comments for various options to expand on details.
- Inlined all the comments with the option definitions.
- Several options that were missing comments got comments added.
- Made various options for deprecated and or internal options hidden by
  default so that they don't show up in a default config file.
- show the section comment (but not option comments) *after* the
  [section] tag instead of before it as it makes more sense that way
  (particularly for the [bind] section which has a new long comment to
  describe how it works).

Disable profiling by default
============================

We had this weird state where we use and store profiling by default but
never *load* it when starting up.  This commit makes us just not use
profiling at all unless explicitly enabled.

Other misc changes:
===================

- change default worker threads to 0 (= num cpus) instead of 1, and fix
  it to allow 0.
- Actually apply worker-threads option
- fixed default data-dir value erroneously having quotes around it
- reordered ifname/ifaddr/mapaddr (was previously mapaddr/ifaddr/ifname)
  as mapaddr is a sort of specialization of ifaddr and so makes more
  sense to come after it (particularly because it now references ifaddr
  in its help message).
- removed peer-stats option (since we always require it for relays and
  never use it for clients)
- removed router profiles filename option (this doesn't need to be
  configurable)
- removed defunct `service-node-seed` option
- Change default logging output file to "" (which means stdout), and
  also made "-" work for stdout.

* Router hive compilation fixes

* Comments for SNApp SRV settings in ini file

* Add extra blank line after section comments

* Better deprecated option handling

Allow {client,relay}-only options in {relay,client} configs to be
specified as implicitly deprecated options: they warn, and don't set
anything.

Add an explicit `Deprecated` tag and move deprecated option handling
into definition.cpp.

* Move backwards compat options into section definitions

Keep the "addBackwardsCompatibleConfigOptions" only for options in
sections that no longer exist.

* Fix INI parsing issues & C++17-ify

- don't allow inline comments because it seems they aren't allowed in
ini formats in general, and is going to cause problems if there is a
comment character in a value (e.g. an exit auth string).  Additionally
it was breaking on a line such as:

    # some comment; see?

because it was treating only `; see?` as the comment and then producing
an error message about the rest of the line being invalid.

- make section parsing stricter: the `[` and `]` have to be at the
beginning at end of the line now (after stripping whitespace).

- Move whitespace stripping to the top since everything in here does it.

- chop off string_view suffix/prefix rather than maintaining position
values

- fix potential infinite loop/segfault when given a line such as `]foo[`

* Make config parsing failure fatal

Load() LogError's and returns false on failure, so we weren't aborting
on config file errors.

* Formatting: allow `{}` for empty functions/structs

Instead of using two lines when empty:

    {
    }

* Make default dns bind 127.0.0.1 on non-Linux

* Don't show empty section; fix tests

We can conceivably have sections that only make sense for clients or
relays, and so want to completely omit that section if we have no
options for the type of config being generated.

Also fixes missing empty lines between tests.

Co-authored-by: Thomas Winget <tewinget@gmail.com>
4 years ago
Jeff b0088b3298
dont segfault on exit (#1396)
* dont segfault on exit

* initialize m_isServiceNode earlier.
4 years ago
Jeff 252692a55b
dont poke routes if we have no exit (#1352)
* * refactor route poking out of llarp::Router and into llarp::RoutePoker
* only poke routes when we have an exit enabled as a client

* add route_poker header so it compiles
4 years ago
Jeff 3ab7db7723
macos route poking (#1333)
* fix up macos route poker logic

* fix typo

* use string_view

* add forgotten header

* full paths

* add debugging

* catch exception on adding route

* workarround for macos

* typofix

* typofix

* fix for macos

* fix command for macos

* because we autopoke remove explicit route poking in rpc

* probably final fix of macos route poking

* split routes instead of deleting them

* dynamic route poking

* move log statement for introset lookup and dont consider bad sessions as able to send

* send convotag reset frame when we have no session

* add exit map to rpc

* use split_any
4 years ago
Jeff 60f4d96ba5
proper route poking (#1330)
* route poking:

* remove popen() call, replace with reading /proc/net/route for getting default route
* dynamically poke and unpoke routes on runtime

* swap intros and fix rpc endpoint for version to return what the ui expects

* use std::string::find_first_not_of instead of using a lambda
4 years ago
jeff 5391e6a66a initial config overriding on runtime 4 years ago
jeff f6f56029d3
working netlink route poker 4 years ago
Stephen Shelton 0f074cff8c
Remove ambguity WRT loading and passing of Config 4 years ago
Stephen Shelton 552dcce5fd
Use inheritance to handle Hive injection 4 years ago
Stephen Shelton 84c83a2400
Add specialized subclass of Router for Hive 4 years ago
Stephen Shelton 0ecdda7a89
make format 4 years ago
Stephen Shelton aeb0c2be3a
Remove ability to stop routers from gossiping for now 4 years ago
Stephen Shelton bdac43e19f
Peer stats test which artificially stops a router from gossiping its RC 4 years ago
Stephen Shelton b2a72dd46a
Initial test_peer_stats hive test 4 years ago
Stephen Shelton 2453fff10b
Piggyback on link callbacks to add peer stats 4 years ago
Stephen Shelton 595288e046
Add PeerDb::handleGossipedRC 4 years ago
Stephen Shelton 2a30e7dac2
Add PeerDb to Router 4 years ago
Jeff Becker a9109aa91b
* deprecate old unused lokid rpc options
* use lokimq::address in config and in lokid rpc
* bump lokimq submodule
4 years ago
Jeff Becker e13e886df9
fix up event loop crap so that unit tests pass 4 years ago
Jeff Becker 1779f33506
fix makefile fromat target
use lokimq::address instead of std::string or std::string_view
4 years ago
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 4 years ago
Jeff Becker 9bfff61d08
initial wack at lokimq 4 years ago
Stephen Shelton fd4b03f896
WIP: LokidRpcClient 4 years ago
Jeff Becker fb8b8e2e56
add stubs for lmq rpc server 4 years ago
Jeff Becker ad882d0d70
initial working code 4 years ago
Jeff Becker 0006751d80
initial wack at lokimq 4 years ago
Stephen Shelton 91725a8530
WIP: LokidRpcClient 4 years ago
Stephen Shelton 11951510bf
Remove libabyss and rpc::Caller/rpc::Server 4 years ago
Stephen Shelton 1497b829bd
Ignore our self.signed file if we're a client 4 years ago
Jeff a5b09c47e1
Merge pull request #1262 from notlesh/bandaids-for-sockaddr-refactor-2020-05-11
Bandaids for sockaddr refactor 2020 05 11
4 years ago
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 4 years ago
Jeff Becker 01cc2c86bf
format 4 years ago
Jason Rhinelander cd7fd1b6ad FIXME fix the FIXME 4 years ago
Stephen Shelton 960dc37c1f
Refactor TunEndpoint::Configure() (partially) 4 years ago
Stephen Shelton 779658edd0
Refactor ExitEndpoint's config, mv dns ops from [network] to [dns] 4 years ago
Stephen Shelton 21ad442b55
Remove NetConfig_t 4 years ago
Stephen Shelton 93b35c92a7
Eradicate service::Config 4 years ago
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.
4 years ago
Jeff 54a7843bc5
Merge pull request #1186 from notlesh/config-cleanup-2020-03-13
Config cleanup
4 years ago
Jason Rhinelander 3c6aa002b8 Fix errors and warnings compiling on mac 4 years ago
Stephen Shelton d3bcc05aa6
Organize some constants and default values 4 years ago
Stephen Shelton 6fd270ba09
Rip out link type spec and factory
We only support IWP now, so this is all effectively dead code.
4 years ago
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.
4 years ago
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 4 years ago
Jeff Becker d2d109e92c
llarp_time_t is now using std::chrono 4 years ago
Thomas Winget 74d421ac2d PathBuildNumber -> NextPathBuildNumber because increment side-effect 4 years ago
Thomas Winget fc56a018e5 path builder prints hops, rest print short name 4 years ago
Jeff Becker 28561cd654
use Time_t 4 years ago
Jeff Becker ea3851d15f
rc gossiping 4 years ago
jeff 4a761be52d
use std::chrono 4 years ago