Skip to content

Latest commit

 

History

History
135 lines (90 loc) · 2.81 KB

File metadata and controls

135 lines (90 loc) · 2.81 KB

Proxy Panel (Go) 🔧

Short: Web admin panel + API in Go for managing TCP/UDP forwarding proxies with live metrics (WebSockets) and multi-user support.


🚀 Features

  • Web Panel with a modern dark theme
  • Multiple users (configured in config.yml) with an admin flag to view all proxies
  • Proxy ownership: each proxy is owned by a user (Owner)
  • REST API to create / delete / list proxies (W.I.P)
  • Live metrics via WebSockets (bits/s, connections, open counts)
  • MySQL / SQLite persistence for proxies; MongoDB optional for metrics

🧭 Requirements

  • Go 1.20+ (to build)
  • MySQL (you need mySQL)
  • MongoDB (you also need Mongo)

⚙️ Configuration

Config file: config.yml (see config.example.yml)

Important fields:

  • server.address: address e.g. ":80"
  • users: list of users
    • username, password, admin: true|false
  • port_ranges: allowed external port ranges
  • mysql_dsn: optional DSN for MySQL

Example:

server:
  address: ":80"
  external_fqdn: "proxy.example.com"

users:
  - username: "admin"
    password: "secret"
    admin: true
  - username: "user1"
    password: "pw1"
    admin: false

port_ranges:
  - "10000-30000"

🏁 Quick Start (local)

  1. Copy the example config and edit it:
cp config.example.yml config.yml
# edit config.yml
  1. Build (recommended: without CGO for a static binary):
# static build without CGO
CGO_ENABLED=0 go build -o proxyd ./cmd/proxyd
  1. Run:
./proxyd
  1. Open the web panel: http://<server>/ (Basic Auth)

🔒 Auth & Multi-User

  • Basic HTTP Auth is used for the web UI and API; users are defined in config.yml.
  • Admin users (admin: true) see the "Show All Proxies" button and can list all proxies.
  • Proxies created via the UI/API are assigned an Owner (username).

📈 Live Metrics

  • The dashboard uses WebSockets (gorilla/websocket) for real-time updates.
  • Live metrics are shown in bits/s (Kbit/Mbit/Gbit) with one decimal place.
  • The index page shows per-proxy up/down indicators.

🧰 Deployment Notes

Minimal systemd unit example:

[Unit]
Description=Proxy Panel
After=network.target

[Service]
User=proxy
WorkingDirectory=/opt/proxyd
ExecStart=/opt/proxyd/proxyd -config /opt/proxyd/config.yml
Restart=on-failure

[Install]
WantedBy=multi-user.target

🐛 Troubleshooting

  • Build hangs while linking: try CGO_ENABLED=0 to avoid the C linker.
  • If you want no logs in the console: run nohup ./proxyd >/dev/null 2>&1 & or set log.SetOutput(ioutil.Discard) in the code and log only errors explicitly.
  • Port in use: check ss -ltnp and free the port or change server.address in config.yml.

🤝 Contributing

  • PRs and issues welcome.
  • Please include tests for new functionality where appropriate.