Commit Graph

63 Commits

Author SHA1 Message Date
dan 0632e88de0 Make new header for json type conversions 2023-02-01 15:52:37 -08:00
dan d3e69fe3c5 added unmapexit and listexit endpoints 2023-01-24 09:44:02 -08:00
dan d37398a915 review comments 2023-01-24 07:23:01 -08:00
dan 13b01c86a6 Updated RpcServer Initialization and Logic
-- Moved all RPCServer initialization logic to rpcserver constructor
    -- Fixed config logic, fxn binding to rpc address, fxn adding rpc cats
    -- router hive failed CI/CD resulting from outdated reference to rpcBindAddr
    -- ipc socket as default hidden from windows (for now)
refactored config endpoint
    - added rpc call script (contrib/omq-rpc.py)
    - added new fxns to .ini config stuff
    - added delete .ini file functionality to config endpoint
    - added edge case control for config endpoint

add commented out line in clang-form for header reorg later
2023-01-24 06:50:46 -08:00
drouhana 0edfe8ff83
IPC Socket Fixes (#2111)
* Updated RpcServer Initialization and Logic

-- Moved all RPCServer initialization logic to rpcserver constructor
-- Fixed config logic, fxn binding to rpc address, fxn adding rpc cats
-- router hive failed CI/CD resulting from outdated reference to rpcBindAddr
-- ipc socket as default hidden from windows (for now)
2023-01-20 14:15:18 -04:00
Jason Rhinelander 6a110a4f1b
RPC: fix "halt" command 2022-11-01 11:06:03 -04:00
Jason Rhinelander bd8dffc730
Merge pull request #1991 from jagerman/lokinet-vpn-cleanups
Lokinet vpn cleanups
2022-10-06 16:09:56 -03:00
Jason Rhinelander 9f258700b7
Lower log level for renewals to debug
Otherwise you see a lot of unnecessary subscription renewals every 30s
in the logs.
2022-10-06 11:56:07 -03:00
Thomas Winget eaf30de1fd
omq rpc log subscription
respects whether RPC is enabled, removes the log sink otherwise

bumps oxen-mq and oxen-logging
2022-10-06 11:56:04 -03:00
Jason Rhinelander 71ea4f4fa2
RPC: Relax token/range argument handling
- Accept empty string or `null` for token to mean "no token."
- Accept `null` for range to mean "default range."
- Don't use a default range (::0/0) in lokinet-vpn because this will
  fail if IPv6 ranges aren't supported on the platform (e.g. on
  Windows), and isn't necessary: if we omit it then the rpc code already
  uses ::0/0 or 0.0.0.0/0 by default, as needed.
2022-09-21 13:38:17 -03:00
Jason Rhinelander 613459401d
Linux route poker fixes
- don't add routes when not in exit mode
- don't call Up() from rpc code (the RouterPoker itself decides when to
  call Up())
2022-09-19 20:26:38 -03:00
Jeff 871c3e3281
changeset for windows port
* wintun vpn platform for windows
* bundle config snippets into nsis installer for exit node, keyfile persisting, reduced hops mode.
* use wintun for vpn platform
* isolate all windows platform specific code into their own compilation units and libraries
* split up internal libraries into more specific components
* rename liblokinet.a target to liblokinet-amalgum.a to elimiate ambiguity with liblokinet.so
* DNS platform for win32
* rename llarp/ev/ev_libuv.{c,h}pp to llarp/ev/libuv.{c,h}pp as the old name was idiotic
* split up net platform into win32 and posix specific compilation units
* rename lokinet_init.c to easter_eggs.cpp as that is what they are for and it does not need to be a c compilation target
* add cmake option STRIP_SYMBOLS for seperating out debug symbols for windows builds
* intercept dns traffic on all interfaces on windows using windivert and feed it into lokinet
2022-09-08 14:24:59 -04:00
Jeff 74362149eb
refactor dns subsystem
we want to be able to have multiple locally bound dns sockets in lokinet so
i restructured most of the dns subsystem in order to make this easier.

specifically, we have a new structure to dns subsystem:

* dns::QueryJob_Base

base type for holding a dns query and response with virtual methods
in charge of sending a reply to whoever requested.

* dns::PacketSource_Base

base type for reading and writing dns messages to and from wherever they came from

* dns::Resolver_Base

base type for filtering and handling of dns messages asynchronously.

* dns::Server

contextualized per endpoint dns object, responsible for all dns related isms.

this change hides all impelementation details of all of the dns components.
adds some more helper functions for parsing dns and dealing with OwnedBuffer.

overall dns becomes less of a pain with this new structure. probably.
2022-09-08 14:23:52 -04: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 3fccb3ab0c
fixup edge case on windows
* add platform detection constexprs
* add quark for platforms without native ipv6 like windows, exit mapping cannot work with ipv6 yet
2022-05-19 10:24:18 -04:00
majestrate d30fe95f2e
use ::/0
makes us map all ranges not just ipv4 when exit mode is on by default.
2022-05-18 12:16:46 -04:00
Jeff 776e9227fd
make serivce::Endpoint::EnsurePathToService have a default timeout as a named constant. 2021-12-15 15:25:53 -05:00
Jeff 301b19bd0f
do not send buggy reply as rpc 2021-12-15 15:25:53 -05:00
Sean e11a94c95c
RPC call for summary get_status (#1742)
* RPC call for summary get_status

* lint

* update with review notes

* further review points

* uint64_t
2021-10-13 07:20:36 -04:00
jeff 7db2459469
macos sort of works now 2021-09-02 14:17:09 -04:00
Jeff Becker 64cd2990bc
remove old routing table maniuplation code 2021-08-27 11:07:54 -04:00
Jeff Becker adc6237d1c
mark exit address outbound when we add it via rpc 2021-06-08 14:36:34 -04:00
Jeff Becker 499bb38e6f
fix route poking via rpc:
* immediately poke routes when we are told to use an exit so that packets get pushed which makes an exit path happen
* fix up cmake oddity in nsis section
2021-05-13 07:30:53 -04:00
Jeff Becker 2458b5fd71
rpc server fixups for win32:
* RoutePoker::Enable calls RoutePoker::Up so remove additional call to RoutePoker::Up
* allow specifying null exit via rpc
2021-05-13 06:09:52 -04:00
Jeff Becker 25e338d621
srv records
* add srv records in RCs if we have any
* add mechanism to add SRV records for plainquic exposed ports
* resign and republish rc or introset on srv record changes
2021-04-19 07:02:43 -04:00
Jeff Becker 94ecf02a62
add option to run lokinet traffic only with no exit and drop all non lokinet traffic
triggered by: exit-node=null
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 f86a2daf83
fixes
* Add service::Endpoint::HasOutboundConvo
* dont mark outbound convos as inbound
* order quic packets
2021-04-19 06:59:06 -04:00
Jeff Becker 73572b317b
stuff 2021-04-19 06:59:04 -04:00
Jeff Becker 100a953a23
make the lokinet endpoint code work
still needs the quic sides to work
2021-04-19 06:58:37 -04:00
Jeff Becker 7098f46d60
rpc endpoint for triggering quic tunnel 2021-04-19 06:58:37 -04:00
Jeff Becker f10269b03e
remove std::visit because apple is functionally retarded and does not support it despite claiming to support c++14 2021-03-20 10:06:26 -04:00
Jeff Becker 88ddcceca4
make lookup name async return optional variant 2021-03-19 16:06:03 -04:00
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.
2021-03-09 19:01:41 -05:00
Jason Rhinelander 91d6698a9d Reformat with clang-format-11 2021-03-05 13:36:31 -04:00
Jason Rhinelander c4559d158e Make format 2021-03-04 16:51:18 -04:00
Jason Rhinelander ccc7b5c9e9 Merge Logic functions into EventLoop
loop->call(...) is similar to the old logic->Call(...), but is smart
about the current thread: if called from within the event loop it simply
runs the argument directly, otherwise it queues it.

Similarly most of the other event loop calls are also now thread-aware:
for example, `call_later(...)` can queue the job directly when called if
in the event loop rather than having to double-queue through the even
loop (once to call, then inside the call to initiate the time).
2021-03-04 16:51:18 -04:00
Jeff Becker 7060a60c84
enable route poker poking before going "up" 2021-03-04 06:22:23 -05:00
Jeff Becker 94b8743b1c
fix typo 2021-02-24 14:08:21 -05:00
Jeff Becker 5b2abce86f
add string reason to auth messages 2021-02-24 14:08:21 -05:00
Jeff Becker 2cb889013b
revise lambda captures 2021-02-24 14:08:21 -05:00
Jeff Becker 6d5f1b0c6a
feedback auth result via lmq rpc 2021-02-24 14:07:50 -05:00
Jeff c76f2fe8de
Merge pull request #1496 from majestrate/rpc-kill-endpoint-sessions-2020-11-28
add llarp.endpoint rpc command
2021-02-23 18:53:06 -05:00
Jeff Becker bd93a8f828
initial v6 exits 2021-02-16 10:59:57 -05:00
Jeff Becker 242e56507c
proper lokimq -> oxenmq refactor 2021-02-03 13:12:21 -05:00
Jeff Becker df4ea34a56
nodedb refactor
* bump zmq static dep
* lokimq -> oxenmq
* llarp_nodedb -> llarp::NodeDB
* remove all crufty api parts of NodeDB
* make NodeDB rc selection api not suck
* make path builder api not suck
* propagate all above changes so that unit tests work and it all compiles
2021-02-02 09:35:40 -05:00
Jeff 49b9ad7197
tun code refactor (#1495)
* partial tun code refactor

* take out the trash

* move vpn platform code into llarp/vpn/platform.cpp

* fix hive build

* fix win32

* fix memory leak on win32

* reduce cpu use

* make macos compile

* win32 patches:

* use wepoll for zmq
* use all cores on windows iocp read loop

* fix zmq patch for windows

* clean up cmake for win32

* add uninstall before reinstall option to win32 installer

* more ipv6 stuff

* make it compile

* fix up route poker

* remove an unneeded code block in macos wtf

* always use call to system

* fix route poker behavior on macos

* disable ipv6 on windows for now

* cpu perf improvement:

* colease calls to Router::PumpLL to 1 per event loop wakeup

* set up THEN add addresses

* emulate proactor event loop on win32

* remove excessively verbose error message

* fix issue #1499

* exclude uv_poll from win32 so that it can start up

* update logtag to include directory

* create minidump on windows if there was a crash

* make windows happy

* use dmp suffix on minidump files

* typo fix

* address feedback from jason
* use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
* quote $@ in apply-patches in case path has spaces in it

* address feedback from tom

* remove llarp/ev/pipe
* add comments for clairification
* make event loop queue size constant named
2021-01-11 18:13:22 -05:00
Jeff Becker 7ee9d0281c
add llarp.endpoint rpc command with kill option to kill all active convotags given
a list of or a single remote service address.
2020-11-28 07:15:55 -05:00
Jeff 6407733c8e
* make llarp.halt rpc call actually return a reply (#1488)
* add --kill flag to lokinet-vpn that calls llarp.halt
* make macos uninstaller kill lokinet via lokinet-vpn --kill
2020-11-20 12:37:30 -05:00
Jeff 22acf0a537
Lns exits (#1407)
* lns exits

* try appeasing the clang

* clean up lambda
2020-10-21 05:39:01 -04:00