Commit graph

39 commits

Author SHA1 Message Date
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
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
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
5930b9b3b1 Merge improved error handling from ssrlive 2023-03-24 15:31:05 +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
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
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
846375a7d3 Improve readability of IP addresses 2023-03-23 19:02:20 +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
ssrlive
32403c5423 remove the From implement 2023-03-23 21:39:27 +08:00
B. Blechschmidt
4260e28a52 Improve code style 2023-03-23 13:24:33 +01:00
B. Blechschmidt
3de8b992d4 Merge branch 'ssrlive' into dns-robustness 2023-03-23 13:21:54 +01:00
B. Blechschmidt
c9297124e1 Implement first, unfinished version of DNS support and fix incomplete TCP stream bug
This commit does two things:
First, it implements a first, unfinished version of the virtual DNS
functionality. This feature is incomplete and has known bugs. Since it
needs to be enabled manually, this is not a huge issue so far.
Second, the commit fixes a bug where TCP streams where not properly
relayed, causing TCP connections to stall.
2023-03-23 13:03:01 +01:00
ssrlive
d4eed896bb SocketAddr issues 2023-03-23 20:00:59 +08:00
ssrlive
6fe44f8055 IpProtocol values 2023-03-23 18:31:09 +08:00
ssrlive
4af656039e refine code 2023-03-23 16:47:44 +08:00
B. Blechschmidt
1a5eeece6f Prepare DNS support 2023-03-22 19:11:28 +01:00
ssrlive
e637a55e6a move error handler to a separate module 2023-03-22 15:51:08 +01:00
B. Blechschmidt
e509a81d67 Supply Proxy type to main_entry instead of individual args and adapt test cases 2023-03-22 13:18:07 +01:00
B. Blechschmidt
2f295c3fdc Use Option type for credentials
This commit applys the diff by @ssrlive from
3223ca4e22 (commitcomment-105521241).
2023-03-22 12:18:41 +01:00
B. Blechschmidt
d2aef08e3c Implement SOCKS5 authentication 2023-03-22 01:02:27 +01:00
B. Blechschmidt
c1aaec6159 Make manager references immutable 2023-03-21 01:08:44 +01:00
B. Blechschmidt
53458fe84f Apply clippy suggestions 2023-03-20 18:20:55 +01:00
B. Blechschmidt
2f4be7a6cd Run cargo fmt 2023-03-20 17:56:54 +01:00
B. Blechschmidt
95820d6e31 Add IPv6 support 2023-03-20 16:36:54 +01:00
B. Blechschmidt
5a9903e82e Update smoltcp to version 0.9 2023-03-20 16:17:59 +01:00
ssrlive
25d775af47
remove clippy warning 2023-03-19 14:27:01 +08:00
B. Blechschmidt
be3d7e314b Check whether connection is still active upon mio event
Fix issue #3
2022-12-10 21:29:57 +01:00
B. Blechschmidt
41c22fa4d4 Improve README and do not panic when reading from proxy fails 2022-08-17 00:04:08 +02:00
Nikolai Vincent Vaags
c5e95fcc14 Use log for logging 2022-08-16 16:18:25 +02:00
Elvis Gallagher
8d408bbe76 Cleaning and update 2022-08-01 14:36:58 +00:00
B. Blechschmidt
93f0444028 Remove redundant HashMap 2021-09-02 22:36:47 +02:00
B. Blechschmidt
5b6ac8b206 Improve error handling 2021-09-02 21:59:56 +02:00
B. Blechschmidt
6607df83cd Initial commit 2021-09-02 15:02:19 +02:00