diff --git a/backend/src/core/proxy-utils/producers/shadowrocket.js b/backend/src/core/proxy-utils/producers/shadowrocket.js index aa8f341..61f5a71 100644 --- a/backend/src/core/proxy-utils/producers/shadowrocket.js +++ b/backend/src/core/proxy-utils/producers/shadowrocket.js @@ -81,6 +81,24 @@ export default function ShadowRocket_Producer() { ) { 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') { proxy.keepalive = proxy.keepalive ?? proxy['persistent-keepalive']; diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index ed94d2b..b996362 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -244,11 +244,14 @@ export default function URI_Producer() { `sni=${encodeURIComponent(proxy.sni)}`, ); } - if (proxy.fingerprint) { + if (proxy['tls-fingerprint']) { hysteria2params.push( - `pinSHA256=${encodeURIComponent(proxy.fingerprint)}`, + `pinSHA256=${encodeURIComponent(proxy['tls-fingerprint'])}`, ); } + if (proxy.tfo) { + hysteria2params.push(`fastopen=1`); + } result = `hysteria2://${proxy.password}@${proxy.server}:${ proxy.port }?${hysteria2params.join('&')}#${encodeURIComponent(