optimize domain name matching
This commit is contained in:
32
README.md
32
README.md
@@ -8,7 +8,7 @@
|
||||
|
||||
---
|
||||
|
||||
updns is a simple DNS proxy server developed using `Rust`. You can intercept any domain name and return the ip you need.
|
||||
updns is a simple DNS proxy server developed using `Rust`. You can intercept any domain name and return the ip you need
|
||||
|
||||
## Install
|
||||
|
||||
@@ -20,7 +20,7 @@ Or use `cargo` to install
|
||||
cargo install updns
|
||||
```
|
||||
|
||||
## Start to use
|
||||
## Start to use 🚀
|
||||
|
||||
```bash
|
||||
updns
|
||||
@@ -28,9 +28,7 @@ updns
|
||||
updns -c /your/hosts
|
||||
```
|
||||
|
||||
You may use `sudo` to run this command because you will use the `53` port, make sure you have sufficient permissions.
|
||||
|
||||
Now change your local DNS server to `127.0.0.1` 🚀
|
||||
You may use `sudo` to run this command because you will use the `53` port
|
||||
|
||||
## Running in docker
|
||||
|
||||
@@ -65,31 +63,29 @@ Option:
|
||||
|
||||
## Config
|
||||
|
||||
You can use `updns config` command and then call `vim` quick edit, or use `updns path` find the updns's installation directory and edit the `config` file
|
||||
You can use `updns config` command and then call `vim` edit, or find `~/.updns/config` edit
|
||||
|
||||
You can specify standard domains, or utilize [regular expressions](https://rustexp.lpil.uk "rustexp") for dynamic matching,
|
||||
You can update the config file at any time, updns will listen for file changes
|
||||
You can specify standard domains, or utilize [regular expressions](https://rustexp.lpil.uk "rustexp") for dynamic matching
|
||||
|
||||
> Regular expression starts with `~`
|
||||
|
||||
```ini
|
||||
bind 0.0.0.0:53 # Binding address
|
||||
proxy 8.8.8.8:53 # Proxy address
|
||||
timeout 2000 # Proxy timeout (ms)
|
||||
bind 0.0.0.0:53 # Binding address
|
||||
proxy 8.8.8.8:53 # Proxy address
|
||||
timeout 2000 # Proxy timeout (ms)
|
||||
|
||||
# Domain matching
|
||||
example.com 1.1.1.1
|
||||
*.example.com 2.2.2.2
|
||||
^\w+\.example\.[a-z]+$ 3.3.3.3
|
||||
example.com 1.1.1.1
|
||||
*.example.com 2.2.2.2
|
||||
~^\w+\.example\.[a-z]+$ 3.3.3.3
|
||||
|
||||
# IPv6
|
||||
test.com ::
|
||||
|
||||
# Import from other file
|
||||
import /other/hosts
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
* Dynamically update port bindings
|
||||
|
||||
## Reference
|
||||
|
||||
[Building a DNS server in Rust](https://github.com/EmilHernvall/dnsguide)
|
||||
|
||||
Reference in New Issue
Block a user