Skip to content

Commit

Permalink
Merge pull request #274 from cnsunyour/master
Browse files Browse the repository at this point in the history
feat(singbox): Support network=tcp in VMESS/VLESS
  • Loading branch information
geekdada authored Jun 30, 2024
2 parents c7f88c2 + 6b35360 commit ae64ef0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/utils/__tests__/singbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const nodeList: ReadonlyArray<PossibleNodeConfigType> = [
mux: true,
},
{
nodeName: 'vmess.tcpNotSupported',
nodeName: 'vmess.tcp',
type: NodeTypeEnum.Vmess,
hostname: 'example.com',
port: 443,
Expand Down Expand Up @@ -261,7 +261,7 @@ const nodeList: ReadonlyArray<PossibleNodeConfigType> = [
},
},
{
nodeName: 'vless.tcpNotSupported',
nodeName: 'vless.tcp',
type: NodeTypeEnum.Vless,
hostname: 'example.com',
port: 443,
Expand Down Expand Up @@ -668,6 +668,15 @@ const expectedNodes: Record<string, any>[] = [
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',
Expand Down Expand Up @@ -759,6 +768,19 @@ const expectedNodes: Record<string, any>[] = [
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',
Expand Down
3 changes: 3 additions & 0 deletions src/utils/singbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ function nodeListMapper(nodeConfig: PossibleNodeConfigType) {
}
break

case 'tcp':
break

default:
logger.warn(
`sing-box 的 ${nodeConfig.type} 节点不支持 network=${nodeConfig.network},节点 ${nodeConfig.nodeName} 会被忽略`,
Expand Down

0 comments on commit ae64ef0

Please sign in to comment.