Commit Graph

129 Commits

Author SHA1 Message Date
Jeff Becker
25e338d621
srv records
* add srv records in RCs if we have any
* add mechanism to add SRV records for plainquic exposed ports
* resign and republish rc or introset on srv record changes
2021-04-19 07:02:43 -04:00
Jeff Becker
3f9e51e391
more liblokinet api functions
* get/set netid
* set log level
2021-04-19 06:59:07 -04:00
Thomas Winget
7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
2021-03-09 19:01:41 -05:00
Jason Rhinelander
91d6698a9d Reformat with clang-format-11 2021-03-05 13:36:31 -04:00
Jeff Becker
df4ea34a56
nodedb refactor
* bump zmq static dep
* lokimq -> oxenmq
* llarp_nodedb -> llarp::NodeDB
* remove all crufty api parts of NodeDB
* make NodeDB rc selection api not suck
* make path builder api not suck
* propagate all above changes so that unit tests work and it all compiles
2021-02-02 09:35:40 -05:00
Jeff
5b5bd6b44e
dns features (#1404)
* add some dns txt records for stuff we want to expose

* fix txt records

* txt records for snode info

* dont send cname as it mangles the response

* check for 3 parts not 3 characters
2020-10-12 12:18:46 -04:00
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>
2020-10-07 18:22:58 -04:00
Thomas Winget
4f3ed5d1c4
remove unnecessary code
the signed_bt_dict field is not used for a Version 0 RC anyway, so no need to handle it here.  That was my bad.
2020-10-02 11:41:21 -04:00
Jeff Becker
c04cbfe34f
fix decode version 0 rc when in version 1 mode 2020-10-02 11:09:38 -04:00
Jeff Becker
23302cd10c
use size_left 2020-10-02 10:06:08 -04:00
Thomas Winget
7f18df4e9a
fix format string for size_t (#1371) 2020-09-28 20:07:40 -04:00
Jeff
53598ec0e9
dont serialize ephemeral members of service identity (#1370)
* prepare for keytool script

* dont serialize ephemeral members in service key file
* regnerate ephemeral members in service identity on load

* add keygen script

* use nacl for generating keys

* format
2020-09-28 11:15:07 -04:00
Thomas Winget
15229ea7ff
New RC format (#1368)
* initial work for RC SRVs.

Needs tests for new RC format.

Needs SRVs added to new RC, and associated tests.

* convert rc sign/verify test to catch2, add test for new rc

Also fixes a mistake in new rc serialization

* bump loki-mq submodule

need support for viewing bt deserialize consumer buffer so we
know how much it has consumed.

* fix some behavior errors

need to advance llarp_buffer_t after consuming data from it

only rewind and modify size of llarp_buffer_t in owning context.

* Add test for router contact (de-)serialization

Adds a test that makes a list of RouterContact with mixed
versions and ensures it serializes and deserializes correctly.
2020-09-25 14:05:28 -04:00
jeff
2aaed895f3
disable exits in RCs 2020-08-24 20:19:51 -04:00
Rick V
5529371637 RouterContact::[Read|Write] now take a fs::path const ref 2020-05-26 22:39:01 -05: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
e56faba23d
make format 2020-05-15 09:07:28 -04:00
Jason Rhinelander
6686668b48 Annotate netid mismatch message with (theirs)/(ours)
Every time I see this I don't know which one is wrong.  This helps.
2020-05-13 22:36:15 -03: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
Stephen Shelton
aee96e53a3
Refactor Addr -> IpAddress/SockAddr 2020-05-06 14:38:44 -06: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
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 Becker
d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
Jeff
6ac5f19b3a
Merge pull request #1110 from jagerman/no-abseil-optional
De-abseil, part 1: remove absl::optional
2020-02-20 12:38:16 -05: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
9a6148c4c3
require router version in public routers 2020-02-19 15:25:02 -05:00
jeff
f728e6016b router version 2020-01-25 11:28:07 -05:00
Stephen Shelton
f01392cc49
Start stale router lookup 5 minutes before its expiration 2020-01-18 14:37:42 -07:00
Stephen Shelton
9b00e6fa8d
Bump RC expiration constants significantly 2020-01-18 14:07:21 -07:00
Jeff Becker
d9297a4907
log invalid signatures 2020-01-15 10:42:28 -05:00
Jason Rhinelander
638fb25b47 Put version info into a compiled file
This rewrites the version info using lokid's approach of compiling it
into a .cpp file that gets generated as part of the build (*not* during
the configure stage).

Among other things, this means that changing the version no longer
invalidates ccache or cmake dependencies, and because it depends on
`.git/index` git commits will cause the version to be regenerated,
making the commit tag more reliable (currently if you rebuild without
running cmake your git commit tag doesn't update).
2019-12-11 22:40:07 -04:00
Stephen Shelton
a0699ad229 Undo adding of crypto version to RouterContact, other fixes 2019-11-27 11:30:19 -07:00
Stephen Shelton
0c02ea8d2e Add "keyfile version" to RouterContact 2019-11-22 14:06:15 -07:00
Stephen Shelton
1666498405 Replace bencode_write_version_entry with a more general-purpose function for writing bencoded dictionary entries 2019-11-22 10:39:35 -07:00
Jeff Becker
61ade40a51
reduce logging and make format 2019-09-09 07:36:21 -04:00
Jeff Becker
ff233204cd
disable rc expiration 2019-09-09 06:45:52 -04:00
Michael
1aec0dfa2b
Move logging to subdirectory 2019-09-03 20:52:27 +01:00
Michael
70937ab503
Fix docker-compose isolated network 2019-08-27 01:57:37 +01:00
Michael
7cb1b525c9
Dump more info from router contact 2019-08-19 23:25:46 +01:00
Michael
777261cb20
Use ToString over ToHex 2019-08-19 22:26:37 +01:00
Michael
094b697b01
Replace StatusObject with underlying JSON type 2019-08-19 10:33:26 +01:00
Michael
4763888d2c
Add fail-able docker build for gcc trunk 2019-08-02 10:28:09 +01:00
Thomas Winget
baf8019fe5 Refactor Router code into more classes
This commit refactors functionality from the Router class into separate,
dedicated classes.
There are a few behavior changes that came as a result of discussion on
what the correct behavior should be.
In addition, many things Router was previously doing can now be provided
callback functions to alert the calling point when the asynchronous
action completes, successfully or otherwise.
2019-07-25 14:11:02 -04:00
Jeff Becker
16e20a9e79
try fixing bootstrap 2019-07-15 12:56:09 -04:00
Jeff Becker
58005c5f81
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-07-08 10:17:21 -04: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
Jeff Becker
ba6f9ed2d7
continue using llarp::openfilestream 2019-06-24 12:51:29 -04:00
Jeff Becker
54a098356d
continue using llarp::openfilestream 2019-06-24 12:39:03 -04:00