@@ -226,7 +226,8 @@ export default {
226226 const 协议类型 = ( url . searchParams . has ( 'surge' ) || ua . includes ( 'surge' ) ) ? 'tro' + 'jan' : config_JSON . 协议类型 ;
227227 let 订阅内容 = '' ;
228228 if ( 订阅类型 === 'mixed' ) {
229- const 节点路径 = config_JSON . 启用0RTT ? config_JSON . PATH + '?ed=2560' : config_JSON . PATH ;
229+ const 节点路径 = config_JSON . 启用0RTT ? ( config_JSON . PATH == '' ? '/' : config_JSON . PATH ) + '?ed=2560' : ( config_JSON . PATH == '' ? '/' : config_JSON . PATH ) ;
230+ const TLS分片参数 = config_JSON . TLS分片 == 'Shadowrocket' ? `&fragment=${ encodeURIComponent ( '1,40-60,30-50,tlshello' ) } ` : config_JSON . TLS分片 == 'Happ' ? `&fragment=${ encodeURIComponent ( '3,1,tlshello' ) } ` : '' ;
230231 const 完整优选列表 = config_JSON . 优选订阅生成 . 本地IP库 . 随机IP ? ( await 生成随机IP ( request , config_JSON . 优选订阅生成 . 本地IP库 . 随机数量 , config_JSON . 优选订阅生成 . 本地IP库 . 指定端口 ) ) [ 0 ] : await env . KV . get ( 'ADD.txt' ) ? await 整理成数组 ( await env . KV . get ( 'ADD.txt' ) ) : ( await 生成随机IP ( request , config_JSON . 优选订阅生成 . 本地IP库 . 随机数量 , config_JSON . 优选订阅生成 . 本地IP库 . 指定端口 ) ) [ 0 ] ;
231232 const 优选API = [ ] , 优选IP = [ ] , 其他节点 = [ ] ;
232233 for ( const 元素 of 完整优选列表 ) {
@@ -259,13 +260,13 @@ export default {
259260 return null ;
260261 }
261262
262- return `${ 协议类型 } ://${ config_JSON . UUID } @${ 节点地址 } :${ 节点端口 } ?security=tls&type=${ config_JSON . 传输协议 } &host=${ config_JSON . HOST } &sni=${ config_JSON . HOST } &path=${ encodeURIComponent ( 随机路径 ( ) + 节点路径 ) } &fragment= ${ encodeURIComponent ( '1,40-60,30-50,tlshello' ) } &encryption=none${ config_JSON . 跳过证书验证 ? '&allowInsecure=1' : '' } #${ encodeURIComponent ( 节点备注 ) } ` ;
263+ return `${ 协议类型 } ://${ config_JSON . UUID } @${ 节点地址 } :${ 节点端口 } ?security=tls&type=${ config_JSON . 传输协议 } &host=${ config_JSON . HOST } &sni=${ config_JSON . HOST } &path=${ encodeURIComponent ( 随机路径 ( ) + 节点路径 ) + TLS分片参数 } &encryption=none${ config_JSON . 跳过证书验证 ? '&allowInsecure=1' : '' } #${ encodeURIComponent ( 节点备注 ) } ` ;
263264 } ) . filter ( item => item !== null ) . join ( '\n' ) ;
264265 订阅内容 = btoa ( 其他节点LINK + 订阅内容 ) ;
265266 } else { // 优选订阅生成器
266267 let 优选订阅生成器HOST = url . searchParams . get ( 'sub' ) || config_JSON . 优选订阅生成 . SUB ;
267268 优选订阅生成器HOST = 优选订阅生成器HOST && ! / ^ h t t p s ? : \/ \/ / i. test ( 优选订阅生成器HOST ) ? `https://${ 优选订阅生成器HOST } ` : 优选订阅生成器HOST ;
268- const 优选订阅生成器URL = `${ 优选订阅生成器HOST } /sub?host=example.com&${ 协议类型 === ( 'v' + 'le' + 'ss' ) ? 'uuid' : 'pw' } =00000000-0000-4000-0000-000000000000&path=${ encodeURIComponent ( 随机路径 ( ) + 节点路径 ) } &type=${ config_JSON . 传输协议 } ` ;
269+ const 优选订阅生成器URL = `${ 优选订阅生成器HOST } /sub?host=example.com&${ 协议类型 === ( 'v' + 'le' + 'ss' ) ? 'uuid' : 'pw' } =00000000-0000-4000-0000-000000000000&path=${ encodeURIComponent ( 随机路径 ( ) + 节点路径 ) + TLS分片参数 } &type=${ config_JSON . 传输协议 } ` ;
269270 try {
270271 const response = await fetch ( 优选订阅生成器URL , { headers : { 'User-Agent' : 'v2rayN/edge' + 'tunnel (https://github.com/cmliu/edge' + 'tunnel)' } } ) ;
271272 if ( response . ok ) 订阅内容 = btoa ( 其他节点LINK + atob ( await response . text ( ) ) ) ;
@@ -832,6 +833,7 @@ async function 读取config_JSON(env, host, userID, 重置配置 = false) {
832833 传输协议 : "ws" ,
833834 跳过证书验证 : true ,
834835 启用0RTT : true ,
836+ TLS分片 : null ,
835837 优选订阅生成 : {
836838 local : true , // true: 基于本地的优选地址 false: 优选订阅生成器
837839 本地IP库 : {
@@ -893,7 +895,9 @@ async function 读取config_JSON(env, host, userID, 重置配置 = false) {
893895 config_JSON . HOST = host ;
894896 config_JSON . UUID = userID ;
895897 config_JSON . PATH = config_JSON . 反代 . SOCKS5 . 启用 ? ( '/' + config_JSON . 反代 . SOCKS5 . 启用 + ( config_JSON . 反代 . SOCKS5 . 全局 ? '://' : '=' ) + config_JSON . 反代 . SOCKS5 . 账号 ) : ( config_JSON . 反代 . PROXYIP === 'auto' ? '' : `/proxyip=${ config_JSON . 反代 . PROXYIP } ` ) ;
896- config_JSON . LINK = `${ config_JSON . 协议类型 } ://${ userID } @${ host } :443?security=tls&type=${ config_JSON . 传输协议 } &host=${ host } &sni=${ host } &path=${ encodeURIComponent ( config_JSON . PATH ) } &fragment=${ encodeURIComponent ( '1,40-60,30-50,tlshello' ) } &encryption=none${ config_JSON . 跳过证书验证 ? '&allowInsecure=1' : '' } #${ encodeURIComponent ( config_JSON . 优选订阅生成 . SUBNAME ) } ` ;
898+ const TLS分片参数 = config_JSON . TLS分片 == 'Shadowrocket' ? `&fragment=${ encodeURIComponent ( '1,40-60,30-50,tlshello' ) } ` : config_JSON . TLS分片 == 'Happ' ? `&fragment=${ encodeURIComponent ( '3,1,tlshello' ) } ` : '' ;
899+ const 节点路径 = config_JSON . 启用0RTT ? ( config_JSON . PATH == '' ? '/' : config_JSON . PATH ) + '?ed=2560' : ( config_JSON . PATH == '' ? '/' : config_JSON . PATH ) ;
900+ config_JSON . LINK = `${ config_JSON . 协议类型 } ://${ userID } @${ host } :443?security=tls&type=${ config_JSON . 传输协议 } &host=${ host } &sni=${ host } &path=${ encodeURIComponent ( config_JSON . 启用0RTT ? 节点路径 + '?ed=2560' : 节点路径 ) + TLS分片参数 } &encryption=none${ config_JSON . 跳过证书验证 ? '&allowInsecure=1' : '' } #${ encodeURIComponent ( config_JSON . 优选订阅生成 . SUBNAME ) } ` ;
897901 config_JSON . 优选订阅生成 . TOKEN = await MD5MD5 ( host + userID ) ;
898902
899903 const 初始化TG_JSON = { BotToken : null , ChatID : null } ;
0 commit comments