@@ -33,7 +33,6 @@ import { produceArtifact } from '@/restful/sync';
3333import { getFlag , removeFlag , getISO , MMDB } from '@/utils/geo' ;
3434import Gist from '@/utils/gist' ;
3535import {
36- isPresent ,
3736 isShadowsocksOverTls ,
3837 normalizeWireGuardInterface ,
3938} from './producers/utils' ;
@@ -395,15 +394,6 @@ function produce(proxies, targetPlatform, type, opts = {}) {
395394 }
396395
397396 const normalizedTarget = String ( targetPlatform ) . toLowerCase ( ) ;
398- const supportedShadowsocksOverTlsTargets = new Set ( [
399- 'qx' ,
400- 'quantumultx' ,
401- 'shadowrocket' ,
402- ] ) ;
403-
404- const sni_off_supported = / S u r g e | S u r g e M a c | S h a d o w r o c k e t / i. test (
405- targetPlatform ,
406- ) ;
407397
408398 // filter unsupported proxies
409399 proxies = proxies . filter ( ( proxy ) => {
@@ -437,7 +427,7 @@ function produce(proxies, targetPlatform, type, opts = {}) {
437427 if (
438428 ! includeUnsupportedProxy &&
439429 isShadowsocksOverTls ( proxy ) &&
440- ! supportedShadowsocksOverTlsTargets . has ( normalizedTarget )
430+ ! [ 'qx' , 'quantumultx' , 'shadowrocket' ] . includes ( normalizedTarget )
441431 ) {
442432 return false ;
443433 }
@@ -518,13 +508,20 @@ function produce(proxies, targetPlatform, type, opts = {}) {
518508 proxy . name = `${ proxy . type } ${ proxy . server } :${ proxy . port } ` ;
519509 }
520510 if ( proxy [ 'disable-sni' ] ) {
521- if ( sni_off_supported ) {
511+ if (
512+ [ 'surge' , 'surgemac' , 'shadowrocket' ] . includes ( normalizedTarget )
513+ ) {
522514 proxy . sni = 'off' ;
523- } else if ( ! [ 'tuic' ] . includes ( proxy . type ) ) {
515+ } else if (
516+ ! [ 'tuic' ] . includes ( proxy . type ) &&
517+ ! [ 'sing-box' , 'singbox' ] . includes ( normalizedTarget )
518+ ) {
519+ // 目前 Sub-Store 里 sing-box 是靠 mihomo 转一次的. 会用到 disable-sni 转成 disable_sni. 是支持的
520+ // 其他客户端行为可能不一致. mihomo 可设置为 ip, 此时会不发 sni
524521 $ . error (
525- `Target platform ${ targetPlatform } does not support sni off, proxy ${ proxy . name } sni will be set to empty string instead. ` ,
522+ `Target platform ${ targetPlatform } does not support sni off. As a workaround for mihomo , proxy ${ proxy . name } sni will be set to IP instead` ,
526523 ) ;
527- proxy . sni = ' ';
524+ proxy . sni = isIP ( proxy . server ) ? proxy . server : '127.0.0.1 ';
528525 // proxy['skip-cert-verify'] = true;
529526 // delete proxy['tls-fingerprint'];
530527 }
@@ -533,7 +530,11 @@ function produce(proxies, targetPlatform, type, opts = {}) {
533530 // 处理 端口跳跃
534531 if ( proxy . ports ) {
535532 proxy . ports = String ( proxy . ports ) ;
536- if ( ! [ 'ClashMeta' ] . includes ( targetPlatform ) ) {
533+ if (
534+ ! [ 'meta' , 'clashmeta' , 'clash.meta' , 'mihomo' ] . includes (
535+ normalizedTarget ,
536+ )
537+ ) {
537538 proxy . ports = proxy . ports . replace ( / \/ / g, ',' ) ;
538539 }
539540 if ( ! proxy . port ) {
0 commit comments