Commit Graph

25 Commits (b81f7025c9a619409bb1c3f39e0c56e2084fd7be)

Author SHA1 Message Date
Jason Rhinelander b81f7025c9
Replace logging with oxen-logger
Replaces custom logging system with spdlog-based oxen logging.  This
commit mainly replaces the backend logging with the spdlog-based system,
but doesn't (yet) convert all the existing LogWarn, etc. to use the new
format-based logging.

New logging statements will look like:

    llarp::log::warning(cat, "blah: {}", val);

where `cat` should be set up in each .cpp or cluster of .cpp files, as
described in the oxen-logging README.

As part of spdlog we get fmt, which gives us nice format strings, where
are applied generously in this commit.

Making types printable now requires two steps:
- add a ToString() method
- add this specialization:

      template <>
      constexpr inline bool llarp::IsToStringFormattable<llarp::Whatever> = true;

This will then allow the type to be printed as a "{}" value in a
fmt::format string.  This is applied to all our printable types here,
and all of the `operator<<` are removed.

This commit also:
- replaces various uses of `operator<<` to ToString()
- replaces various uses of std::stringstream with either fmt::format or
  plain std::string
- Rename some to_string and toString() methods to ToString() for
  consistency (and to work with fmt)
- Replace `stringify(...)` and `make_exception` usage with fmt::format
  (and remove stringify/make_exception from util/str.hpp).
2 years ago
Jeff Becker fedc56e3f1
initial commit for #1595 3 years ago
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.
3 years ago
Jeff 8943be6c3a
serialize auth codes in rpc (#1369)
* serialize auth codes in rpc

* format

* format

* config and route fixups

* bump lokimq

* fix compile

* discard unknown members in service keys

* format
4 years ago
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
4 years ago
Jeff 11ed8924c6
use fs::path for service::Identity::EnsureKeys (#1364) 4 years ago
Jeff c91e4df856
make errors with service keyfile throw (#1358) 4 years ago
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().
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
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
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").
4 years ago
Jeff Becker e6174efa21
don't derive x25519 key from ed25519 key 4 years ago
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.
4 years ago
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.
4 years ago
Jeff Becker 0f13591802
does not work 4 years ago
Jeff Becker 99eb7726ff
initial dht key blinding 4 years ago
Stephen Shelton 5d3cb8f405 Include error code in log output in Identity::EnsureKeys() 4 years ago
Stephen Shelton 2c6226f54a Backup SNApp keys when migrating to new ed25519 crypto 5 years ago
Michael 5cef2865bd
Fix Ubuntu builds 5 years ago
Michael 488695047f
Remove redundant else blocks 5 years ago
Jeff Becker ba6f9ed2d7
continue using llarp::openfilestream 5 years ago
Michael 491fee206b
Port code to use CryptoManager over passing Crypto pointers 5 years ago
Michael 3f53965b71
Remove all use of IBEncodeMessage 5 years ago
Michael a83be769e2
More explicit error when keyfile is not a valid file 5 years ago
michael-loki e36ddfb093 Fixup casing (#543)
* Rename Identity.hpp to identity.hpp

* Rename Identity.cpp to identity.cpp

* Rename Info.hpp to info.hpp

* Rename Intro.cpp to intro.cpp

* Rename Intro.hpp to intro.hpp
5 years ago