Commit Graph

491 Commits

Author SHA1 Message Date
Jason Rhinelander
86fd77733e
Add missing header to fix libc++ build 2022-07-18 17:23:35 -03:00
Jason Rhinelander
784f2938f1
Use more fmt 2022-07-18 17:13:04 -03:00
Jason Rhinelander
eec8244a6c
Remote util::Printer and related cruft 2022-07-18 14:56:09 -03:00
Jason Rhinelander
2f9e182b20
Avoid ctor inheritance to make diagnostics better
Using constructor inheritance DRYs the code, but unfortunately confuses
GCC as to where the proper "required from here" location is, which makes
debugging formatting errors very difficult.  Avoid it (and update
oxen-logging to avoid it there as well).
2022-07-18 13:07:33 -03:00
Jason Rhinelander
c82ade2d81
Make test code work with new logging 2022-07-18 12:59:13 -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
Jason Rhinelander
43191ec100
Add missing header
Needed for uint_least32_t.
2022-07-15 21:51:32 -03:00
Jason Rhinelander
8c3d1b3281
Don't build empty cpp files
We shouldn't be compiling these .cpp files at all on other platforms,
rather than compiling empty .cpp files (which later results in "... has
no symbols" warnings).
2022-06-16 13:17:13 -03:00
Jeff
33a2226079
footcannon prevention: check for invalid address family.
throw if we pass in a bogus af value when getting a sockaddr for all interfaces
2022-05-27 13:26:30 -04:00
Jeff
60ada470db
format systemd status as time deltas from now 2022-05-27 13:21:09 -04:00
Jeff
18e1272c76
add gossip info to systemd status
* adds next and last gossip datetimes
* adds a few things for time points, like ostream operator overloads for time point
2022-05-27 13:21:08 -04:00
Jeff
3c44a06403
publish our rc out to the network when we regenerate them 2022-05-27 13:21:08 -04:00
Jeff
70b07bab44
clean up ip packet code 2022-05-18 17:18:31 -04:00
Jeff
14d75cc654
add util::ascending_priority_queue type 2022-05-02 15:27:08 -04:00
Jason Rhinelander
b09298e211
Replace llarp/util/endian.hpp with oxenc/endian.h 2022-04-28 12:09:51 -03: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
24681fd35d
Merge pull request #1759 from majestrate/iterate-dir-in-order-2021-10-06
iterate through directory entries in lexigraphical order
2021-10-06 15:15:26 -04:00
Jeff
1d955cf28d
Update fs.hpp
style nit
2021-10-06 14:37:09 -04:00
Jeff Becker
00f81b1dac
iterate through directory entries in lexigraphical order 2021-10-06 14:04:11 -04:00
Jeff Becker
d882f1a302
some compilers hated [[maybe_unused]] so use (void) when they are unused 2021-10-06 11:10:49 -04:00
Jeff Becker
cf187ddffc
fix up logging, put _log into anonynous namespace, make only log trace nop in release builds 2021-10-06 11:10:48 -04:00
Jeff Becker
7d07dea235
fix up gripes in source_location
* get rid of columns we dont need those
2021-10-06 11:10:48 -04:00
Jeff Becker
acdb8a19a6
for some reason [[maybe_unused]] is hated by buster 32 bit x86 so we do something else
to appease that compiler.
2021-10-06 11:10:48 -04:00
Jeff Becker
18c5b43e63
use inline source_location implementation for android too 2021-10-06 11:10:48 -04:00
jeff
0546dab2e3
make source location happy on macos
* because of course apple doesn't provide any implementation (lmao) we provide one ourself
2021-10-06 11:10:48 -04:00
Jeff Becker
5c457ff486
refactor logging to use std::source_location
* use std::source_location instead of godawful macros in logging
* remove unused/absolutely haram af json logstream
* fix bug in android logger where it doesn't respect eLogNone
2021-10-06 11:10:48 -04:00
Jason Rhinelander
9950adf472 Remove unneeded split(str, char) method
This function had a bug in stable (fixed in dev) when `last` returns
npos, but the function also appears to basically be duplicating what the
next split version can do, so this just removes it and uses the single
more generic split(strview, strview) method.
2021-08-11 00:26:52 -03:00
Jeff Becker
4f1bd14d3c
fix issue with excessively pedantic stl on archlinux 2021-07-06 08:54:39 -04:00
Jeff Becker
5c512601bf
use std::make_optional for backwards compat on older toolchains 2021-06-19 09:39:10 -04:00
Jeff Becker
719dd38cf5
more shit 2021-06-08 14:36:33 -04:00
Jeff Becker
2968caf7af
make default log level warn fixes #1593 2021-05-01 16:45:04 -04:00
Jeff Becker
e0185bab09
don't rehash decaying hashsets that is no bueno and probably leaks like the pipes in tom's apartment 2021-05-01 08:57:22 -04:00
Jeff Becker
b721b8d65b
finish wiring up config for #1595 2021-04-19 07:03:56 -04:00
Jeff Becker
fedc56e3f1
initial commit for #1595 2021-04-19 07:02:46 -04:00
Jeff Becker
1ea77e6a68
more client to snode quic fixes 2021-04-19 07:02:44 -04:00
Jeff Becker
b01e20b4cb
add forgotten file again 2021-04-19 07:02:44 -04:00
Jeff Becker
de1b0c9d14
add forgotten header 2021-04-19 07:00:27 -04:00
Jeff Becker
95cd275cdd
liblokinet additions:
* add lokinet_add_bootstrap_rc function for adding an rc from memory
* prevent stack overflow on error closing connection in quic
* add in memory nodedb
* refactor how convotags are set as active
* add initial stubs for endpoint statistics
* refactor time stuff to be a bit cleaner
* update lnproxy script with more arguments
2021-04-19 06:59:07 -04:00
Jeff Becker
708e408c30
various fixups and cleanups
* wire up last of the quic stuff
* clean up udp packet generation code
* pass EndpointBase not quic tunnel for quic stuff
* add {n,h}uint16_t::FromString
* add nuint_t::FromString
* make AlignedBuffer::IsZero non constant time call for speed
2021-04-19 06:58:37 -04:00
Jeff Becker
2360700911
add virtual default destructor to appease clang 2021-04-19 06:58:37 -04:00
Jeff Becker
8b95f9945a
fix compiler errors 2021-04-19 06:58:37 -04:00
Jeff Becker
58bec09232
fix compile error 2021-04-19 06:58:36 -04:00
Jason Rhinelander
d588f777c7
Fix logging of std::byte values
They were failing to compile if output because implicit integer
promotion doesn't work for std::byte's (but rather needs an explicit
std::to_integer call).
2021-04-19 06:58:36 -04:00
Jeff Becker
4446f2fc16
fix and format.
* start moving quic code to use lokinet internals
2021-04-19 06:57:46 -04:00
Jason Rhinelander
39d31df059
no-op LogTrace(); print chars as ints
- LogTrace() (and LogTraceTag, etc.) are now no-ops for release builds.
(hoping there are no side effects in trace logging!)
- renamed llarp::_Log to llarp::_log because _Log is a reserved keyword
- change logging code to implicitly convert 1-byte types (char, unsigned
char, uint8_t) to ints so that we print them as numeric values rather
than raw chars because, more often than not, printing a single char is
trying to log an 8-bit value.
2021-04-19 06:57:46 -04:00
Jason Rhinelander
b61bd82b4b
Add llarp::buffer_printer for pretty buffer logs 2021-04-19 06:57:46 -04:00
Jeff Becker
c92894804c
Merge remote-tracking branch 'origin/stable' into dev 2021-04-17 09:18:37 -04:00
Jeff Becker
a0d3ab125a
throw on failed writing and port fs namespace changes from oxen-core 2021-04-16 14:47:17 -04:00
Jeff Becker
7a1ffc2df4
* lessen replay filter window
* dont have transit hops use a replay filter
* formatting
2021-04-12 13:14:59 -04:00
Jeff
6bd53484da
Merge pull request #1541 from majestrate/lns-consensus-2021-02-19
lns lookup consensus
2021-03-26 19:24:29 -04:00