Commit Graph

33 Commits

Author SHA1 Message Date
dan dc7f3cee22 Replace cxxopts with CLI11
- Simiplifies CLI code for future modification
- filesystem library linked in cmake check_for_std_filesystem file
2023-01-06 15:04:14 -08:00
jeff 181de210cd Build apple/macos GUI from lokinet project
This adds the gui as a submodule, and consolidates the GUI handling a
bit between the two platforms.
2022-08-12 21:13:39 -03:00
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).
2022-07-15 22:17:59 -03:00
Jeff 0d0295e2dc
remove unneeded submodule 2022-05-25 16:42:10 -04:00
Jason Rhinelander d02558350a
Crank oxen-mq to (1.2.)11; switch to oxen-encoding
- Update oxen-mq submodule to latest stable
- Add oxen-encoding submodule
- Convert all oxenmq encoding usage to oxenc
- Modernize cmake handling of oxenmq/oxenc
2022-02-17 16:30:17 -04:00
Jeff 95efe8f4e5 bump ngtcp2 to v0.1.0 tag 2022-01-31 13:05:03 -05:00
Jason Rhinelander d90b28ce24 Remove double cpr submodule
Fix cpr being listed twice in .gitmodules and submodule check.
2021-06-01 10:49:38 -03:00
Jeff Becker ebdb9699c0
refactor: make lokinet-bootstrap a native executable
* pull in cpr
* tidy up windows.sh
* rename main.cpp to lokinet.cpp to satisfy my autism
* add llarp::GetDefaultBootstrap()
2021-04-19 07:06:15 -04:00
Jason Rhinelander 442fa951fc
Add ngtcp2 submodule 2021-04-19 06:56:26 -04:00
Jeff Becker 0c37cc7f60
lokinet-bootstrap native binary 2021-04-15 13:39:45 -04:00
Jason Rhinelander ced035d401 Switch uvw to a fork with libuv backwards compat support 2021-03-04 16:51:18 -04:00
Jason Rhinelander 5b555ee5aa Replace libuv with uvw & related refactoring
- removes all the llarp_ev_* functions, replacing with methods/classes/functions in the llarp
  namespace.
- banish ev/ev.h to the void
- Passes various things by const lvalue ref, especially shared_ptr's that don't need to be copied
  (to avoid an atomic refcount increment/decrement).
- Add a llarp::UDPHandle abstract class for UDP handling
- Removes the UDP tick handler; code that needs tick can just do a separate handler on the event
  loop outside the UDP socket.
- Adds an "OwnedBuffer" which owns its own memory but is implicitly convertible to a llarp_buffer_t.
  This is mostly needed to take over ownership of buffers from uvw without copying them as,
  currently, uvw does its own allocation (pending some open upstream issues/PRs).
- Logic:
  - add `make_caller`/`call_forever`/`call_every` utility functions to abstract Call wrapping and
    dependent timed tasks.
  - Add inLogicThread() so that code can tell its inside the logic thread (typically for
    debugging assertions).
  - get rid of janky integer returns and dealing with cancellations on call_later: the other methods
    added here and the event loop code remove the need for them.
- Event loop:
  - redo everything with uvw instead of libuv
  - rename EventLoopWakeup::Wakeup to EventLoopWakeup::Trigger to better reflect what it does.
  - add EventLoopRepeater for repeated events, and replace the code that reschedules itself every
    time it is called with a repeater.
  - Split up `EventLoop::run()` into a non-virtual base method and abstract `run_loop()` methods;
    the base method does a couple extra setup/teardown things that don't need to be in the derived class.
  - udp_listen is replaced with ev->udp(...) which returns a new UDPHandle object rather that
    needing gross C-style-but-not-actually-C-compatible structs.
  - Remove unused register_poll_fd_(un)readable
  - Use shared_ptr for EventLoopWakeup rather than returning a raw pointer; uvw lets us not have to
    worry about having the event loop class maintain ownership of it.
  - Add factory EventLoop::create() function to create a default (uvw-based) event loop (previously
    this was one of the llarp_ev_blahblah unnamespaced functions).
  - ev_libuv: this is mostly rewritten; all of the glue code/structs, in particular, are gone as
    they are no longer needed with uvw.
- DNS:
  - Rename DnsHandler to DnsInterceptor to better describe what it does (this is the code that
    intercepts all DNS to the tun IP range for Android).
- endpoint:
  - remove unused "isolated network" code
  - remove distinct (but actually always the same) variables for router/endpoint logic objects
- llarp_buffer_t
  - make constructors type-safe against being called with points to non-size-1 values
- tun packet reading:
  - read all available packets off the device/file descriptor; previously we were reading one packet
    at a time then returning to the event loop to poll again.
  - ReadNextPacket() now returns a 0-size packet if the read would block (so that we can implement
    the previous point).
  - ReadNextPacket() now throws on I/O error
- Miscellaneous code cleanups/simplifications
2021-03-04 16:51:18 -04:00
Jeff Becker 60bfdacc23
get rid of the rest of gtest/gmock 2021-03-04 15:41:53 -05:00
Jeff Becker 979a652446
loki-mq -> oxen-mq 2021-03-01 07:57:57 -05:00
Jeff 0ed8942dc6
libuv cmake fixups (#1511)
* fix up cmake parts for libuv
* make libuv use external project via StaticBuild.cmake
* remove libuv submodule
2021-01-16 19:11:28 -05:00
Stephen Shelton 73c9ddff52
Begin peer stats infrastructure 2020-07-02 10:12:11 -06:00
Jeff Becker 9bfff61d08
initial wack at lokimq 2020-07-02 11:07:32 -04:00
Stephen Shelton 0c0deb0656
Add loki-mq as submodule 2020-07-02 11:07:32 -04:00
Jeff Becker 0006751d80
initial wack at lokimq 2020-07-02 11:07:31 -04:00
Stephen Shelton c67db46b12
Add loki-mq as submodule 2020-07-02 11:07:30 -04:00
Jason Rhinelander be9ddf2ae1 Bring back ghc::filesystem for broke AF macos
macOS doesn't provide `<filesystem>` support when targetting anything
earlier than 10.15.
2020-05-20 19:18:27 -03:00
Jeff Becker 64157d5d44 track libcurl and libuv with cmake, add libuv submodule 2020-05-17 14:53:28 -03: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 dba9ffe061
Add 'clang-format-hooks' submodule
This submodule provides git hooks which invoke clang-format
in intelligent ways.
2020-04-07 12:36:40 -06:00
Jeff Becker d0b909f881 use stable branch in submodule 2020-03-03 19:57:09 -05:00
Jeff Becker fc0dfb6e3d add submodule 2020-03-03 19:57:09 -05:00
Jason Rhinelander 0839c16f19 Final abseil purge
Bye-bye Google Boost.
2020-02-24 14:27:44 -04:00
Jason Rhinelander 2e9840ea39 Replace abseil date code with Hinnart's date.h
Howard Hinnart's date.h is the library that was accepted as C++20
date/calendar support, so this is essentially a backport of C++20 date
time support.

(It does support timezone support, but requires more of the library and
that seems like overkill for what we need; this just prints UTC
timestamps instead, which need only a header-only include).
2020-02-24 14:27:44 -04: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 827ca0bda7
make catch2 a submodule 2020-02-17 08:26:20 -05:00
Jason Rhinelander c522bc0537 ghc::filesystem devendor to submodule
Also removed some unused/old options for conditionally not using
ghc::filesystem and a sodium option that wasn't used anywhere.
2020-02-13 15:47:11 -04:00
Jason Rhinelander 3df4eaef2d Devendor cxxopts to submodule 2020-02-13 15:18:17 -04:00
Jason Rhinelander 5a787de73b Switch abseil & nlohmann to submodules and update to latest stable
Our current abseil won't build with gcc 10 (its `optional`
implementation appears broken), and spews warnings under slightly older
compilers; updating to the latest stable 2019 branch fixes both issues.
2020-02-13 15:14:17 -04:00