@@ -324,7 +324,7 @@ export default {
324324 订阅内容 = Singbox订阅配置文件热补丁 ( 订阅内容 , config_JSON . UUID , config_JSON . Fingerprint , config_JSON . ECH ? await getECH ( host ) : null ) ;
325325 responseHeaders [ "content-type" ] = 'application/json; charset=utf-8' ;
326326 } else if ( 订阅类型 === 'clash' ) {
327- 订阅内容 = Clash订阅配置文件热补丁 ( 订阅内容 , config_JSON . UUID , config_JSON . ECH ? await getECH ( host ) : null ) ;
327+ 订阅内容 = Clash订阅配置文件热补丁 ( 订阅内容 , config_JSON . UUID , config_JSON . ECH ) ;
328328 responseHeaders [ "content-type" ] = 'application/x-yaml; charset=utf-8' ;
329329 }
330330 return new Response ( 订阅内容 , { status : 200 , headers : responseHeaders } ) ;
@@ -785,15 +785,32 @@ async function httpConnect(targetHost, targetPort, initialData) {
785785 }
786786}
787787//////////////////////////////////////////////////功能性函数///////////////////////////////////////////////
788- function Clash订阅配置文件热补丁 ( clash_yaml , uuid = null , ech_config = null ) {
789- // 判断uuid字段是否为真
790- if ( ! uuid ) {
791- return clash_yaml ;
792- }
793-
794- // 如果ech_config为null,直接返回
795- if ( ! ech_config ) return clash_yaml ;
796-
788+ function Clash订阅配置文件热补丁 ( Clash_原始订阅内容 , uuid = null , ECH启用 = false ) {
789+ const clash_yaml = `dns:
790+ enable: true
791+ default-nameserver:
792+ - 223.5.5.5
793+ - 119.29.29.29
794+ - 114.114.114.114
795+ use-hosts: true
796+ nameserver:
797+ - https://sm2.doh.pub/dns-query
798+ - https://dns.alidns.com/dns-query
799+ fallback:
800+ - 'https://dns.google/dns-query'
801+ - 'https://1.1.1.1/dns-query'
802+ fallback-filter:
803+ geoip: true
804+ ipcidr:
805+ - 240.0.0.0/4
806+ - 0.0.0.0/32
807+ geoip-code: CN
808+ proxy-server-nameserver:
809+ - https://doh.cmliussss.com/CMLiussss
810+ - https://doh.cmliussss.net/CMLiussss
811+ ` + Clash_原始订阅内容 ;
812+
813+ if ( ! uuid || ! ECH启用 ) return clash_yaml ;
797814 const lines = clash_yaml . split ( '\n' ) ;
798815 const processedLines = [ ] ;
799816 let i = 0 ;
@@ -830,7 +847,7 @@ function Clash订阅配置文件热补丁(clash_yaml, uuid = null, ech_config =
830847
831848 if ( credentialMatch && credentialMatch [ 1 ] . trim ( ) === uuid . trim ( ) ) {
832849 // 在最后一个}前添加ech-opts
833- fullNode = fullNode . replace ( / \} ( \s * ) $ / , `, ech-opts: {enable: true, config: " ${ ech_config } " }}$1` ) ;
850+ fullNode = fullNode . replace ( / \} ( \s * ) $ / , `, ech-opts: {enable: true}}$1` ) ;
834851 }
835852
836853 processedLines . push ( fullNode ) ;
@@ -905,8 +922,7 @@ function Clash订阅配置文件热补丁(clash_yaml, uuid = null, ech_config =
905922 // 在节点末尾(最后一个属性块之后)插入 ech-opts 属性
906923 nodeLines . splice ( insertIndex + 1 , 0 ,
907924 `${ indent } ech-opts:` ,
908- `${ indent } enable: true` ,
909- `${ indent } config: "${ ech_config } "`
925+ `${ indent } enable: true`
910926 ) ;
911927 }
912928 }
0 commit comments