https://github.com/bujosa/dns-resolver
This is a simple project in rust for creating a Dns Resolver
https://github.com/bujosa/dns-resolver
dns dns-resolver docker rust warp
Last synced: 2 months ago
JSON representation
This is a simple project in rust for creating a Dns Resolver
- Host: GitHub
- URL: https://github.com/bujosa/dns-resolver
- Owner: bujosa
- License: mit
- Created: 2023-11-21T05:03:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-26T22:27:17.000Z (over 2 years ago)
- Last Synced: 2025-03-11T10:53:20.266Z (over 1 year ago)
- Topics: dns, dns-resolver, docker, rust, warp
- Language: Rust
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DNS Resolver
This project is a simple DNS resolver written in Rust. It uses the `trust-dns-resolver` crate to perform DNS lookups asynchronously.
## Features
- Asynchronous DNS resolution using the Tokio runtime.
- Error handling for failed DNS lookups.
- Prints the IP address of a given domain name.
## Example Usage
This DNS resolver runs as a web server and listens for POST requests on the `/resolve` endpoint. The POST request should contain a JSON body with a `url` field.
Run the server with the following command:
```bash
cargo run
```
Here's an example of how to use `curl` to send a POST request to the server:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"url":"www.google.com"}' http://localhost:3030/resolve
```
This will send a request to resolve the IP address of "www.google.com". The server will respond with a string containing the IP address or an error message.
## Dependencies
This project uses the following crates:
- `trust-dns-resolver` for DNS resolution.
- `tokio` for asynchronous programming.
- `warp` for web server functionality.
- `serde` for serialization and deserialization.
## Architecture Diagram
Below is the architecture diagram of the DNS Resolver:
