mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-04 17:37:19 +00:00
540caa4e93
- Export standard gecko obfs query params in hysteria2 share links - Enforce packet size bounds across Go and TypeScript link handlers - Persist uTLS None explicitly and initialize new TLS inbounds to chrome - Tear down stackTun safely without closeMu deadlock against WriteNotify Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { TlsStreamSettingsSchema } from '@/schemas/protocols/security/tls';
|
|
|
|
function defaultCertificate(): Record<string, unknown> {
|
|
return {
|
|
useFile: true,
|
|
certificateFile: '',
|
|
keyFile: '',
|
|
certificate: [],
|
|
key: [],
|
|
ocspStapling: 0,
|
|
oneTimeLoading: false,
|
|
usage: 'encipherment',
|
|
buildChain: false,
|
|
};
|
|
}
|
|
|
|
export function createTlsSettingsWithDefaultCert(): Record<string, unknown> {
|
|
const tls = TlsStreamSettingsSchema.parse({}) as Record<string, unknown>;
|
|
tls.certificates = [defaultCertificate()];
|
|
const settings =
|
|
tls.settings && typeof tls.settings === 'object' && !Array.isArray(tls.settings)
|
|
? { ...(tls.settings as Record<string, unknown>) }
|
|
: {};
|
|
settings.fingerprint = 'chrome';
|
|
tls.settings = settings;
|
|
return tls;
|
|
}
|
|
|
|
export function createHysteriaTlsSettingsWithDefaultCert(): Record<string, unknown> {
|
|
const tls = createTlsSettingsWithDefaultCert();
|
|
tls.alpn = ['h3'];
|
|
|
|
const settings =
|
|
tls.settings && typeof tls.settings === 'object' && !Array.isArray(tls.settings)
|
|
? { ...(tls.settings as Record<string, unknown>) }
|
|
: {};
|
|
settings.fingerprint = '';
|
|
tls.settings = settings;
|
|
|
|
return tls;
|
|
}
|