From 22eb86d08ed583cd386ed6408eb1d2024a240bba Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Wed, 14 Oct 2026 01:56:32 +0000 Subject: [PATCH] test(p2p): sync SupportedDialer test with the widened whitelist 5b85e90 widened the inner-dialer whitelist to wss/grpc/http2/h2/ssh/sshd/mwss but left the test asserting fail-closed for grpc and http2, so TestSupportedDialer failed on every machine. Update the test list to match the implementation (kcp/quic stay fail-closed) and refresh the stale doc comment that still claimed http2 probes and destroys tunnels. --- p2p/plugin/grpc_test.go | 4 ++-- p2p/tunnel_dialer.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/p2p/plugin/grpc_test.go b/p2p/plugin/grpc_test.go index e62235a..6307d2e 100644 --- a/p2p/plugin/grpc_test.go +++ b/p2p/plugin/grpc_test.go @@ -396,12 +396,12 @@ func TestHandshakeForward(t *testing.T) { } func TestSupportedDialer(t *testing.T) { - for _, name := range []string{"tcp", "tls", "ws", "mtcp", "mtls", "mws", "udp"} { + for _, name := range []string{"tcp", "tls", "ws", "wss", "grpc", "http2", "h2", "ssh", "sshd", "mtcp", "mtls", "mws", "mwss", "udp"} { if !xp2p.SupportedDialer(name) { t.Errorf("SupportedDialer(%q) = false, want true", name) } } - for _, name := range []string{"kcp", "quic", "grpc", "http2", ""} { + for _, name := range []string{"kcp", "quic", "bogus", ""} { if xp2p.SupportedDialer(name) { t.Errorf("SupportedDialer(%q) = true, want false (fail closed)", name) } diff --git a/p2p/tunnel_dialer.go b/p2p/tunnel_dialer.go index fcd34c9..79a65d5 100644 --- a/p2p/tunnel_dialer.go +++ b/p2p/tunnel_dialer.go @@ -55,8 +55,8 @@ func NewTunnelDialer(inner dialer.Dialer, t Tunnel, opts ...TunnelOption) dialer // protocol on top of a p2p tunnel. The wrapper's implicit contract is // "inner dials one plain conn via options.Dialer and uses it as its base" — // a byte stream for the stream dialers (mux inners dial it once per session -// and multiplex streams over it), a datagram stream for udp. kcp/quic -// bases, http2 probes and destroys tunnels. Fail closed: new dialers are +// and multiplex streams over it), a datagram stream for udp. kcp/quic bases +// break that contract and destroy tunnels. Fail closed: new dialers are // unsupported until verified. func SupportedDialer(name string) bool { switch name {