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.
This commit is contained in:
ginuerzh
2026-10-14 01:56:32 +00:00
parent a44625fcb7
commit 22eb86d08e
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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)
}
+2 -2
View File
@@ -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 {