Development & Build
Layout
Section titled “Layout”hubproxy/├── src/ # Go backend├── web/ # Vue SPA├── Dockerfile└── docs/Add acceleration URLs
Section titled “Add acceleration URLs”Edit githubExps in src/handlers/github.go:
var githubExps = []*regexp.Regexp{ regexp.MustCompile(`^(?:https?://)?github\.com/([^/]+)/([^/]+)/(?:releases|archive)/.*`), // add new patterns here}Requirements:
- Include
([^/]+)/([^/]+)capture groups for[access]owner/repo matching - Run
go test ./handlers/... - Routes use
NoRoute(GitHubProxyHandler)inmain.go— no new route needed
Access control: src/utils/access_control.go → CheckGitHubAccess.
Add Docker Registry
Section titled “Add Docker Registry”config.toml → [registries]. Auth hook: createUpstreamOptions() in src/handlers/docker.go.
Add HTTP routes
Section titled “Add HTTP routes”Register in buildRouter() in src/main.go.
Local dev
Section titled “Local dev”cd src && CONFIG_PATH=./config.toml go run .cd web && npm ci && npm run devProduction embed:
cd web && npm ci && npm run build# copy dist to src/distcd ../src && go build -o hubproxy .Docker build
Section titled “Docker build”docker build -t hubproxy:local --build-arg VERSION=1.0.0 .
docker buildx build --platform linux/amd64,linux/arm64 \ -t ghcr.io/your-org/hubproxy:latest \ --build-arg VERSION=1.0.0 --push .| Stage | Image | Role |
|---|---|---|
| frontend | node:24-alpine | Vue build |
| builder | golang:1.26-alpine | Go + UPX |
| final | alpine | Runtime |
Test & release
Section titled “Test & release”cd src && go test ./...CI: .github/workflows/docker-ghcr.yml, release.yml.