@@ -879,8 +879,9 @@ describe('Proxy text producers', function () {
879879 ) ;
880880 } ) ;
881881
882- it ( 'emits quoted Surge alpn for TLS protocol outputs' , function ( ) {
882+ it ( 'emits Surge alpn and server-cert-verify-name for TLS protocol outputs' , function ( ) {
883883 const alpn = [ 'http/1.1' , 'h2' , 'h3' ] ;
884+ const nameCertVerify = 'verify.example.com' ;
884885 const output = produceExternal ( 'Surge' , [
885886 {
886887 type : 'vmess' ,
@@ -892,6 +893,7 @@ describe('Proxy text producers', function () {
892893 alterId : 0 ,
893894 tls : true ,
894895 alpn,
896+ 'name-cert-verify' : nameCertVerify ,
895897 } ,
896898 {
897899 type : 'trojan' ,
@@ -900,21 +902,25 @@ describe('Proxy text producers', function () {
900902 port : 443 ,
901903 password : 'secret' ,
902904 alpn,
905+ 'name-cert-verify' : nameCertVerify ,
903906 } ,
904907 {
905908 type : 'http' ,
906909 name : 'Surge HTTPS ALPN' ,
907910 server : 'https-alpn.example.com' ,
908911 port : 443 ,
909912 tls : true ,
913+ sni : 'sni.example.com' ,
910914 alpn,
915+ 'name-cert-verify' : nameCertVerify ,
911916 } ,
912917 {
913918 type : 'h2-connect' ,
914919 name : 'Surge H2 ALPN' ,
915920 server : 'h2-alpn.example.com' ,
916921 port : 443 ,
917922 alpn,
923+ 'name-cert-verify' : nameCertVerify ,
918924 } ,
919925 {
920926 type : 'socks5' ,
@@ -923,6 +929,7 @@ describe('Proxy text producers', function () {
923929 port : 1080 ,
924930 tls : true ,
925931 alpn,
932+ 'name-cert-verify' : nameCertVerify ,
926933 } ,
927934 {
928935 type : 'anytls' ,
@@ -931,13 +938,15 @@ describe('Proxy text producers', function () {
931938 port : 443 ,
932939 password : 'secret' ,
933940 alpn,
941+ 'name-cert-verify' : nameCertVerify ,
934942 } ,
935943 {
936944 type : 'trusttunnel' ,
937945 name : 'Surge TrustTunnel ALPN' ,
938946 server : 'trust-alpn.example.com' ,
939947 port : 443 ,
940948 alpn,
949+ 'name-cert-verify' : nameCertVerify ,
941950 } ,
942951 {
943952 type : 'tuic' ,
@@ -947,6 +956,7 @@ describe('Proxy text producers', function () {
947956 uuid : UUID ,
948957 password : 'secret' ,
949958 alpn,
959+ 'name-cert-verify' : nameCertVerify ,
950960 } ,
951961 {
952962 type : 'hysteria2' ,
@@ -955,13 +965,25 @@ describe('Proxy text producers', function () {
955965 port : 443 ,
956966 password : 'secret' ,
957967 alpn,
968+ 'name-cert-verify' : nameCertVerify ,
958969 } ,
959970 ] ) ;
960971
961972 expect ( output . match ( / a l p n = " h t t p \/ 1 \. 1 , h 2 , h 3 " / g) ) . to . have . length ( 9 ) ;
973+ expect (
974+ output . match ( / s e r v e r - c e r t - v e r i f y - n a m e = " v e r i f y \. e x a m p l e \. c o m " / g) ,
975+ ) . to . have . length ( 9 ) ;
976+
977+ const roundTripped = ProxyUtils . parse ( output ) . find (
978+ ( { name } ) => name === 'Surge HTTPS ALPN' ,
979+ ) ;
980+ expect ( roundTripped ) . to . include ( {
981+ sni : 'sni.example.com' ,
982+ 'name-cert-verify' : nameCertVerify ,
983+ } ) ;
962984 } ) ;
963985
964- it ( 'omits Surge alpn for non-TLS outputs' , function ( ) {
986+ it ( 'omits Surge alpn and server-cert-verify-name for non-TLS outputs' , function ( ) {
965987 const output = produceExternal ( 'Surge' , [
966988 {
967989 type : 'vmess' ,
@@ -971,24 +993,28 @@ describe('Proxy text producers', function () {
971993 uuid : UUID ,
972994 alterId : 0 ,
973995 alpn : [ 'http/1.1' , 'h2' ] ,
996+ 'name-cert-verify' : 'verify.example.com' ,
974997 } ,
975998 {
976999 type : 'http' ,
9771000 name : 'Surge HTTP Plain ALPN' ,
9781001 server : 'http-plain-alpn.example.com' ,
9791002 port : 80 ,
9801003 alpn : [ 'http/1.1' , 'h2' ] ,
1004+ 'name-cert-verify' : 'verify.example.com' ,
9811005 } ,
9821006 {
9831007 type : 'socks5' ,
9841008 name : 'Surge SOCKS5 Plain ALPN' ,
9851009 server : 'socks-plain-alpn.example.com' ,
9861010 port : 1080 ,
9871011 alpn : [ 'http/1.1' , 'h2' ] ,
1012+ 'name-cert-verify' : 'verify.example.com' ,
9881013 } ,
9891014 ] ) ;
9901015
9911016 expect ( output ) . to . not . include ( 'alpn=' ) ;
1017+ expect ( output ) . to . not . include ( 'server-cert-verify-name=' ) ;
9921018 } ) ;
9931019
9941020 it ( 'produces Surge TUIC v5 lines with port hopping' , function ( ) {
0 commit comments