A high-performance, Cloudflare-like platform with Bot Protection, Rate Limiting, and DDoS Mitigation at both HTTP (Layer 7) and DNS layers.
- 🛡️ Bot Protection: IP and User-Agent based blocking
- ⏱️ Rate Limiting: Redis-based token bucket (HTTP + DNS)
- 🚫 Anti-DDoS: Request throttling and IP blocking
- 📊 Analytics: High-performance ClickHouse storage
- 🌐 DNS Server: Authoritative DNS with A, CNAME, TXT, MX records
- 🔀 Reverse Proxy: Layer 7 HTTP proxy with security filtering
- Language: Go 1.20+
- Router: Chi
- Database: PostgreSQL (configuration), ClickHouse (analytics)
- Cache: Redis (rate limiting)
- DNS: github.com/miekg/dns
-
Start infrastructure:
docker-compose up -d
-
Apply migrations:
docker exec -i goflare_postgres psql -U user -d goflare < migrations/001_create_domains_table.sql docker exec -i goflare_postgres psql -U user -d goflare < migrations/002_create_bot_rules_table.sql docker exec -i goflare_postgres psql -U user -d goflare < migrations/004_create_dns_records_table.sql docker exec -i goflare_clickhouse clickhouse-client --password "" --database goflare_analytics < migrations/003_create_requests_table_clickhouse.sql
-
Run server:
go run cmd/server/main.go
POST /api/v1/domains- Add a domainGET /api/v1/domains- List domains
POST /api/v1/bot/rules- Add bot ruleGET /api/v1/bot/rules- List rules
┌─────────────────────────────────────────────────────┐
│ Client │
└─────┬───────────────────────────────────┬───────────┘
│ │
│ DNS Query (8053) │ HTTP Request (8080)
│ │
┌─────▼──────────────┐ ┌──────▼─────────────┐
│ DNS Server │ │ HTTP Proxy │
│ (Authoritative) │ │ (Reverse Proxy) │
└─────┬──────────────┘ └──────┬─────────────┘
│ │
└───────────┬───────────────────────┘
│
┌─────▼──────────┐
│ Engine Core │
│ • Bot Check │
│ • Rate Limit │
│ • Analytics │
└────────────────┘
See .env.example for available environment variables.
MIT