https://github.com/mhaxanali/dns-resolver
A fast, multi-service DNS resolver with intelligent caching built with Go, Python, and vanilla JavaScript.
https://github.com/mhaxanali/dns-resolver
css dns go golang html js network python
Last synced: 3 months ago
JSON representation
A fast, multi-service DNS resolver with intelligent caching built with Go, Python, and vanilla JavaScript.
- Host: GitHub
- URL: https://github.com/mhaxanali/dns-resolver
- Owner: mhaxanali
- License: mit
- Created: 2025-11-29T07:01:14.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-11-30T14:27:07.000Z (7 months ago)
- Last Synced: 2025-12-02T21:15:52.146Z (7 months ago)
- Topics: css, dns, go, golang, html, js, network, python
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DNS Resolver
A fast, multi-service DNS resolver with intelligent caching and TTL-based cache expiration built with Go, Python, and vanilla JavaScript.
## Features
- **DNS Resolution:** Resolves domain names to IP addresses using Go's native `net` package
- **Smart Caching with TTL:** Python Flask service with SQLite backend caches results with configurable time-to-live
- **Cache Expiration:** Automatic cache invalidation after 1 day to ensure fresh results
- **Clean UI:** Minimalist dark-themed frontend for easy domain resolution
- **Multi-Service Architecture:** Go backend communicates with Python cache service
## Tech Stack
- **Backend API:** Go
- **Cache Service:** Python (Flask + SQLite)
- **Frontend:** HTML, CSS, JavaScript
- **Build Scripts:** Bash/Batch
## Architecture
```
Frontend (HTML/JS)
↓
Go Backend (port 8080)
↓
Python Cache Service (port 5050) + TTL validation
↓
SQLite Database
```
## Installation
### Prerequisites
- Go 1.20+
- Python 3.10+
### Build
**Linux/Mac:**
```bash
chmod +x scripts/build.sh
./scripts/build.sh
```
**Windows:**
```bat
scripts\build.bat
```
## Usage
**Linux/Mac:**
```bash
./scripts/run.sh
```
**Windows:**
```bat
scripts\run.bat
```
Then open `frontend/index.html` in your browser and start resolving domains.
## How It Works
1. User enters domain in frontend
2. Frontend calls Go API at `localhost:8080/lookup`
3. Go checks Python cache service at `localhost:5050`
4. Cache service validates TTL—if expired, returns cache miss
5. On cache miss, Go performs DNS lookup and stores result with timestamp
6. IP address returned to frontend and displayed
## Cache Behavior
- **TTL:** 1 hour (3600 seconds)
- **Expired entries:** Treated as cache misses, triggering fresh DNS lookup
- **Storage:** Domain, IP, and timestamp stored in SQLite
## Project Structure
```
dns-resolver/
├── backend/
│ ├── api/ # Go backend
│ ├── flask-server/ # Python cache service
│ ├── log/ # Logging utilities
│
├── resources/ # SQLite database
├── frontend/ # HTML/CSS/JS
└── scripts/ # Build and run scripts
```
## License
MIT
## Author
Muhammad Hasan - [GitHub](https://github.com/mhaxanali)