Repository navigation
Make the code do what the docs promised: per-client limits, tier bandwidth, env precedence #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Builds the image on CI to prove the Dockerfile still works. | ||
| # | ||
| # This never pushes anywhere. There is no registry, no credentials and no tag to | ||
| # manage: the only output is a build that either succeeds or fails, which is the | ||
| # thing that was previously unverified. The xray download and its checksum are | ||
| # the fragile part -- a moved release URL, a re-signed artifact or a changed | ||
| # base image breaks the build -- and none of that shows up in `go test`. | ||
| # | ||
| # Single architecture on purpose. The Dockerfile resolves a different xray per | ||
| # TARGETARCH, and verifying both on every run would double the build time to | ||
| # re-check something that changes only when the pin does. Change the pin and | ||
| # both paths are exercised by the local build on the target machine. | ||
|
|
||
| name: Docker | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| paths: | ||
| - "Dockerfile" | ||
| - ".dockerignore" | ||
| - "go.mod" | ||
| - "go.sum" | ||
| - "*.go" | ||
| - "web/**" | ||
| - ".github/workflows/docker.yml" | ||
| pull_request: | ||
| paths: | ||
| - "Dockerfile" | ||
| - ".dockerignore" | ||
| - "go.mod" | ||
| - "go.sum" | ||
| - "*.go" | ||
| - "web/**" | ||
| - ".github/workflows/docker.yml" | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build the image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64 | ||
| # load, not push: the image has to land in the local daemon so the | ||
| # smoke test below can run it. Nothing leaves the runner. | ||
| load: true | ||
| push: false | ||
| tags: socks5-proxy:ci | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| # A successful build says the image assembles. This says it runs: the | ||
| # health endpoint answers, and the diagnostics that used to identify a | ||
| # deployment are behind auth. | ||
| - name: Smoke test the image | ||
| run: | | ||
| set -euo pipefail | ||
| docker run -d --name ci-test -p 18080:8080 socks5-proxy:ci | ||
| for i in $(seq 1 30); do | ||
| if curl -fsS http://127.0.0.1:18080/health >/dev/null 2>&1; then break; fi | ||
| if [ "$i" = "30" ]; then | ||
| echo "server never became healthy; container log:" | ||
| docker logs ci-test | ||
| exit 1 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| echo " /health: $(curl -fsS http://127.0.0.1:18080/health)" | ||
| health=$(curl -fsS http://127.0.0.1:18080/health) | ||
| case "$health" in | ||
| *version*|*uptime*) echo "FAIL: /health leaks version or uptime: $health"; exit 1 ;; | ||
| esac | ||
| code=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:18080/metrics) | ||
| echo " /metrics: $code (want 401 without credentials)" | ||
| if [ "$code" != "401" ]; then | ||
| echo "FAIL: the metrics dashboard is reachable without credentials" | ||
| exit 1 | ||
| fi | ||
| # xray must be present in the image even with REALITY disabled, | ||
| # otherwise enabling it on a real host fails at startup. | ||
| docker exec ci-test xray version | head -1 | ||
| docker rm -f ci-test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include
config.jsonin both path filters.The Dockerfile copies
config.jsoninto the image. A pull request that changes onlyconfig.jsonskips this workflow, so the build and smoke test cannot catch a broken runtime configuration. Addconfig.jsonto both filters.Also applies to: 28-35
🤖 Prompt for AI Agents