1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
Commit graph

3734 commits

Author SHA1 Message Date
Thomas Winget
84a1d7dbcc clang format....... 2020-03-06 20:20:11 -05:00
Rick V
26d1001e53
fix logging 2020-03-05 12:47:50 -06:00
Rick V
b449e03f43
So as of GCC 9.2, std::random_device on Windows is RtlGenRandom()
....which is precisely the thing i patch out in libsodium to use CryptoAPI
documented interfaces instead (which fall through to RtlGenRandom() on
such devices _anyway_)
we can just use libsodium directly, i happened to patch it out in libstdc++
as a side effect (since my local toolchain can target any version of windows)
2020-03-05 12:47:49 -06:00
Rick V
c9f2f90e13
move these out of the way 2020-03-05 12:47:48 -06:00
Rick V
9b0ec0935a
bump for next release 2020-03-05 12:47:47 -06:00
Rick V
8e9842f4b2
bindaddr a common field on the machine-independent side 2020-03-05 12:47:46 -06:00
Rick V
db0920d921
use backport fork for release installer only
move all invariant assets to common repo

remove ded code, libuv patches can be swapped in at build time for debug/release builds
2020-03-05 12:47:46 -06:00
Rick V
b4d6f89452
try extracting dns bind addr from INI on windows 2020-03-05 12:47:45 -06:00
Jeff
abff5c35cb
Merge pull request #1160 from majestrate/dns-rebinding-fix-2020-03-04
add llarp.admin.die rpc call to gracefully kill router
2020-03-05 09:40:13 -05:00
Jeff Becker
99c814e6b0
fix dns rebinding vuln in jsonrpc 2020-03-04 13:59:33 -05:00
Jason Rhinelander
3b0927ce13
Merge pull request #1140 from despair86/cmake-cleanup
some light cmake cleanup for win32
2020-03-04 11:44:10 -04:00
Jason Rhinelander
a78a7fbb17
Merge pull request #1158 from majestrate/prune-routers-2020-03-03
Prune non routers from nodedb
2020-03-04 11:41:15 -04:00
Jason Rhinelander
6707037909
Merge pull request #1157 from majestrate/fix-systemd-status-2020-03-03
fix status line
2020-03-04 11:28:07 -04:00
Thomas Winget
695784b2b6 more hive things
DHT PubIntroSentEvent
some helper functions added to RouterHive (C++ class) as well as RouterHive(Python class)
hive.py main() continues to be a testbed for new event types
some more internal classes in pybind
2020-03-04 00:57:26 -05:00
Thomas Winget
6d472d2423 rc gossip delay adjustment for hive
allows enough time for every relay (at least in a hive of 50) to connect
to the bootstrap node so all will get all gossips, but not too long so
tests can run relatively quickly.
2020-03-04 00:54:30 -05:00
Jason Rhinelander
c87fd66386 Fix lookup filter to filter second, not first, lookup 2020-03-04 01:32:20 -04:00
Jeff Becker
08de84d40b
remove non public routers from nodedb 2020-03-03 20:01:24 -05:00
Thomas Winget
6fc05ca1ff RCGossipSentEvent 2020-03-03 19:57:09 -05:00
Thomas Winget
f01624d10a 2ms between hive router spin-up instead of 20ms 2020-03-03 19:57:09 -05:00
Thomas Winget
a58a8c9a61 hive.py now defaults to 1000 relays because f your box.
also check for error on uv_async_init...

may want to `ulimit -Sn $(ulimit -Hn)`...
2020-03-03 19:57:09 -05:00
Thomas Winget
c8c66f0a5f some refactoring of tooling code, added RCGossipReceivedEvent 2020-03-03 19:57:09 -05:00
Thomas Winget
88c80dc2ee add cxxopts to shared_lib dependencies 2020-03-03 19:57:09 -05:00
Thomas Winget
df0380e746 LRSM RouterEvent, added to hive test and test passes. 2020-03-03 19:57:09 -05:00
Thomas Winget
771d0b4489 hive pytest framework in place (and path build test works)! 2020-03-03 19:57:09 -05:00
Thomas Winget
04c1f67f78 more structure to python hive code 2020-03-03 19:57:09 -05:00
Thomas Winget
ee7b7e917d hive can now instantiate and start relays/clients separately 2020-03-03 19:57:09 -05:00
Thomas Winget
2bbb274131 superfluous class declaration 2020-03-03 19:57:09 -05:00
Stephen Shelton
4741d81051 Add GotIntro event to RouterHive 2020-03-03 19:57:09 -05:00
Thomas Winget
68c1ae52b3 add ShortHex function to AlignedBuffer 2020-03-03 19:57:09 -05:00
Thomas Winget
341d03bcf8 changes 2020-03-03 19:57:09 -05:00
Jeff Becker
e7689b40a7 dht pub intro message router event thiny doo 2020-03-03 19:57:09 -05:00
Thomas Winget
5672c42f20 RouterEvent::ToString in parent class 2020-03-03 19:57:09 -05:00
Thomas Winget
a9882ad475 PathRequestReceivedEvent implemented 2020-03-03 19:57:09 -05:00
Thomas Winget
c9a278c0de some more changes to pybind/hive code, read below
hive.py is currently largely for testing the pybind stuff, so changes to it will likely
be frequent and arbitrary for now.

Added pybind for llarp::path::PathHopConfig, but not every member -- just rc and upstream routerID

Hive now uses std::queue with mutex instead of our lockless queue.

Removed some functions from Hive that will not be necessary as things are being handled from python.
2020-03-03 19:57:09 -05:00
Thomas Winget
5cf35769b4 don't have python try to intercept stdout/stderr 2020-03-03 19:57:09 -05:00
Jeff Becker
32dbe6b1ad more shiz 2020-03-03 19:57:09 -05:00
Jeff Becker
877443d95c more introspection code 2020-03-03 19:57:09 -05:00
Thomas Winget
931ff521d1 working toward full testnet of routers (not clients yet) in hive/pybind setup
Not working yet -- some sort of RC issue.  Checkout the commit prior to this if you want something that 'works' that you can play with.
2020-03-03 19:57:09 -05:00
Thomas Winget
1e04decb66 can ping on lokinet running in python context! 2020-03-03 19:57:09 -05:00
Thomas Winget
5e498e962f working on more pybinds 2020-03-03 19:57:09 -05:00
Thomas Winget
0f34a950a9 pybind config object, working 2020-03-03 19:57:09 -05:00
Thomas Winget
9b3bf833e0 revert nop logging -- un-revert later 2020-03-03 19:57:09 -05:00
Thomas Winget
a5c2b369b7 nop logging on hive build for now
a bunch of routers logging to stdout at the same time is a complete
charlie foxtrot.  until we take the time to make logger not a singleton
(and probably make each router able to log to its own file rather than stdout)
just make it not log.

Note: this is very temporary, as the logs will be annoying for testing the
pybind stuff and shouldn't be necessary for debugging it
2020-03-03 19:57:09 -05:00
Thomas Winget
0007996fde using instead of typedef 2020-03-03 19:57:09 -05:00
Jeff Becker
a5dc41b049 OMG IT DOES STUFF :DDDDDD 2020-03-03 19:57:09 -05:00
Thomas Winget
f712acc486 huzzah it builds, time to test soon! 2020-03-03 19:57:09 -05:00
Jeff Becker
da79b14703 make it compile 2020-03-03 19:57:09 -05:00
Thomas Winget
8dc5dabe49 working toward compilation, still has include issue 2020-03-03 19:57:09 -05:00
Jeff Becker
26c1670af7 make it compile 2020-03-03 19:57:09 -05:00
Jeff Becker
35bea37fd1 make it compile 2020-03-03 19:57:09 -05:00
Jeff Becker
1fdb8b4c94 initial pybind11 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
Jeff Becker
add305b9f4
use size / 2 as the number of transit paths 2020-03-03 18:16:08 -05:00
Jeff Becker
05082e2507
fix status line 2020-03-03 18:04:09 -05:00
Rick V
4cd7a22ca3
fix libsodium cross compile 2020-03-03 15:33:04 -06:00
Jeff Becker
61ffbc0643
std::vector reserve does not resize 2020-03-03 15:25:18 -05:00
Stephen Shelton
321314b456
Remove re-propagation of introsets when we are wrong candidate 2020-03-02 15:24:41 -07:00
Jeff Becker
32e768d7dd
change log 2020-03-02 12:33:33 -05:00
Jeff Becker
d4ccf895e3
Merge branch 'fix-up-introset-lookup-fails-2020-03-02' of ssh://github.com/majestrate/loki-network into fix-up-introset-lookup-fails-2020-03-02 2020-03-02 12:02:58 -05:00
Jeff Becker
79746e3719
remote lookup limiting of 500ms per address 2020-03-02 12:02:21 -05:00
Stephen Shelton
9be8050854
Make format 2020-03-02 09:57:37 -07:00
Stephen Shelton
886a981997
Consolidate introset publishing constants 2020-03-02 09:57:37 -07:00
Jeff Becker
a09bb89d15
dont put multiple outbound contexts 2020-03-02 11:56:47 -05:00
Jeff Becker
d3f222ddcc
revert relay side dedup parameter 2020-03-02 11:42:26 -05:00
Stephen Shelton
bbee45118e
Remove redundant lookup logic from relays 2020-03-02 09:27:07 -07:00
Jeff Becker
158a9018f3
rename variable 2020-03-02 11:18:26 -05:00
Jeff Becker
9ff31f6402
spelling is hard 2020-03-02 11:17:50 -05:00
Jeff Becker
8f4362f092
fix up introset lookups 2020-03-02 11:12:29 -05:00
Jason Rhinelander
806d43c34e
Merge pull request #1147 from notlesh/diagnose-pubintro-round2-2020-02-28
Diagnose pubintro round2
2020-03-01 20:26:41 -04:00
Jason Rhinelander
d46a880150
Merge pull request #1145 from majestrate/remove-convotags-right-away-2020-02-27
Remove convotags right away when outbound context dies
2020-03-01 20:25:17 -04:00
Jason Rhinelander
b60adc909d Make IntroSet publish confirmed less verbose
Essentially just rate limit the confirmation message to one message per
second.
2020-03-01 14:04:37 -04:00
Jason Rhinelander
cfee824a79 Don't republish when we have extra paths
This caused some unwanted behaviour:

- on initial startup we often get two publishes in quick succession
because we're publishing and building paths at the same time

- at the 10m mark we enter a publish loop every 5 seconds because we
have paths with lifetimes < 10min that was triggering this condition,
and yet those paths will never actually be included in the introset
because they are expiring in <10m.
2020-03-01 13:56:04 -04:00
Jason Rhinelander
c0eb0c4db4 Avoid unnecessary copy 2020-03-01 13:56:04 -04:00
Jeff Becker
45fa9bebbc
wrong txid 2020-03-01 12:33:54 -05:00
Jeff Becker
e3b5fb4dd9
add local publish intro message to send reply down path 2020-03-01 12:30:05 -05:00
Jason Rhinelander
58fe7ac801 De-static constants
We don't need separate copies of these per compilation unit.
2020-03-01 12:40:15 -04:00
Jason Rhinelander
823c17206f Add min intro set paths, slightly increase spread speed
This should ensure that we have enough shortly after startup for initial
path builds.

The spread speed here gets slightly increased to lifetime/5 (=4min)
instead of lifetime/4 (=5min) so that our "normal" number of paths is 5
with occassional momentary drops to 4, but should always keep us >= the
new minimum of 4.

Because the path spread happens over time, this shouldn't result in a
rebuild of several paths: we'll build 4 quickly, then another at +4m,
another at +8m, etc.  When the initial 4 expire, we'll be dropping from
9 to 5 established but that's still above the minimum (4) so we won't
need to reconnect to several at once, and the spread builds should keep
us at 5 all the time.
2020-03-01 12:37:43 -04:00
Jeff Becker
5b075259e6
revert 2020-03-01 11:21:48 -05:00
Jeff Becker
b4a59a0b1a
make format 2020-03-01 11:20:11 -05:00
Jeff Becker
dd21cba1fe
dedup via txid not keyspace location 2020-03-01 11:17:39 -05:00
Jason Rhinelander
76608b6b90 Logic simplification 2020-03-01 11:58:08 -04:00
Jason Rhinelander
27b8743107 Add warns for introset publish failures 2020-03-01 11:48:43 -04:00
jeff
f76b9f3042 make format 2020-02-29 17:43:51 -05:00
jeff
49e69d7087 remove uneeded code 2020-02-29 15:48:51 -05:00
Stephen Shelton
2ebd9bbd95
Implement PublishServiceJob::SendReply() 2020-02-28 20:59:24 -07:00
Stephen Shelton
638ea2e0fd
Make format 2020-02-28 17:07:35 -07:00
Stephen Shelton
d09fd13dd6
Calculate 'candidateNumber' when we should store Introset 2020-02-28 17:00:49 -07:00
Stephen Shelton
37ca564005
Log when DHTSendTo fails @ Router::SendToOrQueue 2020-02-28 16:56:35 -07:00
Stephen Shelton
62014de91c
Handle PubIntro relayOrder logic on client-side 2020-02-28 16:45:04 -07:00
Stephen Shelton
61d19179f7
Remove dead code 2020-02-28 16:32:00 -07:00
Stephen Shelton
a8623f09e9
Properly deserialize PubIntroMessages' relayed var 2020-02-28 16:30:10 -07:00
Stephen Shelton
c0fbe06c0f
Require 'From' and 'relayed' in PublishIntroMessage ctor 2020-02-28 16:28:57 -07:00
Stephen Shelton
f61cd1a7da
Add some notes/comments about DHT message handling 2020-02-28 16:26:52 -07:00
Stephen Shelton
6b906de00d
Judicious removal of dead code 2020-02-28 16:26:45 -07:00
Jeff Becker
ce335dc47d
remove convotags on dead outbound context 2020-02-27 11:54:54 -05:00
Jeff Becker
dea78d2326
change function signature for dht context to exclude time parameter 2020-02-27 11:37:23 -05:00
Jeff Becker
7a84bbe459
remove dht explore timer 2020-02-27 11:28:01 -05:00
Jason Rhinelander
df7a173649 Shorten version and prefix with v
So we get `v0.7.0` instead of `lokinet-0.7.0-abcdef12`; the latter is
useful for devs, but not so much for random operators (and you can
always go get the full version from the binary).
2020-02-26 16:16:57 -04:00
Jason Rhinelander
d5eed90a3c Fix systemd compilation & enable systemd on travis 2020-02-25 22:35:06 -04:00
Jason Rhinelander
f1aa27e616 fix speeling mistack 2020-02-25 22:27:34 -04:00
Jeff
a8ce76f6e4
Merge pull request #1094 from majestrate/upstream-cname-monkey-patch-dns-2020-02-12
monkey patch upstream dns to rewrite .loki cname answers
2020-02-25 19:55:01 -05:00
Jeff
da780658e1
Merge pull request #1134 from majestrate/systemd-status-2020-02-25
remove uneeded members
2020-02-25 17:50:43 -05:00
Jeff Becker
d50a0149f9
use std::chrono 2020-02-25 17:46:16 -05:00
Jeff Becker
9c30ff7a26
handle snode and clean up codepath for hooked dns 2020-02-25 17:43:08 -05:00
Jeff Becker
1d5c712adb
monkey patch upstream dns to rewrite .loki cname answers 2020-02-25 17:43:08 -05:00
Jeff Becker
9d5dbbc0ad
remove uneeded members 2020-02-25 17:37:15 -05:00
Jeff
9dc86372b5
Merge pull request #1131 from majestrate/systemd-status-2020-02-25
Systemd status reporting
2020-02-25 17:35:19 -05:00
Jeff Becker
66181d8a8f
systemd status 2020-02-25 17:32:57 -05:00
Linux User
fd23fd6894
32-bit linux patches 2020-02-25 15:48:07 -06:00
Jeff
19a751c41b
Merge pull request #1127 from notlesh/spread-snapp-path-builds-evenly-2020-02-24
Spread snapp path builds evenly
2020-02-25 16:25:47 -05:00
Jeff
4f29405e9e
Merge pull request #1115 from majestrate/handle-multiple-responses-per-lookup-2020-02-20
handle multiple responses per hidden service lookup
2020-02-25 16:25:19 -05:00
Stephen Shelton
abe4015986
Use constants for path build timing 2020-02-25 13:52:59 -07:00
Stephen Shelton
230037b9f3
Increase default path timeout from 10min to 20min 2020-02-25 13:42:14 -07:00
Stephen Shelton
f0374eb2b7
Use existing 'lastBuild' var for spacing path builds 2020-02-25 13:39:28 -07:00
Stephen Shelton
c2c010dbad
Make format 2020-02-25 13:39:28 -07:00
Stephen Shelton
c1b5e453c7
Big I, little i, what begins with I? 2020-02-25 13:39:27 -07:00
Stephen Shelton
1db6c6ae3b
Make format 2020-02-25 13:39:27 -07:00
Stephen Shelton
c2f719c996
Build endpoint paths at even[ish] intervals 2020-02-25 13:39:25 -07:00
Jeff
a8a6c175fc
Merge pull request #1128 from majestrate/use-std-chrono-2020-02-24
make llarp_time_t use std::chrono::milliseconds
2020-02-25 15:36:00 -05:00
Jason Rhinelander
04c618ddae gcc 5 compatibility workaround 2020-02-25 13:33:39 -04:00
Jeff Becker
368acec485
fix last commit 2020-02-25 12:19:40 -05:00
Jeff Becker
b2181f2449
reduce code use 2020-02-25 12:15:14 -05:00
Jeff Becker
fdcd19662f
remove trailing "ms" 2020-02-25 12:07:30 -05:00
Jeff Becker
bf0416cab8
remove Time_t, add operator overload for printing llarp_time_t and add to_json function for serializing llarp_time_t to json 2020-02-25 12:05:13 -05:00
Jeff Becker
ecdab10dac
explictly use std::chrono::milliseconds 2020-02-25 11:05:54 -05:00
Jeff Becker
df427ffa0e
use llarp_time_t instead of auto 2020-02-25 11:02:14 -05:00
Jason Rhinelander
3bd400f6fe Fix string_view C++17 compatibility
string_view was implicitly convertible to std::string, but
std::string_view is only explicitly convertible.  This makes the
`operator std::string` explicit to be more compatible, and re-adds a
bunch of explicit string casts to the code where needed.

(This also fixes the build if changing the standard to c++17)
2020-02-25 11:52:43 -04:00
Jeff Becker
524726e4cc
cast interval to std::chrono::milliseconds before dividing by 4 2020-02-25 10:38:59 -05:00
Jeff Becker
d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
Jeff Becker
f4520ac920
make decaying hashset use llarp::Time_t and move unit tests to use catch2 2020-02-24 15:22:49 -05:00
Jeff Becker
39cdc9e6dd
shift intro on introset update 2020-02-24 15:21:54 -05:00
Jason Rhinelander
f976ebbe49 make format 🤦 2020-02-24 14:38:45 -04:00
Jason Rhinelander
55acec80ec Disable thread annotation when not under libc++
They are fairly useless under stdlibc++ because it doesn't have the
required annotations on stl mutexes and locks, so we just get tons of
useless warnings.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
27025030ce Renamed uint128.h -> uint128.hpp 2020-02-24 14:27:44 -04:00
Jason Rhinelander
3fedd5ba6b Avoid wrong-order initialization on big endian 2020-02-24 14:27:44 -04:00
Jason Rhinelander
2093f94244 Make uint128_t use big/little endian layout internally
Thus if someone wants to memcpy out of it it will have the expected
endianness of the internal data.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
454abb4f9f Avoid copies in mutators
Reimplement operators in terms of mutators, rather than vice versa, so
that mutators don't have to make a copy.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
4207a7cfa3 Rewrite In6ToHUInt to be endian agnostic 2020-02-24 14:27:44 -04:00
Jason Rhinelander
dba3ff7fd3 gcc 5.x string_view workaround 2020-02-24 14:27:44 -04:00
Jason Rhinelander
0839c16f19 Final abseil purge
Bye-bye Google Boost.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
5ce6c01476 Don't use double-underscores
double-underscore names are reserved for the compiler/STL.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
5fcc11f2bf Fix format 2020-02-24 14:27:44 -04:00
Jason Rhinelander
5d1230d7c9 constexpr string_view fixes
Pre-C++17 char_traits::compare isn't constexpr so we can't constexpr the
find/rfind methods that use it.

begin() etc, however, can be constexpr (and need to be for some of the
other constexpr methods here that use them).
2020-02-24 14:27:44 -04:00
Jason Rhinelander
46242ba69b TrimWhiteSpace -> TrimWhitespace
Fix my dumb initial capitalization choice.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
74d4afad51 Remove metric config parsing 2020-02-24 14:27:44 -04:00
Jason Rhinelander
54186c4a89 Replace absl string_view with string_view from lokimq
When we add loki-mq has a dependency we can just alias it, but for now
it's easier to copy the header than add the whole submodule library.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
089056ca5b Remove all ABSL_ATTRIBUTE_UNUSED uses 2020-02-24 14:27:44 -04:00
Jason Rhinelander
5fd830bc36 Prettify uptime duration in log lines
Produces strings such as:

    [+1h09m12.475s]

instead of:

    [+4152475 ms]
2020-02-24 14:27:44 -04:00
Jason Rhinelander
2e9840ea39 Replace abseil date code with Hinnart's date.h
Howard Hinnart's date.h is the library that was accepted as C++20
date/calendar support, so this is essentially a backport of C++20 date
time support.

(It does support timezone support, but requires more of the library and
that seems like overkill for what we need; this just prints UTC
timestamps instead, which need only a header-only include).
2020-02-24 14:27:44 -04:00
Jason Rhinelander
ba1b20153e Miscellaneous small absl removals 2020-02-24 14:27:44 -04:00
Jason Rhinelander
870062e8cc Remove absl optimization
This was being used to get at gcc/clang's __builtin_expect, but we don't
really need that: we can just avoid the check entirely when not in debug
mode which should be even faster.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
5efcd49a3b Deabseil: remove absl::StrCat, de-templatize fromEnv
fromEnv here wasn't usefully templatized (the base template basically
couldn't be used for anything except a string anyway), so just replaced
it with the overloads we need and moved the implementations out of the
header.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
5c95971335 Make C++ literals available everywhere in llarp 2020-02-24 14:27:44 -04:00
Jason Rhinelander
98c34d995b De-abseil: Add our own llarp::TrimWhiteSpace
Adds a TrimWhiteSpace instead of using abseil's.

Adds Catch2 tests for it, and also converts the existing str tests to
catch (which look much, much nicer than the gtest ones).
2020-02-24 14:27:44 -04:00
Jason Rhinelander
00a624ab40 Fix and rename CaselessCmp -> CaselessLessThan
The comparison done here was really weird: by comparing lengths *before*
contents "zz" would sort before "aaa".  It wasn't invalid for the
specific purpose being used here (looking for true/false values), but
would be highly broken if someone tried to use it elsewhere.

Also renamed it because it really is just a `<` implementation, not a
full cmp implementation.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
7d167d3fe4 Add return types to lambda
Without these the return type could be wrong (e.g. supposed to return a
reference but returns a value).
2020-02-22 12:17:53 -04:00
Jason Rhinelander
f84ce61d66 Removed empty cpp files
These aren't needed: CMake already knows how to follow #includes and
rebuild when headers change as long as the headers are included
*somewhere*.  The extra .cpp files here just require building a bunch of
.cpp files with just header content that we just end up throw away
during linking (since the same things will also be compiled in whatever
other compilation units include the same headers).
2020-02-21 23:39:11 -04:00
Jason Rhinelander
fe61367a87 Vastly simplified llarp::util::memFn
There is a huge pile of unnecessary machinery here that can be solved
with a few lambdas and some member function pointer type deduction.
2020-02-21 23:24:33 -04: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
Stephen Shelton
ea97a8f2ac
Make format 2020-02-21 10:16:45 -07:00
Stephen Shelton
16be86a5c3
Merge pull request #1116 from tewinget/short-path-names
path builder prints hops, rest print short name
2020-02-21 08:58:05 -08:00
Thomas Winget
fae86281e9 make path short name look nicer 2020-02-20 17:20:17 -05:00
Thomas Winget
145efaf0bb should probably build before committing... 2020-02-20 17:04:08 -05:00
Thomas Winget
74d421ac2d PathBuildNumber -> NextPathBuildNumber because increment side-effect 2020-02-20 16:57:48 -05:00
Thomas Winget
ad3465ee66 std move better 2020-02-20 16:55:45 -05:00
Thomas Winget
893ef2b874 const-y-ness and move-y-ness 2020-02-20 16:46:07 -05:00
Thomas Winget
fc56a018e5 path builder prints hops, rest print short name 2020-02-20 16:37:39 -05:00
Jeff
7c5a721457
Merge pull request #1114 from notlesh/redundant-introset-lookup-improvements-2020-02-20
Redundant introset lookup improvements
2020-02-20 15:25:09 -05:00
Stephen Shelton
63c3106db2
Make format 2020-02-20 13:14:20 -07:00
Jeff Becker
748be8eec8
handle multiple responses per hidden service lookup 2020-02-20 14:33:54 -05:00
Stephen Shelton
0429bafbb3
Merge pull request #1111 from notlesh/redundant-introset-propagation-2020-02-19
Redundant introset propagation
2020-02-20 10:50:06 -08:00
Stephen Shelton
66cb30fa58
Refactor: remove recursionDepth from DHT lookups 2020-02-20 11:18:05 -07:00
Jeff
6ac5f19b3a
Merge pull request #1110 from jagerman/no-abseil-optional
De-abseil, part 1: remove absl::optional
2020-02-20 12:38:16 -05:00
Stephen Shelton
45a36fcfee
Rework FindIntro logic per redundant strategy 2020-02-20 09:23:41 -07:00
Jason Rhinelander
05a2e961e6 Add missing header 2020-02-20 11:49:18 -04:00
Stephen Shelton
4c499fb076
Make format 2020-02-20 08:36:29 -07:00
Stephen Shelton
6966168f5a
Minor improvements to DHT inroset propagation 2020-02-19 17:30:58 -07:00
Stephen Shelton
dff9aeb250
Propagate Introset publishing redundantly 2020-02-19 17:07:46 -07:00
Jeff Becker
dc7828941f
add log statement 2020-02-19 17:06:13 -07:00
Jason Rhinelander
ac1486d0be Replace absl::optional with optional-lite
Step 1 of removing abseil from lokinet.

For the most part this is a drop-in replacement, but there are also a
few changes here to the JSONRPC layer that were needed to work around
current gcc 10 dev snapshot:

- JSONRPC returns a json now instead of an optional<json>.  It doesn't
  make any sense to have a json rpc call that just closes the connection
  with returning anything.  Invoked functions can return a null (default
  constructed) result now if they don't have anything to return (such a
  null value won't be added as "result").
2020-02-19 18:21:25 -04:00
Jeff Becker
9a6148c4c3
require router version in public routers 2020-02-19 15:25:02 -05:00
Jeff
20bc168d1c
Merge pull request #1093 from majestrate/toggle-publishing-introsets-2020-02-11
make publishing introsets optional
2020-02-19 11:50:41 -05:00
Jeff Becker
1874f439b7
add comment 2020-02-18 13:30:24 -05:00
Jeff Becker
e907d2ae19
handover fixes 2020-02-18 12:15:14 -05:00
Jeff Becker
f7f5d893a5
use endpoint path for lookup because outboundcontext does not implement pathset::HandleGotIntroMessage 2020-02-18 12:15:13 -05:00
Jeff Becker
c9866b6a0b
simplify 2020-02-17 15:47:57 -05:00
Jeff Becker
9aeee37347
short circuit 2020-02-17 15:44:23 -05:00
Jeff Becker
6a495dd090
ammend outbound context logic 2020-02-17 15:40:10 -05:00
Jeff Becker
02228ded08
spread out path builds 2020-02-17 15:24:18 -05:00
Jason Rhinelander
9e096d1996 Reduce introset publishing interal to 2.5min instead of 1.25min
We want to have some redundancy, but having 8 active at once seems
extreme; reduce to 4.
2020-02-17 12:28:34 -04:00
Jason Rhinelander
ce90b9dc7b clang format 2020-02-14 17:45:22 -04:00
Jason Rhinelander
c3637c81fd Remove another unused randomize parameter 2020-02-14 17:45:22 -04:00
Jason Rhinelander
25a796d940 Rework partial sorting code: use pointers, add lock
Changes to code to sorts a set of pointers instead of full records, then
copy those out into the final results that we return.
2020-02-14 17:45:22 -04:00
Jason Rhinelander
24469daefb Remove unused parameter
We always randomize now.
2020-02-14 17:45:18 -04:00
Jeff Becker
83ee508fe1 comparison fix 2020-02-14 17:43:13 -04:00
Jeff Becker
763f61e454 dont collide variable names 2020-02-14 17:43:13 -04:00
Stephen Shelton
9dfcfbc3ac Bencode/decode relayOrder in lexigraphical order, make it uint64_t 2020-02-14 17:43:13 -04:00
Stephen Shelton
127e7ef31b Make format 2020-02-14 17:43:13 -04:00
Stephen Shelton
adf8772f3c Remove relayOrder from MessageDecoder 2020-02-14 17:43:13 -04:00
Stephen Shelton
6ca2c11e59 Serialize / deserialize relayOrder @ FindIntroMessage 2020-02-14 17:43:13 -04:00
Stephen Shelton
906803e387 Refactor DHT introset lookups to use redundant lookup strategy 2020-02-14 17:43:13 -04:00
Stephen Shelton
fa1df8db63 Big R, little r, what begins with R? 2020-02-14 17:43:13 -04:00
Jeff Becker
4d4b33607f dont use optional 2020-02-14 17:43:13 -04:00
Jeff Becker
23bcfa4abb revert change 2020-02-14 17:43:13 -04:00
Jeff Becker
df8c56343d refactor GetManyPathsWithUniqueEndpoints to go into service/endpoint_util.hpp 2020-02-14 17:43:13 -04:00
Jeff Becker
fc5e6b4d77 log location 2020-02-14 17:43:13 -04:00
Jeff Becker
3cc2adae31 paralell publish and lookups 2020-02-14 17:43:13 -04:00
Jeff Becker
e30c720446 redundant publish for service endpoint 2020-02-14 17:43:11 -04:00
Jeff Becker
e35d17764a * add path::Path::UniqueEndpointSet_t
* start using check2 for new unit tests
* unit test for path::Path::UniqueEndpointSet_t
2020-02-14 17:41:31 -04:00
Jeff Becker
2b6f27d60d
remove connect back logic for dead inbound sessions 2020-02-14 13:12:45 -05:00
Jason Rhinelander
c522bc0537 ghc::filesystem devendor to submodule
Also removed some unused/old options for conditionally not using
ghc::filesystem and a sodium option that wasn't used anywhere.
2020-02-13 15:47:11 -04:00
Jason Rhinelander
5a787de73b Switch abseil & nlohmann to submodules and update to latest stable
Our current abseil won't build with gcc 10 (its `optional`
implementation appears broken), and spews warnings under slightly older
compilers; updating to the latest stable 2019 branch fixes both issues.
2020-02-13 15:14:17 -04:00
Jeff
34cd64369b
Merge pull request #1095 from jagerman/warning-fix
Fix signed/unsigned comparison warning and make more std::chrono-y
2020-02-13 11:34:23 -05:00
Stephen Shelton
68d0cabcc5
Print an error when BDecodeReadFromFile() fails before calling DumpBuffer() 2020-02-13 08:19:10 -07:00
Jason Rhinelander
6a8d4aca38 Fix signed/unsigned comparison warning and make more std::chrono-y 2020-02-13 10:55:14 -04:00
Jeff Becker
837998eb88
rename variable 2020-02-12 12:53:53 -05:00
Jeff Becker
f6c4181e14
remove include 2020-02-12 12:43:10 -05:00
Jeff Becker
28561cd654
use Time_t 2020-02-12 12:10:48 -05:00
Jeff Becker
96c5553e34
rename variables 2020-02-12 12:10:48 -05:00
Jeff Becker
434ce56553
* get rid of dht explore for service nodes
* add Time_t using std::chrono for future uses
* make decaying hashset constructor with llarp_time_t explicit
* add decaying hashset implicit constructor using Time_t
* add timeouts for gossiper replay
* allow regossip of our RC
2020-02-12 12:10:48 -05:00
Jeff Becker
154be464ea
rc gossiping 2020-02-12 12:10:48 -05:00
Jeff Becker
7ad47f2dba
* get rid of dht explore for service nodes
* add Time_t using std::chrono for future uses
* make decaying hashset constructor with llarp_time_t explicit
* add decaying hashset implicit constructor using Time_t
* add timeouts for gossiper replay
* allow regossip of our RC
2020-02-12 12:10:48 -05:00
Jeff Becker
ea3851d15f
rc gossiping 2020-02-12 12:10:48 -05:00
Jeff
1403cff805
Merge pull request #1079 from majestrate/remove-dht-message-limit-2020-02-03
make message queue unbound for direct dht messages
2020-02-12 12:10:11 -05:00
Jeff
671c765161
Merge pull request #1085 from majestrate/check-for-initial-current-introset-2020-02-06
check for current introset being zero (initial state)
2020-02-12 11:44:39 -05:00
Jeff
4371ea469d
Merge pull request #1086 from majestrate/lokinetmon-update-2020-02-07
update lokinet monitor to work with iwp
2020-02-12 11:43:30 -05:00
Jeff Becker
792fd4132c
only make default endpoint non-reachable if no keyfile option presented 2020-02-12 09:56:36 -05:00
Jeff Becker
6c67cc1f01
make default endpoint non reachable by default 2020-02-12 09:54:59 -05:00
Jeff Becker
70eb353c42
make publishing introsets optional using reachable=false to disable 2020-02-11 16:48:36 -05:00
Jeff Becker
7374f8f0fd
update lokinetmon 2020-02-11 10:36:18 -05:00
Jeff
5901d0eb6b
Merge pull request #1092 from majestrate/reduce-iwp-multiack-frequency-2020-02-10
Reduce iwp multiack transmission frequency
2020-02-11 07:09:28 -05:00
Jeff
47db547378
Merge pull request #1088 from notlesh/add-iwp-stats-to-json-api-2020-02-07
Add IWP session stats to JSON API
2020-02-10 15:14:46 -05:00
Jeff Becker
8b77ec31ef
reduce number of multiack packets sent 2020-02-10 15:01:51 -05:00
Stephen Shelton
3d00feb08a
Make format 2020-02-10 12:51:54 -07:00
Stephen Shelton
7f0972d48e
Use name 'StateToString()' instead of ambiguous 'toString()' 2020-02-10 09:27:12 -07:00
Stephen Shelton
63ad7c8b91
Leave IWP session JSON stats 'tx' and 'rx' for compat 2020-02-10 09:17:40 -07:00
Jeff
8cad7fecbd
Merge pull request #1087 from majestrate/dont-flood-dht-2020-02-07
dont flood dht with requests, if we know of a router don't look it up
2020-02-08 11:26:07 -05:00
Jeff Becker
e8b84fcfbd
add path speed metrics for lokinetmon 2020-02-08 11:21:18 -05:00
Jeff
80a7b788bc
Merge pull request #1089 from majestrate/dht-introset-lookup-relayed-try-closer-2020-02-07
try closer router if relayed
2020-02-07 15:28:48 -05:00
Jeff Becker
00260555bd
logic simplification 2020-02-07 15:28:13 -05:00
Jeff Becker
e4a16dfdd5
fix comment 2020-02-07 15:22:58 -05:00
Jeff Becker
b211450cc8
always recurse to second closest if we don't have it 2020-02-07 15:20:47 -05:00
Jeff Becker
5b87a9419e
default recursion depth to 2 not 12 2020-02-07 14:55:08 -05:00
Jeff Becker
19d91a440f
move declaration of peer 2020-02-07 14:50:02 -05:00
Jeff Becker
3bea7327cb
handle end case by telling requester that it's not there 2020-02-07 14:46:12 -05:00
Jeff Becker
7e1a6236be
if relayed try closer router if we don't have an intro 2020-02-07 14:35:57 -05:00
Jeff Becker
a9331a1431
fix unit test 2020-02-07 13:48:56 -05:00
Stephen Shelton
2279ebeb40
Add IWP session stats to JSON API 2020-02-07 11:43:40 -07:00
Jeff Becker
cd27b33849
dont flood dht with requests, if we know of a router don't look it up 2020-02-07 13:19:00 -05:00
Jeff
0271f178d2
Merge pull request #1078 from jagerman/travis-bionic-and-arm
New travis arches + required endian fixes, libsodium build replacement
2020-02-07 10:26:55 -05:00