diff --git a/lib/utils/index.ts b/lib/utils/index.ts index fba03fd51..ad67c765d 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -414,12 +414,7 @@ export const getSurgeNodes = function( nodeConfig.hostname, `${nodeConfig.port}`, `password=${nodeConfig.password}`, - ...(typeof nodeConfig.tfo === 'boolean' ? [ - `tfo=${nodeConfig.tfo}`, - ] : []), - ...(typeof nodeConfig.mptcp === 'boolean' ? [ - `mptcp=${nodeConfig.mptcp}`, - ] : []), + ...pickAndFormatStringList(nodeConfig, ['tfo', 'mptcp', 'sni']), ...(typeof nodeConfig.skipCertVerify === 'boolean' ? [ `skip-cert-verify=${nodeConfig.skipCertVerify}`, ] : []), diff --git a/test/utils/index.test.ts b/test/utils/index.test.ts index 27bf38571..cd89a0c6b 100644 --- a/test/utils/index.test.ts +++ b/test/utils/index.test.ts @@ -207,11 +207,12 @@ test('getSurgeNodes', async t => { hostname: 'example.com', port: 443, password: 'password1', + sni: 'sni.com', tfo: true, mptcp: true, skipCertVerify: true, }]), - 'trojan node 2 = trojan, example.com, 443, password=password1, tfo=true, mptcp=true, skip-cert-verify=true', + 'trojan node 2 = trojan, example.com, 443, password=password1, tfo=true, mptcp=true, sni=sni.com, skip-cert-verify=true', ); t.is(