feat(xray): update xray-core to v26.10.10 and adapt panel

Move the three Xray binary pins (DockerInit.sh, both release.yml
fetches) to v26.10.10, in lockstep with the xtls/xray-core module that
82c77111 already bumped to 701af60772cd.

xdns finalmask (#7090): a domain now takes a "names" list instead of a
single "name", and a resolver is an "addrs" list of udp:// or tcp://
URLs instead of {type, settings:{addr}}. The loader ignores the old
keys rather than failing, so every mask the 26.9.30 seeder wrote would
load with no domain and no resolver and the tunnel would carry nothing.
maskcompat.UpgradeLegacyXdns now lifts both the pre-26.9.30 string lists
and the 26.9.30 objects straight to names/addrs, dropping entries the
old loader refused. A new seeder (XdnsFinalmaskNamesAddrsFix) reruns it
over every stored finalmask, and the save path, GetXrayConfig, both
link importers and the mask editor's mount lift go through it. Template
outbounds now get the build-time heal too: a 26.9.30 template pasted
after the seeder passes the save check, since the core loads that shape
without error. The editor edits names and addrs as tag lists and no
longer requires record types, which the core now defaults (TXT on a
client, A/CNAME/TXT/AAAA on a server). The wire format did not change,
but clients on an older core cannot read the new config shape.

Lua scripts (#6823): dns.script, routing.script and dns servers[].id
are new. The xray page parsed the dns block with a strict schema, so
loading it dropped script and id and the next save deleted them; the
schema now keeps both and the DNS server modal carries the id through
an edit. The hot routing apply built routing in-process, and that build
now resolves the script file from the panel's working directory, so a
script beside the xray binary failed every rule change into a full
restart and broke the node bridge. RoutingService cannot change the
script anyway, so the panel no longer resolves it there.

TLS client roots (#7105): the core now verifies against its bundled
Mozilla roots instead of the OS store unless tlsSettings.useSystemCA is
set. The outbound TLS form gets a switch for it, so an outbound to a
server signed by a privately installed CA can opt back in.
This commit is contained in:
MHSanaei
2026-10-11 07:55:12 +02:00
parent 82c7711189
commit 73a028f52d
37 changed files with 553 additions and 205 deletions
@@ -246,7 +246,7 @@ export default function FinalMaskForm({
const base = asPath(name);
// Migrate legacy mask shapes once on mount so configs saved before #6334 (fragment
// ranges), #6487 (xmc profiles) and #6718 (xdns objects) render in the list UI.
// ranges), #6487 (xmc profiles) and #7090 (xdns names/addrs) render in the list UI.
const migratedRef = useRef(false);
useEffect(() => {
if (migratedRef.current) return;
@@ -1280,7 +1280,7 @@ function XdnsSettings({ udpFieldName }: { udpFieldName: number }) {
size="small"
icon={<PlusOutlined />}
aria-label={t('add')}
onClick={() => add({ name: '', types: [16], edns0: XDNS_LEGACY_EDNS0 })}
onClick={() => add({ names: [], edns0: XDNS_LEGACY_EDNS0 })}
/>
</Form.Item>
{domains.map((domain, di) => (
@@ -1296,15 +1296,20 @@ function XdnsSettings({ udpFieldName }: { udpFieldName: number }) {
onKeyDown={activateOnKey(() => remove(domain.name))}
/>
</Divider>
<Form.Item label="Name" name={[domain.name, 'name']}>
<Input placeholder="t.example.com" />
<Form.Item label="Names" name={[domain.name, 'names']}>
<Select
mode="tags"
style={{ width: '100%' }}
tokenSeparators={[',']}
placeholder="t.example.com"
/>
</Form.Item>
<Form.Item
label="Record Types"
name={[domain.name, 'types']}
rules={[{ required: true, type: 'array', min: 1 }]}
>
<Select mode="multiple" options={XDNS_RECORD_TYPE_OPTIONS} />
<Form.Item label="Record Types" name={[domain.name, 'types']}>
<Select
mode="multiple"
options={XDNS_RECORD_TYPE_OPTIONS}
placeholder="TXT (client), all (server)"
/>
</Form.Item>
<Form.Item label="EDNS0" name={[domain.name, 'edns0']}>
<InputNumber min={512} max={4096} placeholder="off" />
@@ -1329,24 +1334,20 @@ function XdnsSettings({ udpFieldName }: { udpFieldName: number }) {
size="small"
icon={<PlusOutlined />}
aria-label={t('add')}
onClick={() => add({ type: 'udp', settings: { addr: '' } })}
onClick={() => add({ addrs: [] })}
/>
</Form.Item>
{resolvers.map((resolver, ri) => (
<Form.Item key={resolver.key} label={`Resolver ${ri + 1}`}>
<Space.Compact block>
<Form.Item name={[resolver.name, 'type']} noStyle>
<Form.Item name={[resolver.name, 'addrs']} noStyle>
<Select
style={{ width: 80 }}
options={[
{ value: 'udp', label: 'UDP' },
{ value: 'tcp', label: 'TCP' },
]}
mode="tags"
style={{ width: '100%' }}
tokenSeparators={[',', ' ']}
placeholder="udp://8.8.8.8:53, tcp://1.1.1.1"
/>
</Form.Item>
<Form.Item name={[resolver.name, 'settings', 'addr']} noStyle>
<Input placeholder="8.8.8.8:53" />
</Form.Item>
<Button
icon={<DeleteOutlined />}
aria-label={t('remove')}
+49 -18
View File
@@ -5,6 +5,10 @@ export const XDNS_LEGACY_EDNS0 = 1232;
const LEGACY_RECORD_TYPES: Record<string, number> = { '': 16, txt: 16, a: 1, aaaa: 28 };
function isRaw(value: unknown): value is Raw {
return !!value && typeof value === 'object' && !Array.isArray(value);
}
function legacyDomain(spec: string): Raw | null {
let name = spec.trim();
let method = '';
@@ -16,46 +20,73 @@ function legacyDomain(spec: string): Raw | null {
name = name.replace(/^\.+|\.+$/g, '');
const type = LEGACY_RECORD_TYPES[method];
if (!name || type === undefined) return null;
return { name, types: [type], edns0: XDNS_LEGACY_EDNS0 };
return { names: [name], types: [type], edns0: XDNS_LEGACY_EDNS0 };
}
// xray-core 26.9.30 (#6718) parses xdns domains/resolvers only as objects. Mirrors
/** Folds a 26.9.30 domain's single `name` into the `names` list. */
function upgradeDomainObject(domain: Raw): Raw {
if (!('name' in domain)) return domain;
const { name: raw, ...rest } = domain;
const name = typeof raw === 'string' ? raw.trim() : '';
const names = Array.isArray(rest.names) ? [...(rest.names as unknown[])] : [];
if (name && !names.includes(name)) names.unshift(name);
return { ...rest, names };
}
/** A 26.9.30 {type, settings:{addr}} resolver as an addrs URL; that loader took only udp/tcp. */
function legacyResolverAddr(resolver: Raw): string | null {
const kind = typeof resolver.type === 'string' ? resolver.type.trim().toLowerCase() : '';
const settings = isRaw(resolver.settings) ? resolver.settings : {};
const addr = typeof settings.addr === 'string' ? settings.addr.trim() : '';
if ((kind !== 'udp' && kind !== 'tcp') || !addr) return null;
return `${kind}://${addr}`;
}
const isLegacyDomain = (v: unknown) => typeof v === 'string' || (isRaw(v) && 'name' in v);
const isLegacyResolver = (v: unknown) => typeof v === 'string' || (isRaw(v) && !('addrs' in v));
// xray-core 26.10.10 (#7090) reads xdns only as names/addrs lists. Mirrors
// internal/util/maskcompat: a bare name becomes TXT, entries the old core refused are dropped.
export function upgradeLegacyXdnsSettings(settings: Raw): { next: Raw; changed: boolean } {
const rawDomains = Array.isArray(settings.domains) ? (settings.domains as unknown[]) : [];
const rawResolvers = Array.isArray(settings.resolvers) ? (settings.resolvers as unknown[]) : [];
const isLegacy = (v: unknown) => typeof v === 'string';
if (!rawDomains.some(isLegacy) && !rawResolvers.some(isLegacy)) {
if (!rawDomains.some(isLegacyDomain) && !rawResolvers.some(isLegacyResolver)) {
return { next: settings, changed: false };
}
const domains: unknown[] = [];
const listed = new Set<string>();
const addDomain = (domain: Raw) => {
const key = String(domain.name ?? '').toLowerCase();
if (key && listed.has(key)) return;
listed.add(key);
const names = Array.isArray(domain.names) ? (domain.names as unknown[]) : [];
for (const name of names) if (typeof name === 'string') listed.add(name.toLowerCase());
domains.push(domain);
};
const addLegacyDomain = (domain: Raw) => {
const [name] = domain.names as string[];
if (!listed.has(name.toLowerCase())) addDomain(domain);
};
for (const entry of rawDomains) {
if (typeof entry === 'string') {
const domain = legacyDomain(entry);
if (domain) addDomain(domain);
} else if (entry && typeof entry === 'object') {
addDomain(entry as Raw);
if (domain) addLegacyDomain(domain);
} else if (isRaw(entry)) {
addDomain(upgradeDomainObject(entry));
}
}
const resolvers: unknown[] = [];
for (const entry of rawResolvers) {
if (typeof entry !== 'string') {
if (typeof entry === 'string') {
const sep = entry.indexOf('+udp://');
const addr = sep >= 0 ? entry.slice(sep + '+udp://'.length).trim() : '';
const domain = sep >= 0 ? legacyDomain(entry.slice(0, sep)) : null;
if (!addr || !domain) continue;
addLegacyDomain(domain);
resolvers.push({ addrs: [`udp://${addr}`] });
} else if (isRaw(entry) && isLegacyResolver(entry)) {
const addr = legacyResolverAddr(entry);
if (addr) resolvers.push({ addrs: [addr] });
} else {
resolvers.push(entry);
continue;
}
const sep = entry.indexOf('+udp://');
const addr = sep >= 0 ? entry.slice(sep + '+udp://'.length).trim() : '';
const domain = sep >= 0 ? legacyDomain(entry.slice(0, sep)) : null;
if (!addr || !domain) continue;
addDomain(domain);
resolvers.push({ type: 'udp', settings: { addr } });
}
const next: Raw = { ...settings, domains };
if (resolvers.length > 0) next.resolvers = resolvers;