yusing / go-proxy

Easy to use reverse proxy with docker integration
MIT License
99 stars 4 forks source link
docker go golang letsencrypt microservice reverse-proxy

go-proxy

A simple auto docker reverse proxy for home use. Written in Go

In the examples domain x.y.z is used, replace them with your domain

Table of content

Key Points

🔼Back to top

How to use

  1. Setup DNS Records to your machine's IP address

    • A Record: *.y.z -> 10.0.10.1
    • AAAA Record: *.y.z -> ::ffff:a00:a01
  2. Start go-proxy by

  3. Start editing config files

    • with text editor (i.e. Visual Studio Code)
    • or with web config editor by navigate to http://ip:8080

🔼Back to top

Tested Services

HTTP/HTTPs Reverse Proxy

TCP Proxy

UDP Proxy

🔼Back to top

Command-line args

go-proxy [command]

Commands

Examples:

🔼Back to top

Use JSON Schema in VSCode

Copy .vscode/settings.example.json to .vscode/settings.json and modify to fit your needs

{
  "yaml.schemas": {
    "https://github.com/yusing/go-proxy/raw/main/schema/config.schema.json": [
      "config.example.yml",
      "config.yml"
    ],
    "https://github.com/yusing/go-proxy/raw/main/schema/providers.schema.json": [
      "providers.example.yml",
      "*.providers.yml"
    ]
  }
}

🔼Back to top

Environment variables

🔼Back to top

Config File

See config.example.yml for more

Fields

🔼Back to top

Provider Kinds

🔼Back to top

Provider File

Fields are same as docker labels starting from scheme

See providers.example.yml for examples

🔼Back to top

Supported DNS Challenge Providers

To add more provider support, see this

🔼Back to top

Troubleshooting

Q: How to fix when it shows "no matching route for subdomain \"?

A: Make sure the container is running, and \ matches any container name / alias

🔼Back to top

Benchmarks

Benchmarked with wrk connecting traefik/whoami's /bench endpoint

Remote benchmark (client running wrk and go-proxy server are different devices)

Local benchmark (client running wrk and go-proxy server are under same proxmox host but different LXCs)

🔼Back to top

Known issues

🔼Back to top

Memory usage

It takes ~15 MB for 50 proxy entries

🔼Back to top

Build it yourself

  1. Install / Upgrade go (>=1.22) and make if not already

  2. Clear cache if you have built this before (go < 1.22) with go clean -cache

  3. get dependencies with make get

  4. build binary with make build

  5. start your container with make up (docker) or bin/go-proxy (binary)

🔼Back to top