Commit graph

454 commits

Author SHA1 Message Date
B. Blechschmidt
b8a08871d0 Support older Rust versions 2023-03-30 23:00:39 +02:00
B. Blechschmidt
69b5e6580c Adapt GitHub workflow to use dotenv 2023-03-30 01:52:29 +02:00
B. Blechschmidt
73f54c4a90 Adapt tests to use the setup functionality 2023-03-30 01:50:30 +02:00
B. Blechschmidt
a59be5a1af Whitespace change to make cargo fmt happy 2023-03-29 13:26:10 +02:00
B. Blechschmidt
0bfd3f2514 Remove obsolete comment 2023-03-29 13:21:35 +02:00
B. Blechschmidt
3c79fa6071 Enable automated setup for private IP addresses 2023-03-29 13:08:33 +02:00
B. Blechschmidt
e78a3f9a73 Add notes about half-open connections 2023-03-27 17:04:52 +02:00
ssrlive
eac87c4f9f refine code 2023-03-27 16:37:50 +02:00
B. Blechschmidt
94d70d11f4 Fix bug introduced by 86e7af0398 2023-03-27 12:14:43 +02:00
B. Blechschmidt
167059c9d8 Describe --setup-ip in README 2023-03-26 16:30:30 +02:00
B. Blechschmidt
86e7af0398 Prevent connection error bubbling from terminating the app 2023-03-26 15:22:22 +02:00
B. Blechschmidt
b12e00c0f5 Document --setup-ip 2023-03-26 11:07:06 +02:00
B. Blechschmidt
76e0b6fe1d Handle private IP addresses in setup 2023-03-26 11:03:15 +02:00
B. Blechschmidt
2a2b188c75 Make setup argument optional 2023-03-26 00:47:34 +01:00
B. Blechschmidt
d0c24b9f6a Improve setup error handling and describe the setup function in the README 2023-03-26 00:18:28 +01:00
B. Blechschmidt
bfface515d Only log the DNS A query 2023-03-25 22:25:57 +01:00
B. Blechschmidt
33892e28dc Improve code elegance in DNS cache removal function 2023-03-25 22:23:46 +01:00
B. Blechschmidt
58faf871c3 Fix copy and paste error 2023-03-25 21:52:58 +01:00
B. Blechschmidt
4a48b297f3 Restore network configuration on Drop 2023-03-25 21:41:40 +01:00
B. Blechschmidt
e4d4e0965e Add root privilege requirement notice 2023-03-25 21:18:45 +01:00
B. Blechschmidt
1a4a8c4c16 Add auto setup method 2023-03-25 21:12:41 +01:00
B. Blechschmidt
d4127af422 Add DNS hint
Virtual DNS intercepts the DNS queries generated by the machine. This
requires that the queries are actually sent through the tunnel
interface. In some scenarios, this is not automatically the case, for
example when `/etc/resolv.conf` contains a `nameserver` entry with some
local IP address for which there is a route through the ethernet
interface. A special-purpose IP address like 198.18.0.1 is unlikely to
be inside another route than the default route and can be used to force
DNS resolution through the tunnel.
2023-03-25 15:29:15 +01:00
B. Blechschmidt
20dc6f78f1 Refactor
This commit moves some essential types to lib and fixes one clippy
warning: https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
2023-03-25 13:07:49 +01:00
B. Blechschmidt
e6e6c70006 Fix formatting
IPv6 addresses without ports are not enclosed in brackets. They only get
enclosed in brackets in combination with a port.
2023-03-25 11:02:25 +01:00
ssrlive
d4410264e6 refine code 2023-03-25 16:44:33 +08:00
B. Blechschmidt
ce8ecbe44e Fix CI 2023-03-25 02:01:17 +01:00
B. Blechschmidt
a5aac8c0a4 Merge SOCKS4 support
The SOCKS4 tests in the CI pipeline will currently fail, as no SOCKS4
test server for automated testing has been set up yet.
2023-03-25 01:53:30 +01:00
B. Blechschmidt
341bab5586 Implement SOCKS4 2023-03-25 01:39:46 +01:00
B. Blechschmidt
c8e1872efe Add configuration notes 2023-03-24 22:28:59 +01:00
ssrlive
197b1c83a4 use thiserror to make error handler simple 2023-03-24 21:30:20 +01:00
ssrlive
bfa1bbc462 switch to smoltcp dev version
to support IpProtocol with Hash trait
2023-03-24 21:30:20 +01:00
B. Blechschmidt
4eddcfd02b Fix code style 2023-03-24 18:14:31 +01:00
B. Blechschmidt
8135ed3dce Handle poll interrupt gracefully 2023-03-24 18:11:23 +01:00
B. Blechschmidt
280073ebfe Fix test framework 2023-03-24 18:04:27 +01:00
B. Blechschmidt
5930b9b3b1 Merge improved error handling from ssrlive 2023-03-24 15:31:05 +01:00
B. Blechschmidt
83846fe631 Make virtual DNS more robust 2023-03-24 13:43:44 +01:00
B. Blechschmidt
3c8005e6b7 Use LRU cache for virtual DNS
This commit introduces an LRU cache for virtual DNS and fixes a bug
where the virtual DNS feature would cause connection mappings to time
out.
2023-03-24 13:26:31 +01:00
ssrlive
31e8d4791e remove s2e function 2023-03-24 16:32:47 +08:00
ssrlive
0fd5d85155 clean code 2023-03-24 15:57:54 +08:00
ssrlive
1d1e50c36a remove lots of unwrap() 2023-03-24 14:31:22 +08:00
ssrlive
ad388f897a refine TunToProxy struct 2023-03-24 09:27:31 +08:00
B. Blechschmidt
7dec7f59f1 Add some TODOs 2023-03-23 22:48:47 +01:00
B. Blechschmidt
7d3e37b1d9 Explain DNS feature in README 2023-03-23 22:44:04 +01:00
B. Blechschmidt
6b7f550e7a Enable virtual DNS by default for the CLI.
This commit enables virtual DNS by default for the CLI.

Pros for this decision:
  - It works out of the box in most cases.
  - Users do not need to install third-party software.
  - Users do not need to update their /etc/resolv.conf.

Cons:
  - Not every server might support this.
  - Hijacking port 53 without asking is somewhat intrusive.

Also, make the --dns argument an enum type. In the future, native
support for DNS over TCP/TLS might be added. In that case we could e.g.
supply tcp://1.1.1.1 to the --dns argument without breaking the CLI.
2023-03-23 22:13:35 +01:00
B. Blechschmidt
7695ba9c39 Increase DNS implementation robustness 2023-03-23 21:38:17 +01:00
B. Blechschmidt
846375a7d3 Improve readability of IP addresses 2023-03-23 19:02:20 +01:00
B. Blechschmidt
5295721461 Enable logging in tests 2023-03-23 18:11:08 +01:00
B. Blechschmidt
8be40a1fbd Squashed code beautifications
commit d5fdf845bf
Author: ssrlive <30760636+ssrlive@users.noreply.github.com>
Date:   Thu Mar 23 23:21:22 2023 +0800

    Update tun2proxy.rs

commit 2540daa423
Author: ssrlive <30760636+ssrlive@users.noreply.github.com>
Date:   Thu Mar 23 22:40:26 2023 +0800

    Update main.rs

commit 9ef5efb864
Author: ssrlive <30760636+ssrlive@users.noreply.github.com>
Date:   Thu Mar 23 22:19:06 2023 +0800

    Update main.rs

commit 017ea1a17a
Author: ssrlive <30760636+ssrlive@users.noreply.github.com>
Date:   Thu Mar 23 22:15:00 2023 +0800

    Update main.rs
2023-03-23 18:01:25 +01:00
B. Blechschmidt
d13c7ff61b Add DNS tests 2023-03-23 14:51:56 +01:00
ssrlive
32403c5423 remove the From implement 2023-03-23 21:39:27 +08:00