mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-14 08:36:07 +00:00
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:
@@ -2,15 +2,16 @@ import { z } from 'zod';
|
||||
|
||||
import { PortSchema } from '@/schemas/primitives';
|
||||
|
||||
export const DNSRuleActionSchema = z.enum(['direct', 'reject', 'rejectIPv4', 'rejectIPv6']);
|
||||
export const DNSRuleActionSchema = z.enum(['direct', 'drop', 'return', 'hijack']);
|
||||
|
||||
// On the wire `qtype` is either a number (DNS type code) or a string like
|
||||
// On the wire `qType` is either a number (DNS type code) or a string like
|
||||
// "A"/"AAAA"/"TXT"; the panel normalizes numeric strings to numbers in
|
||||
// toJson. `domain` is a string[] (split from a comma-joined input).
|
||||
export const DNSRuleSchema = z.object({
|
||||
action: DNSRuleActionSchema.default('direct'),
|
||||
qtype: z.union([z.string(), z.number().int()]).optional(),
|
||||
qType: z.union([z.string(), z.number().int()]).optional(),
|
||||
domain: z.array(z.string()).optional(),
|
||||
rCode: z.number().int().min(0).max(65535).optional(),
|
||||
});
|
||||
export type DNSRule = z.infer<typeof DNSRuleSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user