Files
chisel/client/client_proxy_test.go
Jaime PilloraandClaude Fable 5 e588d2163e 1.12: reliability & security pass (#609)
Reliability, security, and observability across client/server/tunnel:
keepalive ping timeouts, TCP half-close propagation, dial-before-accept,
graceful SIGTERM shutdown, UDP flow-cap sweep, pre-auth WS size cap,
SOCKS ACL enforcement + live authfile reload, exact legacy-fingerprint
match, --auth validation, session/failed-login logs, #608 panic fix,
goreleaser multi-arch Docker images, and a two-stage release pipeline
(draft + versioned images at tag time; latest promoted on publish).

Full detail: 1.12-changes.md, the PR (34 commits), and
https://jpillora.com/chisel-112-ux-review

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-18 01:10:50 +10:00

40 lines
1010 B
Go

package chclient
import (
"net/url"
"testing"
"github.com/gorilla/websocket"
)
func TestSetProxySchemes(t *testing.T) {
//all socks variants use the same SOCKS5 dialer
for _, scheme := range []string{"socks", "socks5", "socks5h"} {
u, err := url.Parse(scheme + "://127.0.0.1:1080")
if err != nil {
t.Fatal(err)
}
d := &websocket.Dialer{}
if err := (&Client{}).setProxy(u, d); err != nil {
t.Fatalf("%s:// rejected: %v", scheme, err)
}
if d.NetDial == nil {
t.Fatalf("%s:// did not install the socks dialer", scheme)
}
}
//http CONNECT proxies pass through
u, _ := url.Parse("http://127.0.0.1:8080")
d := &websocket.Dialer{}
if err := (&Client{}).setProxy(u, d); err != nil {
t.Fatal(err)
}
if d.Proxy == nil {
t.Fatal("http:// did not set the CONNECT proxy")
}
//unknown socks variants are rejected
u, _ = url.Parse("socks4://127.0.0.1:1080")
if err := (&Client{}).setProxy(u, &websocket.Dialer{}); err == nil {
t.Fatal("socks4:// unexpectedly accepted")
}
}