Commit Graph

84 Commits (8b321612da4e129b8eee4e02af755184d2405fe9)

Author SHA1 Message Date
Jason Rhinelander f168b7cf72
llarp_buffer_t: rename badly named operator==
It didn't do equality, it did "does the remaining space start with the
argument" (and so the replacement in the previous commit was broken).

This renames it to avoid the confusion and restores to what it was doing
on dev.
2 years ago
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 1eba0f836e
replace LLARP_PROTO_VERSION macro 2 years ago
Jeff 926074f7c4
add idempotent pump after sending lrcm to very make sure that it is pumped 2 years ago
Jeff 3fbddac464 idempotent flush queues on path builds 2 years ago
Jeff Becker 3142bab0ac
move setting hop to nullptr to after delivery or delivery fail 3 years ago
Jeff Becker a0b8fe144a
convert to lambda 3 years ago
Jeff Becker 719dd38cf5
more shit 3 years ago
Jeff Becker 95537804cd
separate white/grey list for active/decommissioned nodes.
allow sessions to decommissioned nodes but not paths.
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
Jason Rhinelander c4559d158e Make format 3 years ago
Jason Rhinelander ccc7b5c9e9 Merge Logic functions into EventLoop
loop->call(...) is similar to the old logic->Call(...), but is smart
about the current thread: if called from within the event loop it simply
runs the argument directly, otherwise it queues it.

Similarly most of the other event loop calls are also now thread-aware:
for example, `call_later(...)` can queue the job directly when called if
in the event loop rather than having to double-queue through the even
loop (once to call, then inside the call to initiate the time).
3 years ago
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
3 years ago
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 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
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 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
Stephen Shelton ea835405c5
Refactor NotifyRouterEvent() to forward args, event code cleanup
This template-ifies Router::NotifyRouterEvent() up so that it accepts
the arguments to instantiate the specified event type, forwarding them
to std::make_unique. This would allow (in the future) the function to
no-op the call and avoid memory allocation. It also slightly reduces
the amount of code required to fire an event.

This commit also simplifies some of the RouterEvent code to reduce
redundancy.
4 years ago
Thomas Winget 84a1d7dbcc clang format....... 4 years ago
Thomas Winget c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 4 years ago
Thomas Winget 771d0b4489 hive pytest framework in place (and path build test works)! 4 years ago
Thomas Winget a9882ad475 PathRequestReceivedEvent implemented 4 years ago
Jeff Becker 32e768d7dd
change log 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
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 9efd796145
initial wack at 0.7.0 dht fixes 4 years ago
Jeff Becker ecf2685aa3
use optional 4 years ago
Jeff Becker d7c78b0c71
comments 4 years ago
Jeff Becker f3e96e06b2
propagate error to client 4 years ago
Jeff Becker a9c9fe9c24
limit client side path builds per ip 4 years ago
Stephen Shelton 66a058a2af Make format 4 years ago
Stephen Shelton 93b8832026
Merge branch 'dev' into private-keys-backup-support 4 years ago
Jeff Becker 56dce90de9
add trace log level for tracking logic thread jobs 5 years ago
Stephen Shelton db56e17c23 Rename bencode function for clarity 5 years ago
Stephen Shelton 1666498405 Replace bencode_write_version_entry with a more general-purpose function for writing bencoded dictionary entries 5 years ago
Jason Rhinelander 6524563d33
Merge pull request #897 from majestrate/bencode-seek-for-version-2019-11-03
seek for version and set it before deserializing
5 years ago
Thomas Winget 75512b1b58 ban zero id for pathid; clarity and cleanup 5 years ago
Jeff Becker bdb0b847f8
seek for version and set it before deserializing 5 years ago
Jeff Becker 5cdd92e2a3
remove more locking and make it safe 5 years ago
Michael edd0ec398f
Move thread stuff to subdirectory 5 years ago
Michael 4d8fe2a8a8
Move meta programming to subdirectory 5 years ago
Michael 1aec0dfa2b
Move logging to subdirectory 5 years ago
Michael 16cdfbd5f0
clang-tidy modernize pass 5 years ago
Thomas Winget 38fd0552d3 Adds Link-Relay Status Messages
Success case:
  - the path endpoint creates and sends a LR_StatusMessage upon
    successful path creation

Failure case:
  - an intermediate hop creates and sends a LR_StatusMessage upon
    failure to forward the path to the next hop for any reason

Both cases:
  - transit hops receive LR_StatusMessages and add a frame
    to them reflecting their "status" with respect to that path
  - the path creator receives LR_StatusMessages and decrypts/parses
    the LR_StatusRecord frames from the path hops.  If all is good,
    the Path does as it would when receiving a PathConfirmMessage.
    If not, the Path marks the new path as failed.

LR_StatusMessage is now used/sent in place of PathConfirmMessage
5 years ago
Michael 08609f9e5a
Rename message files 5 years ago
Michael 8884d0d9d4
Merge changes from upstream 5 years ago
Michael 8a058fcb34
Move other messages 5 years ago
Michael 2291d48bcc
Move remaining messages around 5 years ago