Documentation
¶
Overview ¶
Package wstack provides http.RoundTripper implementations that tunnel HTTP traffic through various proxy backends.
Available transports:
CORS Proxy — URL rewriting through a CORS proxy. Works everywhere. See NewCorsProxyTransport.
SOCKS5 over WebSocket — Routes through a SOCKS5 proxy behind a WebSocket relay. Works on all native Go platforms (linux/darwin). See NewSOCKS5OverWSTransport.
SSH over WebSocket — Routes through an SSH server behind a WebSocket relay. SSH direct-tcpip channels handle the proxying. Works on all native Go platforms. See NewSSHOverWSTransport.
Yamux over WebSocket — Multiplexes streams over a single WebSocket via yamux. Each stream carries a SOCKS5 handshake to convey the target address. All HTTP requests share one long-lived connection. Works on all native Go platforms. See NewYamuxOverWSTransport.
WebTransport — Routes through a WebTransport (QUIC) relay from the browser. Each stream runs a SOCKS5 handshake to convey the target address. Only compiles for GOOS=js GOARCH=wasm. See NewWebTransportTransport.
Index ¶
- Variables
- func NewCorsProxyTransport(proxyURL string) (http.RoundTripper, error)
- func NewSOCKS5OverWSTransport(wsRelayHost, socks5Host, socks5Port string) (*http.Transport, error)
- func NewSSHOverWSTransport(wsRelayHost, sshHost, sshPort, sshUser, sshPass string) (*http.Transport, error)
- func NewYamuxOverWSTransport(wsRelayHost string) (*http.Transport, error)
Constants ¶
This section is empty.
Variables ¶
var BaseTransport = http.DefaultTransport.(*http.Transport)
BaseTransport is the original http.DefaultTransport saved before any wrapping. Tools that clone the transport should use this.
Functions ¶
func NewCorsProxyTransport ¶ added in v0.0.2
func NewCorsProxyTransport(proxyURL string) (http.RoundTripper, error)
NewCorsProxyTransport returns an http.RoundTripper that rewrites all requests through the given CORS proxy URL prefix.
transport, err := NewCorsProxyTransport("https://no-cors.deno.dev/")
client := &http.Client{Transport: transport}
func NewSOCKS5OverWSTransport ¶
NewSOCKS5OverWSTransport creates an http.Transport that routes through a SOCKS5 proxy via a WebSocket-over-TLS relay.
- wsRelayHost: the WebSocket relay server (e.g. "websocket-tcp-proxy.dev")
- socks5Host: the SOCKS5 proxy server behind the relay
- socks5Port: the SOCKS5 proxy port
func NewSSHOverWSTransport ¶
func NewSSHOverWSTransport(wsRelayHost, sshHost, sshPort, sshUser, sshPass string) (*http.Transport, error)
NewSSHOverWSTransport creates an http.Transport that routes through a remote SSH server via a WebSocket-over-TLS relay. It works like "ssh -ND" but without binding a local port — SSH direct-tcpip channels handle the proxying from the remote side.
- wsRelayHost: the WebSocket relay server (e.g. "websocket-tcp-proxy.dev")
- sshHost: the SSH server hostname
- sshPort: the SSH server port
- sshUser: the SSH username
- sshPass: the SSH password
func NewYamuxOverWSTransport ¶
NewYamuxOverWSTransport creates an http.Transport that routes through a Cloudflare Worker via a single yamux-over-WebSocket connection. Each yamux stream carries a SOCKS5 handshake so the relay knows the target address — no custom framing needed.
- wsRelayHost: the Cloudflare Worker URL (e.g. "https://yamux-proxy.example.workers.dev")
Types ¶
This section is empty.