@@ -321,7 +321,7 @@ export default {
321321 if ( 订阅类型 === 'mixed' && ( ! ua . includes ( 'mozilla' ) || url . searchParams . has ( 'b64' ) || url . searchParams . has ( 'base64' ) ) ) 订阅内容 = btoa ( 订阅内容 ) ;
322322
323323 if ( 订阅类型 === 'singbox' ) {
324- 订阅内容 = Singbox订阅配置文件热补丁 ( 订阅内容 ) ;
324+ 订阅内容 = 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' ) {
327327 responseHeaders [ "content-type" ] = 'application/x-yaml; charset=utf-8' ;
@@ -784,7 +784,7 @@ async function httpConnect(targetHost, targetPort, initialData) {
784784 }
785785}
786786//////////////////////////////////////////////////功能性函数///////////////////////////////////////////////
787- function Singbox订阅配置文件热补丁 ( sb_json_text ) {
787+ function Singbox订阅配置文件热补丁 ( sb_json_text , uuid = null , fingerprint = "chrome" , ech_config = null ) {
788788 try {
789789 let config = JSON . parse ( sb_json_text ) ;
790790
@@ -929,6 +929,35 @@ function Singbox订阅配置文件热补丁(sb_json_text) {
929929 }
930930 } ) ;
931931
932+ // --- 4. UUID 匹配节点的 TLS 热补丁 (utls & ech) ---
933+ if ( uuid ) {
934+ config . outbounds . forEach ( outbound => {
935+ // 仅处理包含 uuid 且匹配的节点
936+ if ( outbound . uuid && outbound . uuid === uuid ) {
937+ // 确保 tls 对象存在
938+ if ( ! outbound . tls ) {
939+ outbound . tls = { enabled : true } ;
940+ }
941+
942+ // 添加/更新 utls 配置
943+ if ( fingerprint ) {
944+ outbound . tls . utls = {
945+ enabled : true ,
946+ fingerprint : fingerprint
947+ } ;
948+ }
949+
950+ // 如果提供了 ech_config,添加/更新 ech 配置
951+ if ( ech_config ) {
952+ outbound . tls . ech = {
953+ enabled : true ,
954+ config : `-----BEGIN ECH CONFIGS-----\n${ ech_config } \n-----END ECH CONFIGS-----`
955+ } ;
956+ }
957+ }
958+ } ) ;
959+ }
960+
932961 return JSON . stringify ( config , null , 2 ) ;
933962 } catch ( e ) {
934963 console . error ( "Singbox热补丁执行失败:" , e ) ;
0 commit comments