trojan.ts 705 B

123456789101112131415161718
  1. import { z } from 'zod';
  2. import { PortSchema } from '@/schemas/primitives';
  3. // Trojan outbound persists as { servers: [{ address, port, password }] }
  4. // — distinct from VLESS outbound which stores the connect target flat at
  5. // the settings root. The wrapping mirrors what Xray expects.
  6. export const TrojanOutboundServerSchema = z.object({
  7. address: z.string().min(1),
  8. port: PortSchema,
  9. password: z.string().min(1),
  10. });
  11. export type TrojanOutboundServer = z.infer<typeof TrojanOutboundServerSchema>;
  12. export const TrojanOutboundSettingsSchema = z.object({
  13. servers: z.array(TrojanOutboundServerSchema).min(1),
  14. });
  15. export type TrojanOutboundSettings = z.infer<typeof TrojanOutboundSettingsSchema>;