Merge pull request #261 from Ariesly/master

This commit is contained in:
xream 2023-12-08 11:45:58 +08:00 committed by GitHub
commit 17504ab5aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -81,6 +81,24 @@ export default function ShadowRocket_Producer() {
) { ) {
proxy['fast-open'] = proxy.tfo; proxy['fast-open'] = proxy.tfo;
} }
} else if (proxy.type === 'hysteria2') {
if (
proxy['obfs-password'] &&
proxy.obfs == 'salamander') {
proxy.obfs = proxy['obfs-password'];
delete proxy['obfs-password'];
}
if (isPresent(proxy, 'alpn')) {
proxy.alpn = Array.isArray(proxy.alpn)
? proxy.alpn
: [proxy.alpn];
}
if (
isPresent(proxy, 'tfo') &&
!isPresent(proxy, 'fast-open')
) {
proxy['fast-open'] = proxy.tfo;
}
} else if (proxy.type === 'wireguard') { } else if (proxy.type === 'wireguard') {
proxy.keepalive = proxy.keepalive =
proxy.keepalive ?? proxy['persistent-keepalive']; proxy.keepalive ?? proxy['persistent-keepalive'];

View File

@ -244,11 +244,14 @@ export default function URI_Producer() {
`sni=${encodeURIComponent(proxy.sni)}`, `sni=${encodeURIComponent(proxy.sni)}`,
); );
} }
if (proxy.fingerprint) { if (proxy['tls-fingerprint']) {
hysteria2params.push( hysteria2params.push(
`pinSHA256=${encodeURIComponent(proxy.fingerprint)}`, `pinSHA256=${encodeURIComponent(proxy['tls-fingerprint'])}`,
); );
} }
if (proxy.tfo) {
hysteria2params.push(`fastopen=1`);
}
result = `hysteria2://${proxy.password}@${proxy.server}:${ result = `hysteria2://${proxy.password}@${proxy.server}:${
proxy.port proxy.port
}?${hysteria2params.join('&')}#${encodeURIComponent( }?${hysteria2params.join('&')}#${encodeURIComponent(