terrible codes for learning rust
- Rust 44.5%
- Go 37.5%
- Makefile 18%
|
|
||
|---|---|---|
| go | go | |
| rust | go | |
| .gitignore | go | |
| LICENSE | Initial commit | |
| makefile | go | |
| README.md | conflict | |
DNS Server
A simple DNS server that responds to DNS queries by returning the requester's IP address.
Description
This DNS server listens on UDP port 5353 and responds to DNS queries with the IP address of the client making the request. It's a minimal implementation that demonstrates basic DNS packet handling.
Building
cargo build --release
Running
cargo run
Or run the release binary:
cargo run --release
The server will listen on 0.0.0.0:5353 (all network interfaces on port 5353).
Testing
You can test the server using dig or nslookup:
dig @127.0.0.1 -p 5353 example.com
The server will respond with your local IP address (127.0.0.1 if querying locally).
Note
Port 5353 is used instead of the standard DNS port 53, which typically requires root/administrator privileges.