diff --git a/modules/proxy-suite/service/start-scripts.nix b/modules/proxy-suite/service/start-scripts.nix index 97fb06f..4442b33 100644 --- a/modules/proxy-suite/service/start-scripts.nix +++ b/modules/proxy-suite/service/start-scripts.nix @@ -284,7 +284,13 @@ let elif .settings.vnext then {server: .settings.vnext[0].address, port: .settings.vnext[0].port} elif .settings.servers then {server: .settings.servers[0].address, port: .settings.servers[0].port} else null end; - def udp: (.type // .protocol) as $t | (["hysteria", "hysteria2", "tuic"] | index($t) != null) or .quic? == true; + # XRay dials XHTTP over HTTP/3, on UDP, when its ALPN is h3 alone (and not REALITY); + # mKCP is UDP as well. Their servers have no TCP handshake to time either. + def udp: (.type // .protocol) as $t | .streamSettings.network? as $net + | (["hysteria", "hysteria2", "tuic"] | index($t) != null) or .quic? == true + or ($net == "xhttp" and .streamSettings.security? == "tls" + and .streamSettings.tlsSettings.alpn? == ["h3"]) + or $net == "kcp" or $net == "mkcp"; ($sidecar | map({key: .tag, value: .}) | from_entries) as $real | [.[] | select(.type != "selector" and .type != "urltest") | (.tag | ltrimstr("proxy-suite-ob-")) as $tag diff --git a/nix/checks/hybrid-backend.nix b/nix/checks/hybrid-backend.nix index a566a15..9f26261 100644 --- a/nix/checks/hybrid-backend.nix +++ b/nix/checks/hybrid-backend.nix @@ -90,6 +90,10 @@ in assert pkgs.lib.hasInfix "--backend sing-box" hybridStartScript; assert pkgs.lib.hasInfix "--backend xray" hybridStartScript; assert pkgs.lib.hasInfix "_proxy_suite_add_xray_sidecar_ob" hybridStartScript; + # The outbounds test pings a sidecar outbound's real server, over UDP when XRay dials + # XHTTP over HTTP/3 or mKCP: no TCP handshake to time there. + assert pkgs.lib.hasInfix ''.streamSettings.tlsSettings.alpn? == ["h3"]'' hybridStartScript; + assert pkgs.lib.hasInfix ''$net == "kcp"'' hybridStartScript; assert pkgs.lib.hasInfix "hybrid XRay json sidecar" hybridXrayRawStartScript; assert pkgs.lib.hasInfix ''{type: "vless", tag: $tag, server: "127.0.0.1"'' hybridXrayRawStartScript;