From 7d3e37b1d99ed7ce885f7c667ce4877d42340cde Mon Sep 17 00:00:00 2001 From: "B. Blechschmidt" Date: Thu, 23 Mar 2023 22:44:04 +0100 Subject: [PATCH] Explain DNS feature in README --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 75fa56a..0102a15 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,13 @@ sudo ip route add 0.0.0.0/1 dev tun0 Note that if you paste these commands into a shell script, which you then run with `sudo`, you might want to replace `$USER` with `$SUDO_USER`. -For DNS to work, you might need an additional tool like [dnsproxy](https://github.com/AdguardTeam/dnsproxy) that is -configured to listen on a local UDP port and communicates with the upstream DNS server via TCP. +This tool implements a virtual DNS feature that is used by default. When a DNS packet to port 53 is detected, an IP +address from `198.18.0.0/15` is chosen and mapped to the query name. Connections destined for an IP address from that +range will supply the proxy with the mapped query name instead of the IP address. Since many proxies do not support UDP, +this enables an out-of-the-box experience in most cases, without relying on third-party resolvers or applications. +Depending on your use case, you may want to disable this feature using `--dns none`. +In that case, you might need an additional tool like [dnsproxy](https://github.com/AdguardTeam/dnsproxy) that is +configured to listen on a local UDP port and communicates with a third-party upstream DNS server via TCP. When you terminate this program and want to eliminate the impact caused by the above several commands, you can execute the following command. The routes will be automatically deleted with the tunnel device. @@ -52,15 +57,17 @@ Tunnel interface to proxy. Usage: tun2proxy [OPTIONS] --proxy Options: - -t, --tun Name of the tun interface [default: tun0] - -p, --proxy The proxy URL in the form proto://[username[:password]@]host:port - -h, --help Print help - -V, --version Print version + -t, --tun Name of the tun interface [default: tun0] + -p, --proxy Proxy URL in the form proto://[username[:password]@]host:port + -d, --dns DNS handling [default: virtual] [possible values: virtual, none] + -h, --help Print help + -V, --version Print version ``` Currently, tun2proxy supports two proxy protocols: HTTP and SOCKS5. A proxy is supplied to the `--proxy` argument in the URL format. For example, an HTTP proxy at `1.2.3.4:3128` with a username of `john.doe` and a password of `secret` is supplied as `--proxy http://john.doe:secret@1.2.3.4:3128`. This works analogously to curl's `--proxy` argument. ## TODO +- Increase error robustness (reduce `unwrap` and `expect` usage) - UDP support for SOCKS -- Virtual DNS +- Native support for proxying DNS over TCP or TLS