Skip to content

Commit

Permalink
fix: Close #35
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Nov 13, 2019
1 parent 1701b85 commit 491b655
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,12 @@ export const getQuantumultXNodes = (
config.push(`obfs-uri=${nodeConfig.path ?? '/'}`);
config.push(`obfs-host=${nodeConfig.host || nodeConfig.hostname}`);

break;
case 'tcp':
if (nodeConfig.tls) {
config.push(`obfs=over-tls`);
}

break;
default:
// do nothing
Expand Down
12 changes: 12 additions & 0 deletions test/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,17 @@ test('getQuantumultXNodes', t => {
'obfs-host': 'gateway-carry.icloud.com',
tfo: true,
},
{
type: NodeTypeEnum.Vmess,
alterId: '64',
hostname: '1.1.1.1',
method: 'auto',
network: 'tcp',
nodeName: '测试 4',
port: 443,
tls: true,
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
},
])
.split('\n');

Expand All @@ -790,6 +801,7 @@ test('getQuantumultXNodes', t => {
t.is(schemeList[3], 'shadowsocks=hk.example.com:10000, method=chacha20-ietf, password=password, ssr-protocol=auth_aes128_md5, ssr-protocol-param=, obfs=tls1.2_ticket_auth, obfs-host=music.163.com, tag=🇭🇰HK');
t.is(schemeList[4], 'http=a.com:443, username=snsms, password=nndndnd, over-tls=true, tag=test');
t.is(schemeList[5], 'shadowsocks=us.example.com:443, method=chacha20-ietf-poly1305, password=password, obfs=tls, obfs-host=gateway-carry.icloud.com, udp-relay=true, fast-open=true, tag=🇺🇸US 1');
t.is(schemeList[6], 'vmess=1.1.1.1:443, method=chacha20-ietf-poly1305, password=1386f85e-657b-4d6e-9d56-78badb75e1fd, udp-relay=true, obfs=over-tls, tag=测试 4')
});

test('formatV2rayConfig', t => {
Expand Down

0 comments on commit 491b655

Please sign in to comment.