fix(outbound): carry ALPN, fingerprint and UDP mask when importing a Hysteria2 link (#4760)

parseHysteria2Link hardcoded alpn to h3 and never read fp, ech, or the fm (finalmask) param, so importing a Hysteria2 client URL as an outbound dropped the configured ALPN, fingerprint, and salamander UDP mask. Parse alpn (falling back to h3 only when absent), fp, ech, and the pcs pinned-cert key, and restore the UDP mask via applyFinalMaskParam.
This commit is contained in:
MHSanaei
2026-06-01 19:21:29 +02:00
parent b6641439d4
commit 803e010921
2 changed files with 32 additions and 4 deletions
@@ -404,6 +404,7 @@ export function parseHysteria2Link(link: string): Raw | null {
const address = url.hostname;
const port = Number(url.port) || 443;
const params = url.searchParams;
const alpn = params.get('alpn');
const stream: Raw = {
network: 'hysteria',
security: 'tls',
@@ -412,13 +413,14 @@ export function parseHysteria2Link(link: string): Raw | null {
},
tlsSettings: {
serverName: params.get('sni') ?? '',
alpn: ['h3'],
fingerprint: '',
echConfigList: '',
alpn: alpn ? alpn.split(',') : ['h3'],
fingerprint: params.get('fp') ?? '',
echConfigList: params.get('ech') ?? '',
verifyPeerCertByName: '',
pinnedPeerCertSha256: params.get('pinSHA256') ?? '',
pinnedPeerCertSha256: params.get('pcs') ?? '',
},
};
applyFinalMaskParam(stream, params);
return {
protocol: 'hysteria',
tag: decodeRemark(url),