Commit Graph

168 Commits (a4bd7806b3ee51b64315287da60b235a83decbf0)

Author SHA1 Message Date
dr7ana 3451a30d0e ALPN verification
- laying the groundwork for functional client->service node connections. this requires ALPNs verification as a secondary method of identification to the remote key
- refactored btreq stream creation to use improved stream creation logic in libquic
6 months ago
dr7ana fd21eb3a00 Big fix!
- pending conns container stops them from being counted towards active conns in the interim
- un-abstracted pendingmessages vs pendingdatamessages vs pendingcontrolmessages (gross)
- fixed bootstrap fetching and storage!
6 months ago
dr7ana ea614ed141 better! 6 months ago
dr7ana cef2ff7782 Local router mode
- Up and running locally, no connections yet
- Next: flip testnet and do the gosh dang thing
6 months ago
dr7ana 70e9c1ae25 trust model fetch fails
- bootstrap cooldown implemented with 1min timer in case all bootstraps fail
- set comparison implemented in non-initial and non-bootstrap rc fetching; set comparison in rid fetching is done every fetch
- nodedb get_random functions refactored into conditional/non-conditional methods. Conditional search implements reservoir sampling for one-pass accumulation of n random rcs
6 months ago
Thomas Winget ad9d0b19c1 remove rc_lookup_handler, relocating useful parts
RC "lookup" is being replaced with "gimme all recently updated RCs".  As
such, doing a lookup on a specific RC is going away, as is network
exploration, so a lot of what RCLookupHandler was doing will no longer
be relevant.  Functionality from it which was kept has moved to NodeDB,
as it makes sense for that functionality to live where the RCs live.
6 months ago
dr7ana 28047ae72f
Merge pull request #2223 from tewinget/path-build-correctly
onion encrypt path build frames
6 months ago
dr7ana e58e8473f8
Merge pull request #2216 from tewinget/path-messages
Path build and onioned messages
6 months ago
Thomas Winget 2e5c856cf3 onion encrypt path build frames
path build frames should be onioned at each hop to avoid a bad actor
controlling two nodes in a path being able to know (with certainty,
temporal correlation is hard to avoid) that they're hops on the same
path.  This is desirable as in the worst case someone could be your edge
hop and terminal hop on a path, and now the terminal hop knows your IP
making the path basically pointless.
6 months ago
Thomas Winget d7e2e52ee4 messages::status -> messages 6 months ago
Thomas Winget bd4f239aa3 preconstructed dicts for error/timeout/ok
also move messages' statuses into their own namespace
7 months ago
Thomas Winget 32395caec1 build fixes, clang-format, minor touch-ups 7 months ago
Thomas Winget 9e9c1ea732 chahca nonce size is 24 bytes
Lots of code was using 32-byte nonces for xchacha20 symmetric
encryption, but this just means 8 extra bytes per packet wasted as
chacha is only using the first 24 bytes of that nonce anyway.

Changing this resulted in a lot of dead/dying code breaking, so this
commit also removes a lot of that (and comments a couple places with
TODO instead)

Also nounce -> nonce where it came up.
7 months ago
Thomas Winget abb2f63ec6 path control message response status changes
change path control message inner message response to take just a
string, which will be a bt-encoded response with an early key for
status.  If there is a timeout we pass a bt dict that only has that as
the status, else the response we de-onioned should have either an OK
status or some other error.

change messages to use new status key

correctly call Path::EnterState on path build response
7 months ago
Thomas Winget b0fb194e2c path control messages and onioning fleshed out
- control messages can be sent along a path
- the path owner onion-encrypts the "inner" message for each hop in the
  path
- relays on the path will onion the payload in both directions, such
  that the terminal relay will get the plaintext "inner" message and the
  client will get the plaintext "response" to that.
- control messages have (mostly, see below) been changed to be invokable
  either over a path or directly to a relay, as appropriate.

TODO:
  - exit messages need looked at, so they have not yet been changed for
    this
  - path transfer messages (traffic from client to client over 2 paths
    with a shared "pivot") are not yet implemented
7 months ago
Thomas Winget c25ced50a3 path build message handling mostly finished
there are a few TODOs which merit further discussion
7 months ago
dr7ana 5a628007e1 A soothing re-nomenclatura 7 months ago
dr7ana fa4471f566 {Remote,Local}RC's
- RemoteRC supplants most of the functionality throughout the code of RouterContact
- Next step will be to sort out CI issues, then see if we can get rid of either LocalRC (and therefore RouterContact entirely)
7 months ago
dr7ana 07271f9ae7 RC refactor layout
- Local and Remote RC's now implemented with discrete functionalities and uses
7 months ago
dr7ana 46ad8d4058 Clang format include sorting + CMake
- includes are now sorted in consistent, logical order; first step in an attempt to fix the tomfoolery (no relation to Tom) brought in by include-what-you-use
- shuffled around some cmake linking to simplify dependency graph
- superfluous files removed
7 months ago
Jason Rhinelander f4f5ab0109 "Refactor" aka delete Crypto/CryptoManager
- Get rid of CryptoManager.
- Get rid of Crypto.
- Move all the Crypto instance methods to llarp::crypto functions.
  (None of them needed to be methods at all, so this is simple).
- Move sodium/ntru initialization into static initialization.
- Add llarp::csrng, which is an available llarp::CSRNG instance which is
  a bit easier than needing to construct a `CSRNG rng{};` in various
  places.
- Various related small simplifications/cleanups.
7 months ago
dr7ana e710cfea47 Review commit 7 months ago
dr7ana 0e451db77f Compilation fixes
- almost all errors have been commented out for refactor or already refactored
- committing this prior to sorting out the cmake structure
- upcoming include-what-you-use application
7 months ago
dr7ana 41312abab0 introset and message transmission underway
- message handling through classes that inherit from PathSet
- cleanups around link_manager
- etc etc
7 months ago
dr7ana e4315cdc69 More message handling underway 8 months ago
dr7ana 6b1e3fbbc0 Touched up path build message handling 8 months ago
dr7ana 577f5e61ea De-mutexing
- mutexes in nodedb and rc_lookup_handler removed
- implemented thread-safe queueing to event loop for previously locked accesses
8 months ago
dr7ana 5ccec24470 callsafe
- Added call_get to ev.hpp to queue event loop operations w/ a return value
- de-mutexed NodeDB and made all operations via event loop. Some calls to NodeDB methods (like ::put_if_newer) were wrapped in call->get's, but some weren't. All function bodies were using mutex locks
8 months ago
Thomas Winget 2cc02d7b60 handle path build requests, generate responses 8 months ago
dr7ana 65bd224cf0 Exit endpoints implemented
- free standing functions in link_manager
- sign and serialize functionalities siloed in llarp/messages/exit.hpp
8 months ago
dr7ana 4ed6a01e02 following up before Tom meeting 8 months ago
Thomas Winget f35f7fe3f2 refactor path build message construction, no more async nonsense 8 months ago
dr7ana 206bd0b85e wawaweewa 8 months ago
dr7ana 1a9f977208 Message method implementation continued
- tons of surrounding stupid refactoring required
8 months ago
dr7ana d9ead7d0f6 crypto and message encoding
- libsodium calls streamlined and moved away from stupid typedefs
- buffer handling taken away from buffer_t and towards ustrings and strings
- lots of stuff deleted
- team is working well
- re-implementing message handling in proper link_manager methods
8 months ago
dr7ana aaf688cf81 Deleted a lot
- RIP llarp/iwp/* and most of llarp/link
9 months ago
dr7ana fd527d612f Carving through llarp/link 9 months ago
dr7ana 7f8207d5d3 Nuked superfluous interface classes
RIP:
- i_link_manager
- i_outbound_message_handler
- i_gossiper
- i_outbound_session_maker
- i_rc_lookup_handler
9 months ago
dr7ana a921575c55 mein gott 9 months ago
Jeff Becker 4508c59cd3
redo includes to be consistent 1 year ago
Jason Rhinelander b6924f3ef1
Replace duration/timestamp formats with functions
We're defining formats for std::chrono types, which feels wrong (because
fmt itself also has these), so just replace them with functions:

short_time_from_now(...) gives a short "in 14m12s" or "5.123s ago" time
span relative to now, given a time point.  Precision gets reduced for
larger deviations from now (e.g. "4h12m ago").

ToString(Duration_t) gives a string such as "-3h22m02.123s" for a
duration.
2 years ago
Jason Rhinelander d011f8fb4a
Bump clang-format to 14 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 38a157808e Cache best paths determined by GetPathByRouter to reduce cpu usage 2 years ago
Jeff Becker ea3276333a
on path timeout look up each router, if the lookup fails then we remove it from nodedb and close any connections to it so that bad first hops are rotated off of. 3 years ago
Jeff Becker 6a3dc67e9b
nuke from orbit style router profiling for path build timeouts.
* when a path build times out, shitlist every router in the path except the first hop, this way eventually we get the nodedb pruned to only the routers that are currently actually alive, any ones we nuke that we need later we can always do lookups for.
3 years ago
Jeff Becker e4ed53224c
use weak_ptr on a path to reference its parent pathset instead of a bare pointer so crashes dont happen 3 years ago
Jeff Becker a86152e03c
decay path build limiter per path builder every tick 3 years ago
Jeff Becker 23a82c493f
* don't include failed at when we are the pivot router as that case never happens.
* mark paths as ingored instead of expired when we stop a path builder
* only remove path builder when we have no established paths
3 years ago