Sign inSign up

jefriherditriyanto/golang-proxy

By jefriherditriyanto

Updated 3 months ago

A high-performance dynamic reverse proxy written in Go.

Image
Networking
Security
API management
0

396

jefriherditriyanto/golang-proxy repository overview

Go Vue SQLite Docker

Golang Proxy

A high-performance dynamic reverse proxy written in Go with a professional Vue 3 web dashboard. Route traffic with static or dynamic targets, enforce IP blocklists, validate requests through middleware, and manage Let's Encrypt SSL certificates — all from a single binary.


Features

  • Dual HTTP Servers — LISTEN (proxy traffic) and SERVER (admin dashboard) run concurrently on separate ports.
  • Static Routing — Forward traffic from a domain/path prefix directly to a target URL.
  • Dynamic Routing — Resolve target destinations at runtime by calling an external backend resolver.
  • Validation Middleware — Optionally forward request context to a validation endpoint; proceed only on 2xx.
  • IP Blocklist — Database-driven; blocked IPs immediately receive 403 Forbidden.
  • Auto SSL — Let's Encrypt integration via autocert with per-domain toggle.
  • Web Dashboard — Manage routes, blocklist, view activity logs, and monitor metrics with real-time charts.
  • Live Traffic Terminal — Click any route to open an xterm.js terminal streaming proxy traffic via SSE.
  • Request Inspection — Click any log entry to see full request/response headers and body.
  • Dark / Light Mode — Toggle with localStorage persistence.
  • Single Binary — Frontend assets embedded via embed.FS. No external web server needed.
  • Multi-arch Dockerlinux/amd64 + linux/arm64 via buildx.

Quick Start

Docker
docker run -d \
  -p 80:80 \
  -p 443:443 \
  -p 8080:8080 \
  -p 8000:8000 \
  -v golang-proxy-data:/app/database \
  -e SERVER_USERNAME=admin \
  -e SERVER_PASSWORD=admin \
  --name golang-proxy \
  jefriherditriyanto/golang-proxy:latest

Mount -v golang-proxy-data:/app/database to persist routes, logs, blocklist, and SSL certs across container restarts.

Dashboard: http://localhost:8000 (login: admin / admin) Proxy listener: http://localhost:8080

From Source
# Frontend
bun install
bun run build

# Backend
go build -o go-proxy .
./go-proxy

Requires Go 1.22+ and Bun (or Node 20+).


Environment Variables

VariableDefaultDescription
LISTEN_PORT8080Port for incoming proxy traffic
SERVER_PORT8000Port for admin dashboard + API
SERVER_USERNAMEadminBasic auth username for dashboard
SERVER_PASSWORDadminBasic auth password for dashboard
GO_ENVSet to local to proxy frontend assets to Vite dev server at localhost:5173

SSL is enabled per-route via the ssl_active field in the Routes dashboard. The Let's Encrypt infrastructure (ports 80/443) runs automatically — just toggle SSL on any route and certs are provisioned.


Architecture

                     ┌─────────────────┐
                     │   Golang Proxy  │
                     │                 │
  Client ──────────► │ LISTEN :8080    │ ──► Target Server
                     │  • Route match  │
                     │  • IP blocklist │
                     │  • Validation   │
                     │  • SSL (ACME)   │
                     │                 │
  Admin  ──────────► │ SERVER :8000    │
                     │  • Dashboard UI │
                     │  • REST API     │
                     │  • SSE Streams  │
                     │  • Basic Auth   │
                     │                 │
                     │  SQLite (GORM)  │
                     └─────────────────┘

Tech Stack

LayerTechnology
Proxy EngineGo 1.24, net/http, autocert
ORMGORM + SQLite3
FrontendVue 3, TypeScript, Vite
StylingTailwind CSS v4
StatePinia
ChartsHighcharts
Iconsvue-icons-plus
Terminalxterm.js
ValidationZod
Dev ToolsESLint, Oxlint, vue-tsc, vue-doctor

Dashboard Pages

PageDescription
OverviewReal-time metrics (SSE): total requests, success rate, latency, volume/status charts
RoutesCRUD proxy routes (static/dynamic), Log URL Prefix filter, live traffic terminal per route
Block ListAdd/remove IPs from the blocklist with reason tracking
LogsRequest log stream with detail inspector (headers, body, status, latency) and clear-all

License

MIT

Tag summary

Content type

Image

Digest

sha256:74fb51fa0

Size

41.1 MB

Last updated

3 months ago

docker pull jefriherditriyanto/golang-proxy