mirror of
https://github.com/DevVoxel/vectordns-server.git
synced 2026-02-27 01:40:12 +00:00
605e9dca5df56742e6182891074cefc2ccda33b2
VectorDNS Go Server
A lightweight Go DNS lookup microservice powered by Chi and miekg/dns.
Quick Start
# Copy env config
cp .env.example .env
# Install dependencies
go mod tidy
# Run the server
go run ./cmd/server
The server starts on http://localhost:8080.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /healthz |
Health check |
| POST | /api/v1/dns/lookup |
DNS record lookup |
DNS Lookup
curl -X POST http://localhost:8080/api/v1/dns/lookup \
-H "Content-Type: application/json" \
-d '{"domain": "example.com", "types": ["A", "MX"]}'
If types is omitted, all 9 record types are queried (A, AAAA, MX, TXT, NS, CNAME, SOA, CAA, SRV).
Configuration
All config is via environment variables (or .env file):
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Server port |
API_KEY |
(empty) | API key for auth (disabled if empty) |
CORS_ORIGINS |
http://localhost:3000 |
Comma-separated allowed origins |
LOG_FORMAT |
text |
text or json |
Docker
docker build -t vectordns-server .
docker run -p 8080:8080 --env-file .env vectordns-server
Tech Stack
- Router: Chi v5
- DNS: miekg/dns
- Logging: stdlib
log/slog - Rate Limiting: go-chi/httprate
- CORS: go-chi/cors
Description
Languages
Go
96.2%
Dockerfile
3.8%