Commit Graph

66 Commits (b81f7025c9a619409bb1c3f39e0c56e2084fd7be)

Author SHA1 Message Date
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 33a2226079
footcannon prevention: check for invalid address family.
throw if we pass in a bogus af value when getting a sockaddr for all interfaces
2 years ago
Jeff 98b3860655
set source ip on service nodes for outbound link to not use all interfaces 2 years ago
Jeff Becker 6c70022dcc
check for intersecting ip ranges correctly, add unit test 3 years ago
Jeff Becker d750f68328
prepare for ipv6 on android
* remove 21/8 from ipv4 bogon ranges as it is being sold by DoD
* start adding ipv6 bogon ranges
3 years ago
Thomas Winget 7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
3 years ago
Jason Rhinelander 91d6698a9d Reformat with clang-format-11 3 years ago
Jason Rhinelander d995766436 Android & hive fixes 3 years ago
Thomas Winget 4c630e0437 Large collection of changes to make android work
- Previous android java and jni code updated to work, but with much love
  still needed to make it work nicely, e.g. handling when the VPN is
  turned off.

- DNS handling refactored to allow android to intercept and handle DNS
  requests as we can't set the system DNS to use a high port
  (and apparently Chrome ignores system DNS settings anyway)

- add packet router structure to allow separate handling of specific
  intercepted traffic, e.g. UDP traffic to port 53 gets handled by our
  DNS handler rather than being naively forwarded as exit traffic.

- For now, android lokinet is exit-only and hard-coded to use exit.loki
  as its exit.  The exit will be configurable before release, but
  allowing to not use exit-only mode is more of a challenge.

- some old gitignore remnants which were matching to things we don't
  want them to (and are no longer relevant) removed

- some minor changes to CI configuration
3 years ago
Jason Rhinelander 56cbef6086 SockAddr fixes and cleanups
- Remove SIIT from method names & comments because we're doing IPv4
mapped addresses (::ffff:0:0/96) rather than actual SIIT
(::ffff:0:0:0/96).

- add constructor taking a string+numeric port (and then don't allow a
port in the string).

- simplify IP string parsing by using parse_int()

- replace addrIsV4 with call to ipv6_is_mapped_ipv4 (this also fixes a
bug where addrIsV4 was not checking for leading 0s and so could return
true for a public IPv6 that happened to have ffff in the wrong spot).
3 years ago
Jeff Becker bb9bd25059
get rid of use of llarp::IpAddress from hotpaths 3 years ago
Jeff Becker 0600f42814
fix up names of functions to be less hidious. 3 years ago
Jeff Becker bd93a8f828
initial v6 exits 3 years ago
jeff 52d20968a7 remove llarp::StrEq 4 years ago
Jeff Becker d7ff6c579c
address feedback from jason
* split up ipv6 netmask
* revert iwp ack interval change
* c++17-isms in ip range map
* lambda-ize nodedb
* mutable lambdas in transit hops
* perfect forwarding of args in abstract router
* mutable lambdas in lokid rpc client
* notes in readme about nproc
4 years ago
Jeff Becker 0f21eeccb0
* rework exit codepath to allow multiple exits
* rework net code for ip ranges to be cleaner
* clean up endpoint auth code
* refactor config to validate network configs before setting up endpoints
* remove buildone from path/pathbuilder.cpp so we don't spam connection attempts
4 years ago
Jeff Becker f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 4 years ago
Jeff Becker 6af498092b
exit traffic via loki addresses 4 years ago
Jason Rhinelander 3bb24580a4 make format 4 years ago
Jason Rhinelander f9bbc30c3d IsIPv4Bogon: constexpr array instead of a function-local static vector
The fixed-size array + not needing to do an atomic operation in the
function should allow better compiler optimization.

(And with C++17 the type and size are inferred).
4 years ago
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)
4 years ago
Stephen Shelton 0cd5d7a060
Derp 4 years ago
Stephen Shelton cd44caccaf
Attempt to get this SockAddr refactor up and running 4 years ago
Stephen Shelton 0b54087689
Begin implementing SockAddr 4 years ago
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 4 years ago
Jeff Becker 7e4fdc5b0e
check for zero address for bogons 4 years ago
Jeff Becker f1edca9fa1
additional cleanup of cruft 4 years ago
Jeff Becker e33a1a2e0f
proper autodetect of ifname and ifaddr 4 years ago
Rick V df634b7775
remove a ton of ded win32 code 4 years ago
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
4 years ago
Jason Rhinelander 0839c16f19 Final abseil purge
Bye-bye Google Boost.
4 years ago
Jeff Becker a96fd645c5
remove side effect from address detection assert 4 years ago
Jeff Becker c9d38d421b clang fixes 5 years ago
Jeff Becker ac686a9329
remove valgrind access errors 5 years ago
Rick V df29052a75
fix windows 5 years ago
jeff 1621ca676b Merge remote-tracking branch 'upstream/dev' into ed25519-signing 5 years ago
jeff 1e3cd03880 make format 5 years ago
Stephen Shelton 7dc1351eba Add missing #endif (presumably from 281fbff) 5 years ago
jeff 265da6f37b use get_service_nodes rpc endpoint 5 years ago
jeff 0e2fb6abd5 revert to ed25519 for signing, this breaks everything (again). 5 years ago
Jason Rhinelander 281fbff42f Fix build on xenial
- xenial's cmake version (3.5.1) builds everything fine and test suite
  passes, so lower the minimum to that.

- add a hack for xenial's kernel header & glibc version breaking if both
  net/if.h and linux/if.h get included.  The only thing we actually need
  from net/if.h that linux/if.h doesn't have is `if_nametoindex`, so
  just hack that definition in for xenial's specific glibc/kernel header
  versions.
5 years ago
jeff 32ed821763 Merge remote-tracking branch 'upstream/dev' into multithreaded-cryptography 5 years ago
Rick V ed6ef2d527
clang-format 5 years ago
Rick V cbdbe94bab
skip null adapters 5 years ago
Rick V ade2ae1e9a
ok let's see how we're locked up
more debug
5 years ago
Rick V 4389e3fee2
try install .net manually
use full path

test
5 years ago
Jeff Becker da6a3bf9bb
Merge remote-tracking branch 'origin/master' into iwp-multi-ack 5 years ago
Jeff Becker fd787cc56d
try more ranges 5 years ago
Jeff Becker 1adae338ce
Merge remote-tracking branch 'origin/master' 5 years ago
Michael 1aec0dfa2b
Move logging to subdirectory 5 years ago