feat(outbound): sync DNS outbound config with Xray core changes

Rename the DNS rule wire key qtype to qType (reading the legacy qtype on parse for back-compat), add the new rCode response-code field for the return action (omitted when zero), and rename the reject action to return. Align the DNS rule action set across the form dropdown, schema, and adapter to the core's valid values (direct/drop/return/hijack), dropping the never-valid rejectIPv4/rejectIPv6 entries.
This commit is contained in:
MHSanaei
2026-06-01 10:24:35 +02:00
parent 32f96298f8
commit 2bb9ed1cda
6 changed files with 42 additions and 25 deletions
+4 -3
View File
@@ -29,7 +29,7 @@ import {
// the adapter wraps them as { reverse: { tag, sniffing } } on the wire.
// - blackhole `type` ('' | 'none' | 'http') is flat; the adapter wraps it
// as { response: { type } } on the wire (omitted when empty).
// - DNS rules carry `qtype` and `domain` as comma-joined strings (matches
// - DNS rules carry `qType` and `domain` as comma-joined strings (matches
// the legacy DNSRule UI). The adapter normalizes them on submit.
//
// All flat-form settings types are documented inline so the adapter has a
@@ -186,12 +186,13 @@ export const BlackholeOutboundFormSettingsSchema = z.object({
});
export type BlackholeOutboundFormSettings = z.infer<typeof BlackholeOutboundFormSettingsSchema>;
// DNS rules: form holds qtype + domain as joined strings (the legacy UI
// DNS rules: form holds qType + domain as joined strings (the legacy UI
// binds to <Input>). Adapter parses them on submit per the DNSRule class.
export const DnsRuleFormSchema = z.object({
action: DNSRuleActionSchema.default('direct'),
qtype: z.string().default(''),
qType: z.string().default(''),
domain: z.string().default(''),
rCode: z.number().int().min(0).max(65535).default(0),
});
export type DnsRuleForm = z.infer<typeof DnsRuleFormSchema>;