@@ -781,6 +781,18 @@ function lastParse(proxy) {
781781 . replace ( / ^ \[ / , '' )
782782 . replace ( / \] $ / , '' ) ;
783783 }
784+ if (
785+ [ 'vmess' , 'vless' , 'trojan' , 'anytls' ] . includes ( proxy . type ) &&
786+ proxy [ 'shadow-tls-opts' ]
787+ ) {
788+ proxy . plugin = 'shadow-tls' ;
789+ proxy [ 'plugin-opts' ] = {
790+ host : proxy . sni ,
791+ password : proxy [ 'shadow-tls-opts' ] . password ,
792+ version : proxy [ 'shadow-tls-opts' ] . version ,
793+ } ;
794+ delete proxy [ 'shadow-tls-opts' ] ;
795+ }
784796 if (
785797 proxy . type === 'snell' &&
786798 proxy [ 'obfs-opts' ] ?. mode === 'shadow-tls' &&
@@ -801,6 +813,32 @@ function lastParse(proxy) {
801813 }
802814 delete proxy . alpn ;
803815 }
816+ const xhttpDownloadSettings =
817+ proxy . type === 'vless' && proxy . network === 'xhttp'
818+ ? proxy [ 'xhttp-opts' ] ?. [ 'download-settings' ]
819+ : undefined ;
820+ if ( xhttpDownloadSettings ?. [ 'shadow-tls-opts' ] ) {
821+ xhttpDownloadSettings . plugin = 'shadow-tls' ;
822+ xhttpDownloadSettings [ 'plugin-opts' ] = {
823+ host : xhttpDownloadSettings . servername ,
824+ password : xhttpDownloadSettings [ 'shadow-tls-opts' ] . password ,
825+ version : xhttpDownloadSettings [ 'shadow-tls-opts' ] . version ,
826+ } ;
827+ delete xhttpDownloadSettings [ 'shadow-tls-opts' ] ;
828+ }
829+ if (
830+ xhttpDownloadSettings ?. plugin === 'shadow-tls' &&
831+ xhttpDownloadSettings [ 'plugin-opts' ]
832+ ) {
833+ if (
834+ xhttpDownloadSettings . alpn &&
835+ ! xhttpDownloadSettings [ 'plugin-opts' ] . alpn
836+ ) {
837+ xhttpDownloadSettings [ 'plugin-opts' ] . alpn =
838+ xhttpDownloadSettings . alpn ;
839+ }
840+ delete xhttpDownloadSettings . alpn ;
841+ }
804842 if ( proxy . network === 'ws' ) {
805843 if ( ! proxy [ 'ws-opts' ] && ( proxy [ 'ws-path' ] || proxy [ 'ws-headers' ] ) ) {
806844 proxy [ 'ws-opts' ] = { } ;
0 commit comments