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

435 commits

Author SHA1 Message Date
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 b59a92aa01
add mx records to lns names 2021-03-02 07:21:05 -05:00
Jeff Becker ffef3bc48f
wire up sigusr1 to reset libunbound dns resolver 2021-02-17 13:32:55 -05:00
Jeff Becker 8239efa71b
clarify new member's purpose and name. add comment. 2021-02-17 07:54:18 -05:00
Jeff Becker 0600f42814
fix up names of functions to be less hidious. 2021-02-17 06:37:21 -05:00
Jeff Becker bd93a8f828
initial v6 exits 2021-02-16 10:59:57 -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 87c76a6769
add exit.localhost.loki cname record (#1440)
* add exit.localhost.loki cname record

* return cname in localhost.loki A/AAAA lookup reply

* correctly handle case where we have no exit

* typofix

* simplify logic
2020-10-31 11:59:03 -04:00
Jeff c81b6049f1
fix crashes on shutdown (#1433) 2020-10-29 10:19:45 -04:00
Thomas Winget a91bb35dbf
Some Windows fixes (#1415)
* Should fix some windows service issues

* fix return condition inversion

* Add some Trace level logging

also make the logger actually respect the log level you set.

* event loop should not queue things to itself...

at present, logic thread queue continues until it is empty, so
queueing things onto itself is just wasteful.

* call_later(foreach thing) is better than foreach thing (call later)

also if you already queued those things but they have not happened yet,
there is no sense to queue them to happen again.

* do not queue read on write finish, only on read finish

* failure to start DNS server should be proper startup failure.

without the DNS server working lokinet is...kinda pointless, right?

* format

* don't queue stuff to logic thread if in logic thread
the thing that clears the queue...clears it.  So you're just delaying and adding overhead.

* windows unbound thread sleep instead of just busy-waiting

also clang-format decided I can't have a blank line for some reason...

* fix unbound async worker on windows
2020-10-21 09:06:43 -04:00
Jeff 98e022ea21
Unflaky-ify lns dns (#1406)
* always ensure path to service on dns lookup

* deprecate profiles option
2020-10-12 13:55:58 -04:00
Jeff 5b5bd6b44e
dns features (#1404)
* add some dns txt records for stuff we want to expose

* fix txt records

* txt records for snode info

* dont send cname as it mangles the response

* check for 3 parts not 3 characters
2020-10-12 12:18:46 -04:00
Jeff 3b70b99dd2
fix empty config case (#1400)
* fix empty config case

* * fix case for empty ifname / ifaddr on relay
* bail if no dns server bound

* use AssignmentAcceptor
2020-10-09 11:39:39 -04:00
Jeff 50aea744f6
order packets when writing to network interface (#1372)
* order packet writes on userside

* make it compile

* fix pybind
2020-10-08 07:59:01 -04:00
Jeff 56f49a6980
make win32 exits work again (#1367) 2020-09-28 18:43:31 -04:00
Jeff 75ef28531e allow lns subdomains 2020-09-19 10:38:57 -04:00
Jeff 78b40d6725 wire up lns gotnamemessage handler to kitchen sink 2020-09-19 09:29:36 -04:00
Jeff 21930cf667
LNS (#1342)
* initial relay side lns

* fix typo

* add reserved names and refactor test for dns

* lns name decryption

* all wired up (allegedly)

* refact to use service::EncryptedName for LNS responses to include nonce with ciphertext

* fully rwemove tag_lookup_job

* replace lns cache with DecayingHashTable

* check for lns name validity against the following rules:

* not localhost.loki, loki.loki, or snode.loki

* if it contains no dash then max 32 characters long, not including the .loki tld (and also assuming a leading subdomain has been stripped)

* These are from general DNS requirements, and also enforced in
registrations:

* Must be all [A-Za-z0-9-]. (A-Z will be lower-cased by the RPC call).

* cannot start or end with a -

* max 63 characters long if it does contain a dash

* cannot contain -- in the third and fourth characters unless it starts with xn--

* handle timeout in name lookup job by calling the right handler with std::nullopt
2020-09-17 15:18:08 -04:00
Jeff 3ab7db7723
macos route poking (#1333)
* fix up macos route poker logic

* fix typo

* use string_view

* add forgotten header

* full paths

* add debugging

* catch exception on adding route

* workarround for macos

* typofix

* typofix

* fix for macos

* fix command for macos

* because we autopoke remove explicit route poking in rpc

* probably final fix of macos route poking

* split routes instead of deleting them

* dynamic route poking

* move log statement for introset lookup and dont consider bad sessions as able to send

* send convotag reset frame when we have no session

* add exit map to rpc

* use split_any
2020-09-03 18:22:22 -04:00
Thomas Winget 2c6e7b86c3
SRV records fixes (#1332)
* fix a log print log level

* correctly match SRV record service and protocol...

* tests for new dns question functions
2020-08-31 19:25:58 -04:00
Thomas Winget b1c14af938
SRV Record handling for introsets (#1331)
* update loki-mq submodule for tuple support

* srv record reply implementation

still need to encode srv records into intro sets / router contacts
as well as decode from them and match against queried service.proto

* inverted condition fix in config code

* SRV record struct (de-)serialization for intro sets

* parsing and using srv records from config (for/in introsets)

* adopt str utils from core and use for srv parsing

* changes to repeat requests

no longer drop repeat requests on the floor, but do not make
an *actual* request for them if one is in progress.

do not call reply hook for each reply for a request, as
each userland request is actually made into several lokinet
requests and this would result in duplicate replies.

* fetch SRVs from introsets for .loki

* make format

* dns and srv fixes, srv appears to be working
2020-08-31 16:07:17 -04:00
jeff 39f5e7213f set send timeout to 5 seconds for exits 2020-08-25 19:00:05 +00:00
jeff b0bb0b7609
initial route poking 2020-08-24 20:21:55 -04:00
Jeff Becker 80919a3b76
address feedback.
* use exceptions when fetching identity key instead of std::optional, will throw on fail
* fix up config options for endpoint auth and add better docs
* add llarp::serive::AuthType enum for controlling what kind of endpoint auth to use
2020-07-02 11:13:31 -04:00
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
2020-07-02 11:13:30 -04:00
Jeff Becker 5abf111159
endpoint auth whitelist 2020-07-02 11:07:33 -04:00
Jeff Becker a42d3d51c3
more 2020-07-02 11:07:33 -04:00
Jeff Becker 1899debfb5
unfug transit hops 2020-06-05 11:40:18 -04:00
Jeff Becker 6af498092b
exit traffic via loki addresses 2020-05-23 16:07:19 -04:00
Jason Rhinelander d05e6716cb Remove llarp::str(string_view)
It was a workaround for pre-C++17 std::string which didn't support
passing a string_view to various functions/operators.  There's only one
place left that needs an explicit conversion, and that's where it is
used as a map key; so just be explicit there and remove llarp::str()
everywhere else.
2020-05-21 17:05:30 -03:00
Jason Rhinelander 3bb24580a4 make format 2020-05-20 19:48:13 -03:00
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)
2020-05-20 19:18:27 -03:00
Stephen Shelton aee96e53a3
Refactor Addr -> IpAddress/SockAddr 2020-05-06 14:38:44 -06:00
Jeff Becker e33a1a2e0f
proper autodetect of ifname and ifaddr 2020-05-04 12:51:57 -04:00
Stephen Shelton 15918ff1c9
log-- 2020-05-04 11:07:21 -04:00
Stephen Shelton 960dc37c1f
Refactor TunEndpoint::Configure() (partially) 2020-05-04 11:07:21 -04:00
Stephen Shelton f2a26adcaa
Move all [endpoint] options to [network] 2020-05-04 11:07:21 -04:00
Stephen Shelton dd9ab0f1d5
Remove ability to have multiple endpoints/snodes from config 2020-05-04 11:07:21 -04:00
Stephen Shelton df01770466
Rename SnappConfig -> EndpointConfig 2020-05-04 11:05:51 -04:00
Stephen Shelton 93b35c92a7
Eradicate service::Config 2020-05-04 11:05:51 -04: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 Becker 67883aa945
when we have an inbound session and we do a forward dns lookup
we should not look up the descriptor on the network as we
already have a session with them
2020-03-28 16:26:16 -04:00
Jeff Becker 4452b152aa
add an A Record for random.snode so that it works 2020-03-12 08:19:37 -04:00
Jeff Becker 51516f751b return NS record for localhost.loki to squash errors in host lookups 2020-03-09 17:48:13 -03:00
Jason Rhinelander 6715b86d51 Fix IPv6 lookups to return empty response
The logic here wasn't quite right and was returning an A record in
response to an AAAA lookup.

This returns nothing, which is better, but not quite enough: this gives
empty responses, which produces warnings in host/dig.
2020-03-09 17:48:13 -03:00
Jeff f3d23d6fb6
strip rr from dns reply for .snode and .loki (#1172)
fix dns replies so that extra RR for edns are not included.
2020-03-09 17:47:27 -03: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 b4d6f89452
try extracting dns bind addr from INI on windows 2020-03-05 12:47:45 -06:00
Jason Rhinelander c0eb0c4db4 Avoid unnecessary copy 2020-03-01 13:56:04 -04: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 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
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
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 d2d109e92c
llarp_time_t is now using std::chrono 2020-02-24 15:25:03 -05:00
Jason Rhinelander 46242ba69b TrimWhiteSpace -> TrimWhitespace
Fix my dumb initial capitalization choice.
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 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
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 ee752c00e6
make format 2020-02-01 10:28:10 -05:00
Jeff Becker c014d21f84
use std::shared_ptr not a bare pointer to prevent memleak 2020-02-01 09:31:53 -05:00
Jeff Becker 79c3c748e4
limit number of snode sessions client side 2019-12-30 05:19:03 -05:00
Jeff Becker 92bbda600b
remove callsto Router::PumpLL and stuff gets faster (or stuff) 2019-12-09 16:59:13 -05:00
Jeff Becker 0c5c1aab1b
remove unneeded log statement 2019-12-04 08:06:16 -05:00
Jeff Becker a2fc35a7aa lower limit to 25ms 2019-11-29 19:11:14 -04:00
Jeff Becker 5924a2cec0 limit calls 2019-11-29 19:11:14 -04:00
Jeff Becker 0828307906 fix address mapping bug 2019-11-29 19:11:14 -04:00
Jeff Becker 5188873288 batch and flush 2019-11-29 19:11:14 -04:00
Jason Rhinelander d13a3d2b62 Don't flush here; we already have a tick flushing 2019-11-29 19:11:14 -04:00
Jeff Becker ba0fd223d9 reduce number of jobs we put onto the logic thread 2019-11-29 18:45:06 -04:00
Jeff Becker 6f95fbfece
work in progress 2019-11-22 16:23:20 -05:00
Jeff Becker 56dce90de9
add trace log level for tracking logic thread jobs 2019-11-22 16:23:19 -05:00
jeff 52757fef0e Merge remote-tracking branch 'micheal/background_mode' into vpn-api-2019-10-03 2019-10-04 14:10:58 -04:00
Jeff Becker 327c545530
finish multithread cryptography first pass 2019-09-16 12:12:05 -04:00
jeff 14c9ef15ed try calling stuff in logic thread from event loop 2019-09-16 06:21:12 -04:00
Jeff Becker 61ade40a51
reduce logging and make format 2019-09-09 07:36:21 -04:00
Jeff Becker e3bb59707e
more 2019-09-05 17:28:50 -04:00
Jeff Becker 1adae338ce
Merge remote-tracking branch 'origin/master' 2019-09-04 07:58:02 -04:00
Michael edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Michael 4d8fe2a8a8
Move meta programming to subdirectory 2019-09-03 20:52:28 +01:00
Jeff Becker c01112e4b7
tracy lock contention testing and other fun things 2019-09-03 11:56:56 -04:00
Michael 094b697b01
Replace StatusObject with underlying JSON type 2019-08-19 10:33:26 +01:00
Michael 16cdfbd5f0
clang-tidy modernize pass 2019-08-12 16:52:58 +01:00
Michael f9e9227e19
Fix gcc trunk warnings 2019-08-02 10:29:08 +01:00
Jeff Becker 8329aa0ee6
always rewrite address 2019-08-01 14:18:36 -04:00
Jeff Becker 2261885206
mark addresses as active when we use them 2019-08-01 08:20:51 -04:00
Jeff Becker f48754c45d
make hop count and length configurable 2019-07-18 12:28:17 -04:00
Michael e52492911d
Refactor endpoint state management to a new class 2019-07-15 10:15:51 +01:00
Jeff Becker 6882e627ba
make format 2019-07-12 10:07:12 -04:00
Jeff Becker 3ed8dec78b
use const reference and don't log invalid packets 2019-07-09 15:17:27 -04:00
Jeff Becker 0eb6431eb1
initialize tun with 0 and set defaults in correct places 2019-07-08 11:26:06 -04:00
Jeff Becker a781589b52
try fix for localhost.loki 2019-07-05 10:41:26 -04:00
Jeff Becker d6ec528a72
start work on seperating ips out of endpoint 2019-07-01 10:56:56 -04:00
Jeff Becker 64e9622270
start seperating tun and endpoint 2019-07-01 09:44:25 -04:00
Jeff Becker c60099002b
reverse dns for ipv6 2019-06-12 09:48:14 -04:00
Jeff Becker ec3ddfa425
typofixes 2019-06-11 18:29:45 -04:00
Jeff 8407c20b91
Merge branch 'ipv6-tun' into ipv6-tun 2019-06-11 17:46:47 -04:00
cathugger 72b1ea613c
make format 2019-06-12 00:28:55 +03:00
cathugger a9dac85c28
fix stuff 2019-06-12 00:27:06 +03:00
Jeff Becker a780789b2c
handle ipv6 exit traffic 2019-06-11 15:48:21 -04:00
Jeff Becker 0cf09d6435
make exits support v6 probably 2019-06-11 15:42:11 -04:00
Jeff Becker de51ef23bf
more 2019-06-11 14:23:53 -04:00
Jeff Becker 2403ab8f86
ipv6 2019-06-11 12:44:05 -04:00
Jeff Becker a33dbce680
try switching logic 2019-06-06 06:52:27 -04:00
Michael 75430a234c
Convert to use memFn 2019-06-02 22:19:10 +01:00
Jeff Becker 2ac89c0afb
DRY 2019-05-23 08:22:48 -04:00
Jeff Becker b679dd7341
fixit 2019-05-22 13:38:02 -04:00
Jeff Becker 64c7ed42fc
make format 2019-05-22 12:20:50 -04:00
Jeff Becker 9c96aecf3f
move llarp::Logic to std::shared_ptr
add sequence numbers to HSD messages

begin work on network isolation code

add more docs
2019-05-22 12:20:03 -04:00
Jeff 06f8bb2f42 add blacklist-snode option 2019-05-10 12:19:33 -04:00
Jeff Becker a53da68700
start work on sighup 2019-05-07 13:46:38 -04:00
Jeff Becker 728c6005a3
propagate strict-connect to tun handler for hooks 2019-05-06 08:42:21 -04:00
Jeff Becker 986e831579
make bundle-rc option configurable on snode tld 2019-05-02 14:11:44 -04:00
Jeff Becker e060082441
hook every dns for .loki and .snode when applicable
make {n,h}uint{32,16}_t templated type.
2019-05-01 09:40:10 -04:00
Jeff Becker bb47d612b3
more 2019-04-30 12:07:17 -04:00
Jeff Becker 5e0acc1197
separate upstream/downstream flush 2019-04-30 09:56:39 -04:00
Jeff 27fac68716 fix 2019-04-28 14:22:38 -04:00
Jeff 01906c5d94 Merge remote-tracking branch 'origin/master' 2019-04-28 13:33:27 -04:00
Jeff Becker fea64eaf12
handle subdomains 2019-04-26 08:14:29 -04:00
Jeff Becker d20ba9ceab
handle subdomains 2019-04-26 08:11:34 -04:00
Jeff Becker 6711296b26
finish converting to shared_ptr 2019-04-23 12:13:22 -04:00
Jeff Becker 8484e29c9b
turn more stuff into std::shared_ptr
remove dead codepaths
2019-04-23 10:47:23 -04:00
Jeff Becker c0d7b53328
make it work 2019-04-22 10:00:59 -04:00
Jeff Becker 3a8cb0bfb5
add shell based hooks for service::Endpoint, also make format 2019-04-22 08:25:25 -04:00
Michael 6bf54e0925
Remove AsyncKeyExchange, HiddenServiceAddressLookup and OutboundContext to their own components 2019-04-21 19:39:50 +01:00
Jeff Becker 351feadaec
make it work 2019-04-11 09:19:58 -04:00
Jeff Becker e178a70929
use shared_ptr for event loop 2019-04-08 08:01:52 -04:00
Jeff Becker 2f2b841c67
disable mx record dropping
add servfail
2019-04-05 12:39:43 -04:00
Jeff Becker c931ac069f
add AAAA records that return SIIT addresses 2019-03-27 09:36:11 -04:00
Jeff Becker 567efb9a92
Revert "move is_random_snode/is_localhost_loki into dns, llarp_HandleHookedDNSMessage() attempt at unification refactor between exit/tun handlers"
This reverts commit e388dc47eb.
2019-03-20 11:48:23 -04:00
Ryan Tharp e388dc47eb move is_random_snode/is_localhost_loki into dns, llarp_HandleHookedDNSMessage() attempt at unification refactor between exit/tun handlers 2019-03-20 03:28:58 +00:00
Ryan Tharp d02eec2bcf add note 2019-03-20 03:18:38 +00:00
Jeff Becker eceb55623c
more 2019-03-07 10:17:29 -05:00
Jeff Becker 159415c363
delay dns resolution for snode until we have a session with it 2019-03-01 14:10:42 -05:00
Michael 048fa83c39
Finish replacement of Router with AbstractRouter 2019-02-14 22:31:31 +00:00
Jeff Becker 46222df421
refactor 2019-02-11 12:14:43 -05:00
Jeff Becker e1522faeaa
add introspection rpc endpoint 2019-02-08 14:43:25 -05:00
Jeff Becker f84256d554
* lower lookup timeout for introsets
* correct previous commit for dns stuff
* allow for multiple parallel introset lookups
2019-02-06 10:05:25 -05:00
Jeff Becker b40055181d
lower path build timeout to 15s
tweak various dns stuff
2019-02-06 08:02:17 -05:00
Jeff Becker 5743ca7fba
revert dns behavior 2019-02-05 16:04:30 -05:00
Jeff Becker 2c2b31f4b9
make it compile 2019-02-05 09:23:51 -05:00
Jeff Becker 25fa4817ba
hook mx records for all hooked domains 2019-02-05 09:22:02 -05:00
Jeff Becker 41c993a237
disable A records for random.snode, use CNAME queries instead. 2019-02-05 09:08:17 -05:00
Jeff Becker 8c77c53675
reply with cname 2019-02-05 09:03:38 -05:00
Ryan Tharp 2bba8f01e8 don't return unknown IPs 2019-02-04 19:54:44 -08:00
Ryan Tharp 54549724d0 fix random.snode 2019-02-04 19:19:06 -08:00
Michael 7212baa062
Add implicit conversion from ManagedBuffer to llarp_buffer_t 2019-02-03 01:44:09 +00:00