mixed.ts 812 B

123456789101112131415161718192021
  1. import { z } from 'zod';
  2. export const MixedAuthSchema = z.enum(['password', 'noauth']);
  3. export type MixedAuth = z.infer<typeof MixedAuthSchema>;
  4. // SOCKS/HTTP combined inbound. When auth==='noauth' the `accounts` field is
  5. // omitted from the wire payload (the panel writes `undefined`), so we accept
  6. // either an array or absence here.
  7. export const MixedAccountSchema = z.object({
  8. user: z.string().min(1),
  9. pass: z.string().min(1),
  10. });
  11. export type MixedAccount = z.infer<typeof MixedAccountSchema>;
  12. export const MixedInboundSettingsSchema = z.object({
  13. auth: MixedAuthSchema.default('password'),
  14. accounts: z.array(MixedAccountSchema).optional(),
  15. udp: z.boolean().default(false),
  16. ip: z.string().default('127.0.0.1'),
  17. });
  18. export type MixedInboundSettings = z.infer<typeof MixedInboundSettingsSchema>;