Commit Graph

881 Commits

Author SHA1 Message Date
Jeff Becker
e4841917ba
redo cmake parts
* add liblokinet.so target
* make every library we build except liblokinet.so static
* wire up parts of liblokinet
2021-04-19 06:52:24 -04:00
Jeff Becker
affd2e23f7
flesh out lokinet.h more 2021-04-19 06:52:24 -04:00
Jeff Becker
414c2d42e6
add lokinet.h header for liblokinet api 2021-04-19 06:52:24 -04:00
Jeff Becker
9e2cfd90cb
remove unneeded header 2021-04-19 06:52:23 -04:00
Jeff Becker
a6715a1f75
remove old vpnio bits 2021-04-19 06:52:23 -04:00
Jason Rhinelander
e198bfd3e1 Remove unused variable 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
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
2021-03-02 13:18:22 -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
fe30193a97
revive android build system (#1339)
* it lives?

* clean up

* add readme and add x86_64 to abi filters

* disable route poking on android

* make it compile on android

* it compiles!!111

* typofix

* re-enable ccache for android
2020-09-22 15:04:15 -04:00
jeff
5391e6a66a initial config overriding on runtime 2020-08-27 12:43:53 +00:00
Jeff Becker
1e8fcbb99b
make destructor virtual 2020-08-24 20:19:51 -04:00
Jeff Becker
da6ba86892
add destructor to fix CI builds on macos 2020-08-24 20:19:51 -04:00
Jeff Becker
e9aa200e8c
make formatting happy 2020-08-24 20:19:48 -04:00
Stephen Shelton
0f074cff8c
Remove ambguity WRT loading and passing of Config 2020-07-06 13:38:02 -06:00
Stephen Shelton
88c3e9ce00
Remove worker thread parameter from Router constructors 2020-07-02 10:35:44 -06:00
Stephen Shelton
ec20d94c6b
Fix Context::Configure() 2020-07-02 10:26:53 -06:00
Stephen Shelton
ed47ba998f
Minor fixes around Context 2020-07-02 10:26:52 -06:00
Stephen Shelton
552dcce5fd
Use inheritance to handle Hive injection 2020-07-02 10:25:10 -06:00
Stephen Shelton
b0d8568452
Remove llarp C API usage from RouterHive 2020-07-02 10:24:19 -06:00
Stephen Shelton
84c83a2400
Add specialized subclass of Router for Hive 2020-07-02 10:22:57 -06:00
Jeff Becker
f4971a88fd
use lokimq workers instead of llarp:🧵:ThreadPool 2020-07-02 11:07:34 -04:00
Stephen Shelton
0aa43c6b07
Pass RuntimeOptions instead of 'bool isRelay' 2020-07-01 08:38:56 -06:00
Stephen Shelton
d85e48c9d0
Use llarp::Context::CallSafe() for vpn AsyncClose() 2020-06-29 14:39:31 -06:00
Stephen Shelton
ba92d12203
Remove TODO comment 2020-06-29 14:11:49 -06:00
Stephen Shelton
b5d6a73ffd
Rip out most of C API 2020-06-29 13:55:59 -06:00
Jeff Becker
800668348a
add regression test for key backup bug 2020-06-08 08:42:10 -04:00
Stephen Shelton
1497b829bd
Ignore our self.signed file if we're a client 2020-06-04 11:05:23 -06: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
de8e44ba21
Re-apply clang-format rules after rebasing 2020-04-07 14:41:11 -06:00
Stephen Shelton
f250b7adcb
Remove pidfile support 2020-04-07 14:24:48 -06:00
Stephen Shelton
05257126fe
Make distinction between config dir and data dir 2020-04-07 14:18:14 -06:00
Stephen Shelton
923e73f693
Plumb isRelay CLI arg through to config 2020-04-07 14:17:13 -06:00
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.
2020-04-07 12:38:56 -06:00
Jeff
d3091cf9fc
Merge pull request #1167 from tewinget/tooling
RouterHive initial PR
2020-04-07 13:13:02 -04:00
Jeff Becker
9a1050bbe7
remove unused headers 2020-04-01 08:00:24 -04:00
Thomas Winget
84a1d7dbcc clang format....... 2020-03-06 20:20:11 -05:00
Rick V
b4d6f89452
try extracting dns bind addr from INI on windows 2020-03-05 12:47:45 -06:00
Jeff Becker
877443d95c more introspection code 2020-03-03 19:57:09 -05:00
Thomas Winget
8d03e6dd3c more router hive stuff, read below the fold
Router now has a hive pointer if LOKINET_HIVE is set.
llarp::Context has a method InjectHive to give Router the pointer.
Router has a method NotifyRouterEvent which does:
  - when LOKINET_HIVE is set, passes the event to RouterHive
  - else when LOKINET_DEBUG is set, prints the event at a low log level
  - else NOP
2020-03-03 19:57:09 -05: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
Rick V
b9c02d999f
why was this there
we do not support MSVC
2019-12-22 07:49:36 -06:00
Jason Rhinelander
2e17542028 Don't include net/if.h to help xenial
Loading both net/if.h and linux/if.h on xenial breaks compilation
because xenial's kernel/glibc headers are broken AF.

We don't actually need anything from net/if.h here, so don't include it.
2019-12-14 11:58:10 -04:00
Jeff Becker
f56e543d75
add deadlock checker and revert bencode change from long ago 2019-12-07 14:58:19 -05:00
Jeff Becker
9b99752276
i hate windows 2019-11-05 08:19:27 -05:00
Jeff
3a6c16aa36
Merge pull request #871 from majestrate/ed25519-signing
Ed25519 signing
2019-10-28 10:42:40 -04:00
jeff
ff8c167362 make it compile on windows 2019-10-22 11:58:34 -04:00
jeff
9dd73dad46 close -> closeasync 2019-10-09 09:09:42 -04:00
jeff
58a25602f5 more fixes, implemenmt missing functions 2019-10-09 09:08:38 -04:00