1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
Commit graph

192 commits

Author SHA1 Message Date
Stephen Shelton 6e1a23cdc7
Use pkg_check_modules instead of find_package for sqlite3 2020-07-02 10:22:05 -06:00
Stephen Shelton 4aa6f8e2df
Use find_package() for sqlite3 2020-07-02 10:22:04 -06:00
Stephen Shelton 8adb6295fc
Initialize sqlite_orm and start interacting with it 2020-07-02 10:12:13 -06:00
Stephen Shelton 73c9ddff52
Begin peer stats infrastructure 2020-07-02 10:12:11 -06:00
Jason Rhinelander a7c42ab2bd
Use lokimq's hex/base32z encoding/decoding 2020-07-02 11:13:31 -04:00
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 2020-07-02 11:07:34 -04:00
Jeff Becker a42d3d51c3
more 2020-07-02 11:07:33 -04:00
Jeff Becker 9bfff61d08
initial wack at lokimq 2020-07-02 11:07:32 -04:00
Stephen Shelton 17026a0b21
Remove libabyss and rpc::Caller/rpc::Server 2020-07-02 11:07:32 -04:00
Jeff Becker fb8b8e2e56
add stubs for lmq rpc server 2020-07-02 11:07:31 -04:00
Jeff Becker 0006751d80
initial wack at lokimq 2020-07-02 11:07:31 -04:00
Stephen Shelton 91725a8530
WIP: LokidRpcClient 2020-07-02 11:07:31 -04:00
Stephen Shelton 11951510bf
Remove libabyss and rpc::Caller/rpc::Server 2020-07-02 11:07:30 -04:00
Thomas Winget 32843510bb libunbound can now be built as a static dep 2020-06-15 18:44:59 -04:00
Thomas Winget df284cb757 proper CMake finding and using of libunbound 2020-06-15 18:32:57 -04:00
Thomas Winget c2a30692cf Implement upstream DNS using libunbound 2020-06-15 18:32:57 -04:00
Jason Rhinelander 7f9160bb6e Untangle some interdependencies
macOS doing a shared library build is not working without untangling
some of the interdependencies.  This commit does that, at least enough
to get macOS to compile.

This isn't the cleanest as currently implemented (we have some net/
things in `liblokinet-platform` and some in `liblokinet`, and likewise
ev/vpnio.cpp is in `liblokinet` while the rest of `ev/*` is in
`liblokinet-platform`).
2020-05-20 19:18:28 -03:00
Jason Rhinelander bdc9c7bfa8 Move IPRange out of net.hpp; free up TruncateV6 etc.
- Move IPRange into its own net/ip_range.hpp

- Move the static net::IPPacket::TruncateV6, etc. functions to free
net::TruncateV6, etc. functions (now from net/ip.hpp instead of
net/ip_packet.hpp).

- Make net::TruncateV6 and net::ExpandV4 constexpr.

- Add IPRange::FromIPv4 factory function (to replace the iprange_ipv4
free function)
2020-05-20 19:18:27 -03:00
Jason Rhinelander 72bf215da4 Move IPPacket header (part 1)
Rename net/ip.{cpp,hpp} to net/ip_packet.{cpp,hpp}.

(Doing this in two commits because I want to repurpose ip.hpp/ip.cpp,
and want git to figure out the history properly).
2020-05-20 19:18:27 -03:00
Jason Rhinelander 604501b07f Fix cmake curl definition 2020-05-18 23:49:30 -03:00
Jason Rhinelander 28362fd6a6 Clean up curl define
It doesn't have to be win32-specific, we could (for example) use this on
mac as well to build without curl/SN support.
2020-05-18 15:35:13 -03:00
Jason Rhinelander 856cf82c0e Only link curl if we set up a curl target
Should fix win32 (which doesn't link to curl).
2020-05-18 15:11:13 -03:00
Jason Rhinelander c5faa86926 cmake refactor
Refactors many things in cmake to improve and simplify:

- don't use variable indirection for target names; target names are
*already* a variable of sorts.  (e.g. ${UTIL_LIB} is now just
lokinet-util).  cmake/basic_definitions.cmake is now gone.

- fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather
than shoving a bunch of flag hacks through link_libraries and
add_compile_options.  This also now enables LTO when building a shared
library (because previously the -flto hacks were only turned on in the
static code for some reason).

- build liblokinet as *either* shared library or static library, but not
both.  Building both makes things more complicated because they had
different names (lokinet-shared or lokinet-static) and seems pointless:
you generally want one or the other.  Now there is just the liblokinet
target, which will be shared or static depending on the value of
BUILD_SHARED_LIBS.

- Simplify lokinet-cryptography AVX2 code: just build *one* library, and
add in the additional AVX2 files when possible, rather than building two
and needing to merge them.

- Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK.
It makes no sense to use one of these (_RUNTIME) on Windows and the
other on non-Windows when they appear to try to do the same thing.

- remove a bunch of annotations from `endif(FOO)` -> `endif()`.

- move all the tuntap compilation code (including OS-specific source
file selection) into vendor/CMakeLists.txt and build tuntap as an
intermediate OBJECT library rather than keeping a global variable in 5
different files.

- move release motto define to root cmake; it made no sense being
duplicated in both unix.cmake and win32.cmake

- fix add_log_tag to not stomp on any existing source compile flags with
its definition.  Also use proper compile definition property instead of
cramming it into compile flags.

- make optimization/linker flags less hacky.  There's no reason for us
to force particular optimization flags because the cmake build type
already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3).  Not doing
that also silences a bunch of cmake warnings because it thinks "-O0 -g3"
etc.  are link libraries (which is reasonable: that's what the code was
telling cmake they are).

- sets the default build type to RelWithDebInfo which gives us `-O2 -g`
if you don't specify a build type.

- Move PIC up (so that the things loaded in unix.cmake, notably libuv,
have it set).

- Add a custom `curl` interface library that carries the correct link
target and include paths for curl (system or bundled).
2020-05-17 23:31:23 -03:00
Stephen Shelton 0b54087689
Begin implementing SockAddr 2020-05-08 11:23:21 -06:00
Stephen Shelton 1cab83ad01
Expand upon IpAddress header, take in feedback 2020-05-04 15:36:08 -06:00
Stephen Shelton 93b35c92a7
Eradicate service::Config 2020-05-04 11:05:51 -04: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 6fd270ba09
Rip out link type spec and factory
We only support IWP now, so this is all effectively dead code.
2020-04-07 14:22:53 -06:00
Stephen Shelton 5b520a4dff
Simplify connection limit constants 2020-04-07 14:13:27 -06:00
Stephen Shelton 0fb888890f
First pass at Configuration definition classes 2020-04-07 14:01:41 -06:00
Jeff Becker 4375df2f7d
add forgotten files for generating docs 2020-04-07 13:16:22 -04:00
Jeff Becker 3e7acb72e1
more docs, make doxygen work 2020-04-07 13:16:22 -04:00
Stephen Shelton 8a12da8bd5
Remove some .cpp files related to RouterEvents
The motivation is to reduce the raw amount of code required to create
and maintain events.
2020-03-12 13:51:57 -06:00
Thomas Winget c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 2020-03-03 19:57:09 -05:00
Thomas Winget 88c80dc2ee add cxxopts to shared_lib dependencies 2020-03-03 19:57:09 -05:00
Jeff Becker e7689b40a7 dht pub intro message router event thiny doo 2020-03-03 19:57:09 -05:00
Thomas Winget f712acc486 huzzah it builds, time to test soon! 2020-03-03 19:57:09 -05:00
Jeff Becker da79b14703 make it compile 2020-03-03 19:57:09 -05:00
Thomas Winget 8dc5dabe49 working toward compilation, still has include issue 2020-03-03 19:57:09 -05:00
Jeff Becker 1fdb8b4c94 initial pybind11 introspection code 2020-03-03 19:57:09 -05:00
Jeff Becker f4520ac920
make decaying hashset use llarp::Time_t and move unit tests to use catch2 2020-02-24 15:22:49 -05:00
Jason Rhinelander 0839c16f19 Final abseil purge
Bye-bye Google Boost.
2020-02-24 14:27:44 -04:00
Jason Rhinelander 54186c4a89 Replace absl string_view with string_view from lokimq
When we add loki-mq has a dependency we can just alias it, but for now
it's easier to copy the header than add the whole submodule library.
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 f84ce61d66 Removed empty cpp files
These aren't needed: CMake already knows how to follow #includes and
rebuild when headers change as long as the headers are included
*somewhere*.  The extra .cpp files here just require building a bunch of
.cpp files with just header content that we just end up throw away
during linking (since the same things will also be compiled in whatever
other compilation units include the same headers).
2020-02-21 23:39:11 -04:00
Jason Rhinelander fe61367a87 Vastly simplified llarp::util::memFn
There is a huge pile of unnecessary machinery here that can be solved
with a few lambdas and some member function pointer type deduction.
2020-02-21 23:24:33 -04:00
Jason Rhinelander b4440094b0 De-abseil, part 2: mutex, locks, (most) time
- util::Mutex is now a std::shared_timed_mutex, which is capable of
  exclusive and shared locks.

- util::Lock is still present as a std::lock_guard<util::Mutex>.

- the locking annotations are preserved, but updated to the latest
  supported by clang rather than using abseil's older/deprecated ones.

- ACQUIRE_LOCK macro is gone since we don't pass mutexes by pointer into
  locks anymore (WTF abseil).

- ReleasableLock is gone.  Instead there are now some llarp::util helper
  methods to obtain unique and/or shared locks:
    - `auto lock = util::unique_lock(mutex);` gets an RAII-but-also
      unlockable object (std::unique_lock<T>, with T inferred from
      `mutex`).
    - `auto lock = util::shared_lock(mutex);` gets an RAII shared (i.e.
      "reader") lock of the mutex.
    - `auto lock = util::unique_locks(mutex1, mutex2, mutex3);` can be
      used to atomically lock multiple mutexes at once (returning a
      tuple of the locks).
  This are templated on the mutex which makes them a bit more flexible
  than using a concrete type: they can be used for any type of lockable
  mutex, not only util::Mutex.  (Some of the code here uses them for
  getting locks around a std::mutex).  Until C++17, using the RAII types
  is painfully verbose:

  ```C++
  // pre-C++17 - needing to figure out the mutex type here is annoying:
  std::unique_lock<util::Mutex> lock(mutex);
  // pre-C++17 and even more verbose (but at least the type isn't needed):
  std::unique_lock<decltype(mutex)> lock(mutex);
  // our compromise:
  auto lock = util::unique_lock(mutex);
  // C++17:
  std::unique_lock lock(mutex);
  ```

  All of these functions will also warn (under gcc or clang) if you
  discard the return value.  You can also do fancy things like
  `auto l = util::unique_lock(mutex, std::adopt_lock)` (which lets a
  lock take over an already-locked mutex).

- metrics code is gone, which also removes a big pile of code that was
  only used by metrics:
  - llarp::util::Scheduler
  - llarp:🧵:TimerQueue
  - llarp::util::Stopwatch
2020-02-21 23:22:47 -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
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 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