Commit Graph

48 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
Thomas Winget 221e9ff5de make format 4 years ago
Thomas Winget c2a30692cf Implement upstream DNS using libunbound 4 years ago
Jeff Becker 3eb006f78c
iwp/libuv cleanup: remove llarp_pkt_list and all users of it as it's broke 4 years ago
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 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 d2d109e92c
llarp_time_t is now using std::chrono 4 years ago
Jeff Becker c6d77e72f2
fix up tcp connection logic 4 years ago
Jeff Becker 8b8d636ded
make format 4 years ago
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.
4 years ago
Rick V 9fa9209114
don't be aggressive
remove libcurl packaging rules. We still build it, but ship only the curl.exe
4 years ago
Jeff Becker cec36b62b5 make logic and net thread one in the same 4 years ago
Jeff Becker 1a864832c8
make format 5 years ago
Thomas Winget 23a9773e1e
remove our paths from outbound queues 5 years ago
Jeff Becker 7ee026fa50
make path builds work again 5 years ago
Jeff Becker 89e5b6b4cc
try fixing leak 5 years ago
Jeff Becker 75d746c518
update _sz 5 years ago
Jeff Becker 2f2834f331
make non copyable 5 years ago
Jeff Becker b737fdbe03
fix crash 5 years ago
jeff 3c1d5518d8 fix windows port and make it compile 5 years ago
jeff 14c9ef15ed try calling stuff in logic thread from event loop 5 years ago
Jeff Becker 4bf6882c8a
more async cryptography 5 years ago
Michael edd0ec398f
Move thread stuff to subdirectory 5 years ago
Jeff Becker 35c78348f2
default to no implementation on pipe for pleasing win32 5 years ago
Jeff Becker aea4542edd
more 5 years ago
Michael 16cdfbd5f0
clang-tidy modernize pass 5 years ago
Michael f9e9227e19
Fix gcc trunk warnings 5 years ago
Michael 488695047f
Remove redundant else blocks 5 years ago
Jeff Becker 9deafa4cb8
use libuv 5 years ago
Michael 9ee525a006
Fix shadowing warnings 5 years ago
Michael 4143472a17
Add cmake module to target a library as 'system', and fix a few warnings 5 years ago
michael-loki 0195152e05 Allow builds on MSVC (#518)
* Import cxxopts to replace getopts usage

* Add visual studio build things

* Fixup abseil build parts

* Replace __attribute__((unused)) with ABSL_ATTRIBUTE_UNUSED

* Fixup minor windows build issues

* Replace getopts usage

* Temporarily fixup .rc files

* More minor windows fixes

* Get a working build

* Revert .rc files

* Revert changes to nodedb
5 years ago
Jeff Becker 3da6551e82
make android compile 5 years ago
Jeff Becker ac69213dd7
unit tests for llarp_ev_pkt_pipe 5 years ago
Jeff Becker e178a70929
use shared_ptr for event loop 5 years ago
Rick V bbba2c0eea
improve windows select loop
add generic svr4 poll(2) event loop
5 years ago
Jeff Becker 8d078f19eb
wrap epoll with IO checks for resetting errno 5 years ago
Michael 61f3273dc4
Add threading annotations and fix potential deadlocks 5 years ago
Jeff 0a44d1b730
Merge pull request #367 from majestrate/staging
delay dns resolution for snode until we have a session with it
5 years ago
Jeff Becker 159415c363
delay dns resolution for snode until we have a session with it 5 years ago
sachaaaaa d08169f104 Add missing override in evp.hpp 5 years ago
Jeff Becker 86098b198f
clear errno and log invalid data 5 years ago
Jeff Becker 46b80e465d
* fix jsonrpc endpoint path for caller
* make epoll not crash and leak
* correct key name in config
5 years ago
Michael f3b0af9d2f
Create CopyableBuffer type 5 years ago
Michael 9d0d3a4cc9
Fix build on darwin 5 years ago
Michael 6e38e85a79
Produce hierarchy of 'libraries' inside libllarp 5 years ago
Michael 317e29b777
Move win32 specific files to win32 dir 5 years ago
Michael 081d4dfa32
Reorganise source into more folders 5 years ago