@@ -998,6 +998,37 @@ describe('Proxy text producers', function () {
998998 } ) ;
999999 } ) ;
10001000
1001+ it ( 'round-trips Surge TrustTunnel h3 as network' , function ( ) {
1002+ const [ proxy ] = ProxyUtils . parse (
1003+ 'Surge TrustTunnel H3 = trust-tunnel,trust.example.com,443,h3=true' ,
1004+ ) ;
1005+
1006+ expect ( proxy . network ) . to . equal ( 'h3' ) ;
1007+ expect ( proxy ) . to . not . have . property ( 'alpn' ) ;
1008+
1009+ const output = produceExternal ( 'Surge' , proxy ) ;
1010+ expect ( output ) . to . include ( ',h3=true' ) ;
1011+ expect ( output ) . to . not . include ( ',alpn=' ) ;
1012+
1013+ const [ disabled ] = ProxyUtils . parse (
1014+ 'Surge TrustTunnel H3 Disabled = trust-tunnel,trust.example.com,443,h3=false' ,
1015+ ) ;
1016+ expect ( disabled ) . to . not . have . property ( 'network' ) ;
1017+ const disabledOutput = produceExternal ( 'Surge' , disabled ) ;
1018+ expect ( disabledOutput ) . to . not . include ( ',h3=true' ) ;
1019+ expect ( disabledOutput ) . to . not . include ( ',alpn=' ) ;
1020+
1021+ const alpnOutput = produceExternal ( 'Surge' , {
1022+ type : 'trusttunnel' ,
1023+ name : 'Surge TrustTunnel ALPN H3' ,
1024+ server : 'trust.example.com' ,
1025+ port : 443 ,
1026+ alpn : [ 'h3' ] ,
1027+ } ) ;
1028+ expect ( alpnOutput ) . to . include ( ',alpn="h3"' ) ;
1029+ expect ( alpnOutput ) . to . not . include ( ',h3=true' ) ;
1030+ } ) ;
1031+
10011032 it ( 'omits Surge alpn and server-cert-verify-name for non-TLS outputs' , function ( ) {
10021033 const output = produceExternal ( 'Surge' , [
10031034 {
0 commit comments