feat(xray): update xray-core to v26.9.9 and follow the udpHop move

Bump xtls/xray-core to 52a412d9e2f5 (v26.9.9) and the three binary pins in
DockerInit.sh and release.yml in lockstep.

Upstream moved UDP port hopping out of finalmask.quicParams.udpHop and into a
standalone "udphop" UDP mask with a different shape (mode / interval /
remotePorts / remoteIPs). The old key is gone from QuicParams, and since the
config loader ignores unknown fields it is now silently dropped rather than
rejected — port hopping just stops.

The panel adapts where that key was live:

- Both link importers rebuilt quicParams.udpHop from the standard mport param,
  so an imported hysteria2 link produced an outbound that no longer hops. They
  now emit a udphop mask in intervalremote mode, which is what the old key did.
  The mode is required: UDPHop.Build() rejects an empty or unknown one.
- validFinalMaskUDPTypes and UdpMaskTypeSchema learn "udphop", otherwise the Go
  link generator strips the mask from every link and sub, and Zod strips it on
  the next form round trip.
- mport generation (Go and frontend) reads the mask first and keeps reading the
  legacy key, so inbounds stored before the upgrade still advertise their range.

On an inbound the old key was always inert — only hysteria's dialer consumed
it — so nothing regresses server-side and no migration is needed. udphop stays
out of the mask dropdown on purpose: it is client-only in core, which refuses
to wrap a server socket, and that form is shared with the inbound editor.
This commit is contained in:
Sanaei
2026-09-09 01:53:00 +02:00
parent cfd596a489
commit d0edbcec81
15 changed files with 243 additions and 52 deletions
+13 -1
View File
@@ -751,6 +751,18 @@ function hysteriaPinHex(pin: string): string {
}
}
// Hysteria2 hop range advertised as `mport`. xray-core 26.9.9 moved hopping
// from finalmask.quicParams.udpHop to a 'udphop' UDP mask; inbounds stored
// before the upgrade still carry the old key.
function udpHopPorts(stream: NonNullable<Inbound['streamSettings']>): string {
for (const mask of stream.finalmask?.udp ?? []) {
if (mask.type !== 'udphop') continue;
const ports = mask.settings?.remotePorts;
if (typeof ports === 'string' && ports.trim().length > 0) return ports.trim();
}
return stream.finalmask?.quicParams?.udpHop?.ports?.trim() ?? '';
}
// Hysteria share link: hysteria2://<auth>@<host>:<port>?<query>#<remark>.
// The scheme is always hysteria2 — xray-core builds version 2 only, so the
// settings schema pins it there and the subscription server emits the same
@@ -817,7 +829,7 @@ export function genHysteriaLink(input: GenHysteriaLinkInput): string {
}
}
const hopPorts = stream.finalmask?.quicParams?.udpHop?.ports?.trim() ?? '';
const hopPorts = udpHopPorts(stream);
if (hopPorts.length > 0) {
params.set('mport', hopPorts);
}
+9 -11
View File
@@ -311,21 +311,19 @@ function applyHysteria2Obfs(stream: Raw, params: URLSearchParams): void {
finalmask.udp = [...udp, { type: 'salamander', settings }];
}
// Rebuild the UDP port-hopping range from the standard mport param, which the
// generator emits as finalmask.quicParams.udpHop.ports. A range already supplied
// via fm= wins; the client-side interval falls back to the panel's default.
// Rebuild the UDP port-hopping range from the standard mport param. xray-core
// 26.9.9 replaced finalmask.quicParams.udpHop with a 'udphop' UDP mask, whose
// intervalremote mode is what the old key used to do; an fm= mask wins.
function applyHysteria2Hop(stream: Raw, params: URLSearchParams): void {
const ports = firstParam(params, 'mport');
if (!ports) return;
const finalmask = ensureFinalMask(stream);
const quicParams = (
finalmask.quicParams && typeof finalmask.quicParams === 'object'
? finalmask.quicParams
: (finalmask.quicParams = {})
) as Raw;
const existingHop = quicParams.udpHop as Raw | undefined;
if (existingHop && typeof existingHop.ports === 'string' && existingHop.ports.length > 0) return;
quicParams.udpHop = { ports, interval: '5-10' };
const udp = Array.isArray(finalmask.udp) ? (finalmask.udp as Raw[]) : [];
if (udp.some((mask) => (mask as Raw | undefined)?.type === 'udphop')) return;
finalmask.udp = [
...udp,
{ type: 'udphop', settings: { mode: 'intervalremote', interval: '5-10', remotePorts: ports } },
];
}
const QUIC_PARAMS_NUMERIC_KEYS = [