Skip to content

Implement WebSocket proxying#150

Merged
fifthsegment merged 2 commits into
masterfrom
feat-websocket-proxy
May 17, 2026
Merged

Implement WebSocket proxying#150
fifthsegment merged 2 commits into
masterfrom
feat-websocket-proxy

Conversation

@fifthsegment
Copy link
Copy Markdown
Owner

Replaces the WebSocket stub (which returned an error) with a proper TCP tunnel implementation.

gatesentryproxy/websocket.go```: Implement `HandleWebsocketConnection` to:
1. Hijack the client HTTP connection
2. Dial the upstream server via TCP
3. Forward the HTTP upgrade request in origin-form
4. Bridge bidirectional data between client and upstream (raw TCP tunnel)

The proxy already detected WebSocket upgrades at `proxy.go:383` and routed them to `HandleWebsocketConnection` — the function just returned an error. This change implements the actual proxying.

- **ws://** connections: handled by this implementation
- **wss://** connections: already worked via the existing CONNECT tunnel

Builds clean: `go build ./...` passes.

Replace the stub that rejected WebSocket connections with a
proper TCP tunnel implementation. The proxy now hijacks the
client connection, forwards the HTTP upgrade request to the
upstream server, and bridges bidirectional data flow.

This supports ws:// connections through the forward proxy.
wss:// connections were already handled transparently by the
existing CONNECT tunnel.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 17, 2026

🚀 PR Build Artifacts

Test binaries have been built for this PR (commit a169ff7).

Available Binaries:

  • gatesentry (0.00 MB)
  • gatesentry-linux-amd64 (18.82 MB)
  • gatesentry-linux-arm64 (17.89 MB)
  • gatesentry-macos-amd64 (18.66 MB)
  • gatesentry-macos-arm64 (17.98 MB)
  • gatesentry-windows-amd64.exe (16.60 MB)

Download Instructions:

  1. Via GitHub Actions UI:

    • Go to the Actions tab
    • Scroll down to "Artifacts" section
    • Download gatesentry-pr-150
  2. Via GitHub CLI:

    gh run download 25992177795 -n gatesentry-pr-150 -R fifthsegment/Gatesentry

Quick Test (Linux/macOS):

chmod +x gatesentry-*
./gatesentry-linux-amd64

Quick Test (Windows):

.\gatesentry-windows-amd64.exe

📝 Binaries are kept for 30 days and automatically deleted afterwards.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 17, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.19%. Comparing base (8074ddc) to head (a169ff7).
⚠️ Report is 3 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #150   +/-   ##
=======================================
  Coverage   19.19%   19.19%           
=======================================
  Files          70       70           
  Lines        4152     4152           
=======================================
  Hits          797      797           
  Misses       3310     3310           
  Partials       45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fifthsegment fifthsegment merged commit 44b1063 into master May 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants