Commit graph

11 commits

Author SHA1 Message Date
Jason Rhinelander 4a514a107e Add SQLiteCpp
This is a nice C++ wrapper that cleans up the data interface
considerably over using the C sqlite3 API.

I also evaluated (and started implementing) sqlite_orm for this, but ran
into considerable obstacles: the orm components get in the way without
being good enough to really solve anything (and essentially just making
you write queries in C++ code that is much less elegant than straight
queries), plus it fundamentally doesn't support threaded operation,
which sucks.
2021-06-16 18:59:17 -03:00
Jason Rhinelander c01c129700 Build static jemalloc 2021-06-16 18:59:06 -03:00
Jason Rhinelander 9c63efceff Add check for up-to-date submodules 2021-06-16 18:59:06 -03:00
Jason Rhinelander c079b288b8 Convert unit tests to Catch2
It is much nicer than boost or gtest, especially when running tests, and
is what we use very successfully in oxenmq and lokinet for unit tests.
2021-06-16 18:59:06 -03:00
Jason Rhinelander 3ad1ea6c7c Remove boost beast & many intertwined changes
- Replace boost beast http(s) client code with cpr (same as used in
oxen-core and lokinet)

- Replace bootstrap http requests with encrypted/authenticated omq rpc
requests to the bootstrap nodes (rather than unauthenticated,
unencrypted http connections).

- Remove boost::asio

- Remove boost circular buffer; a regular map with a two-line trimming
code is simpler for block hash cache, and a limit on stored snodes
doesn't seem necessary for the rate limiter.

- Make rate_limiter clean itself periodically; currently it only cleans
once it reaches max clients (i.e. 10k).

- Make rate_limiter thread safe, plus various code cleanups/DRYing.

- Remove ip_utils; we now longer really need a check for public ip for
proxy requests because we are sufficiently restrictive on the proxy url
target that we are unlikely to be able to reach anything sensitive (and
we also don't allow redirects).

- Replace /swarms/ping_test_v1 with /ping_test/v1; this new request now
returns the remote pubkey in a header, and no longer includes an SSL
cert signature (so that we can drop the SSL cert signatures after HF19).
The old one will still be used until HF19.

- Add OMQ endpoint for storage tests; it gets used instead of the https
one at HF19.

- Refactor storage test retries into request_handler (needed so both
legacy and omq endpoints can use it).

- Fix HF18 swarms/storage_test endpoint which was missing the snode
signature required for current SS versions to accept the response.

- Move HTTPS server-specific code (validate_snode_signature) out of
RequestHandler into HTTPSServer

- Make onion proxy-to-url timeout a bit less than the onion request
timeout so that the client has a better chance of actually getting a
timeout error.

- Miscellaneous cleanups

- Remove pre-HF18 compatibility code.

- Remove `process_lns_request` onion request target: it was accidentally
broken in HF18; clients are now using an oxend rpc request proxy to
`ons_resolve` instead.

- Shorten timeout values for ping and storage tests (5s and 15s,
respectively) and bootstrap connections (now 10s instead of 60s).
2021-06-16 18:59:06 -03:00
Jason Rhinelander 3196e07037 Rename lmq -> omq internally 2021-06-16 18:59:05 -03:00
Jason Rhinelander 1918c7f111 Replace boost::beast with uWebSockets
uWebSockets is very fast, has a much nicer interface than boost::beast,
and is currently used for handling all http rpc requests in oxen-core.

As part of this:

- Remove net stats singleton; it was very granular -- just number of
  http connections established with no indication of what type of
  connections (e.g. snode-to-snode or client) those are.  Will think
  about reintroducing some less granular stats gathering in the future
  if we need them.
- Update oxenmq to dev branch (for new cancellable timer support)
- move boost asio io_context into ServiceNode rather than main (and
  expose it publicly)
- add signal handler and shutdown logic
- remove long-deprecated (and non-functional) detection of long-poll
  headers
- import string_utils.h from oxen-core (for durations, int parsing,
  etc.); we already had *some* of this code with copies of
  starts_with/ends_with/join.
- import file.hpp from oxen-core (for file slurping)
- move more request logic into request_handler
- move common http types/values into `oxen::http` namespace (e.g. status
  codes, header names)
2021-06-16 18:58:53 -03:00
Jason Rhinelander 409dff7b49 Replace embedded nlohmann with updated submodule
The embedded nlohmann (3.6.1) is fairly old and has bugs that causes
compilation problems under gcc-10.  Switch to a submodule (as with most
of the other vendored libs) and updated to the latest version.

Also switch it to multi-header include mode so that we can use the tiny
json_fwd header in headers rather than the full include.
2021-01-05 17:27:32 -04:00
Jason Rhinelander 43ed24ce4e Change submodule path to use https
git@github.com won't work without having a github account with
registered ssh keys.
2020-03-16 01:07:34 -03:00
Maxim Shishmarev 330581b0d4 Initial lokimq integration. Onion requests to SS. 2020-03-08 21:38:51 +11:00
Maxim Shishmarev 17f31207c7 add spdlog 2019-06-24 18:05:48 +10:00