From 5e5660283e77814229d5ec3043ee76146bf4880e Mon Sep 17 00:00:00 2001 From: Sunn Yao Date: Thu, 27 Jun 2024 23:35:01 +0800 Subject: [PATCH 1/2] feat(singbox): Support network=tcp in VMESS/VLESS --- src/utils/singbox.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/singbox.ts b/src/utils/singbox.ts index f5848c298..c6bfb2254 100644 --- a/src/utils/singbox.ts +++ b/src/utils/singbox.ts @@ -187,6 +187,9 @@ function nodeListMapper(nodeConfig: PossibleNodeConfigType) { } break + case 'tcp': + break + default: logger.warn( `sing-box 的 ${nodeConfig.type} 节点不支持 network=${nodeConfig.network},节点 ${nodeConfig.nodeName} 会被忽略`, From 6b353605120b737ca7db823c95bd3f1a441e5538 Mon Sep 17 00:00:00 2001 From: Sunn Yao Date: Sat, 29 Jun 2024 20:55:30 +0800 Subject: [PATCH 2/2] Update unit test for vmess/vless TCP --- src/utils/__tests__/singbox.test.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/utils/__tests__/singbox.test.ts b/src/utils/__tests__/singbox.test.ts index 570e45158..a5d7d785d 100644 --- a/src/utils/__tests__/singbox.test.ts +++ b/src/utils/__tests__/singbox.test.ts @@ -123,7 +123,7 @@ const nodeList: ReadonlyArray = [ mux: true, }, { - nodeName: 'vmess.tcpNotSupported', + nodeName: 'vmess.tcp', type: NodeTypeEnum.Vmess, hostname: 'example.com', port: 443, @@ -261,7 +261,7 @@ const nodeList: ReadonlyArray = [ }, }, { - nodeName: 'vless.tcpNotSupported', + nodeName: 'vless.tcp', type: NodeTypeEnum.Vless, hostname: 'example.com', port: 443, @@ -668,6 +668,15 @@ const expectedNodes: Record[] = [ plugin: 'v2ray-plugin', plugin_opts: 'host=example.com;mode=quic;path=/obfs;tls=true', }, + { + type: 'vmess', + tag: 'vmess.tcp', + server: 'example.com', + server_port: 443, + security: 'auto', + uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd', + alter_id: 0, + }, { type: 'vmess', tag: 'vmess.complex', @@ -759,6 +768,19 @@ const expectedNodes: Record[] = [ headers: { Host: ['example.com'] }, }, }, + { + type: 'vless', + tag: 'vless.tcp', + server: 'example.com', + server_port: 443, + uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd', + flow: 'xtls-rprx-vision', + tls: { + enabled: true, + utls: { enabled: true, fingerprint: 'chrome2' }, + reality: { enabled: true, public_key: 'publicKey', short_id: 'shortId' }, + }, + }, { type: 'vless', tag: 'vless.complex',