feat: sing-box 支持使用完整的 _ech 结构设置 tls 的 ech, URI 里的改为 _echConfigList

This commit is contained in:
xream committed 2026-01-23 15:08:10 +08:00
1 parent 1af1af170d
commit 5cea09975c
6 files changed
+22 -8

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.12",
"version": "2.21.14",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
@@ -741,7 +741,7 @@ function URI_VLESS() {
proxy['client-fingerprint'] = params.fp;
proxy.alpn = params.alpn ? params.alpn.split(',') : undefined;
proxy['skip-cert-verify'] = /(TRUE)|1/i.test(params.allowInsecure);
proxy._ech = getIfPresent(params.ech);
proxy._echConfigList = getIfPresent(params.ech);
proxy._pcs = getIfPresent(params.pcs);
proxy._h2 = /(TRUE)|1/i.test(params.h2);
@@ -1,6 +1,6 @@
import ClashMeta_Producer from './clashmeta';
import $ from '@/core/app';
import { isIPv4, isIPv6 } from '@/utils';
import { isIPv4, isIPv6, isPlainObject } from '@/utils';
const ipVersions = {
ipv4: 'ipv4_only',
@@ -271,6 +271,9 @@ const tlsParser = (proxy, parsedProxy) => {
enabled: true,
fingerprint: proxy['client-fingerprint'],
};
if (proxy._ech && isPlainObject(proxy._ech)) {
parsedProxy.tls.ech = proxy._ech;
}
if (proxy['_fragment']) parsedProxy.tls.fragment = !!proxy['_fragment'];
if (proxy['_fragment_fallback_delay'])
parsedProxy.tls.fragment_fallback_delay =
@@ -978,7 +981,10 @@ export default function singbox_Producer() {
}
break;
case 'vless':
if (proxy.encryption && proxy.encryption !== 'none') {
if (
proxy.encryption &&
proxy.encryption !== 'none'
) {
throw new Error(
`VLESS encryption is not supported`,
);
@@ -1,7 +1,6 @@
/* eslint-disable no-case-declarations */
import { Base64 } from 'js-base64';
import { isIPv6 } from '@/utils';
import { uuid } from 'automerge';
function vless(proxy) {
let security = 'none';
@@ -45,8 +44,8 @@ function vless(proxy) {
pcs = `&pcs=${encodeURIComponent(proxy._pcs)}`;
}
let ech = '';
if (proxy._ech) {
ech = `&ech=${encodeURIComponent(proxy._ech)}`;
if (proxy._echConfigList) {
ech = `&ech=${encodeURIComponent(proxy._echConfigList)}`;
}
let sni = '';
if (proxy.sni) {
+8
View File
@@ -150,7 +150,15 @@ function formatDateTime(date, format = 'YYYY-MM-DD_HH-mm-ss') {
);
}
function isPlainObject(obj) {
return (
obj !== null &&
typeof obj === 'object' &&
[null, Object.prototype].includes(Object.getPrototypeOf(obj))
);
}
export {
isPlainObject,
formatDateTime,
isValidUUID,
ipAddress,
+2 -1
View File
@@ -31,7 +31,8 @@ function operator(proxies = [], targetPlatform, context) {
// 17. `block-quic` 支持 `auto`, `on`, `off`. 不同的平台不一定都支持, 会自动转换
// 18. `sing-box` 支持 `_fragment`, `_fragment_fallback_delay`, `_record_fragment` 设置 `tls` 的 `fragment`, `fragment_fallback_delay`, `record_fragment`
// 19. `sing-box` 支持 `_certificate`, `_certificate_path`, `_certificate_public_key_sha256`, `_client_certificate`, `_client_certificate_path`, `_client_key`, `_client_key_path` 设置 `tls` 的 `certificate`, `certificate_path`, `certificate_public_key_sha256`, `client_certificate`, `client_certificate_path`, `client_key`, `client_key_path`
// 20. `interface-name` 指定流量出站接口 只给 Surge 用的话, `interface` 也可以
// 20. `sing-box` 支持使用完整的 `_ech` 结构设置 `tls` 的 `ech`. 避免冲突, URI 里的改为 _echConfigList
// 21. `interface-name` 指定流量出站接口 只给 Surge 用的话, `interface` 也可以
// require 为 Node.js 的 require, 在 Node.js 运行环境下 可以用来引入模块
// 例如在 Node.js 环境下, 将文件内容写入 /tmp/1.txt 文件