gitscope
← marzneshin / v0.3.0-alpha2 / dashboard/src/features/hosts/schema/hosts-schema.ts
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/hosts/schema/hosts-schema.ts · TypeScript
Blame Raw
 1import { z } from "zod";
 2
 3export const HostSchema = z.object({
 4    remark: z.string().min(1, 'Remark is required'),
 5    address: z.string().min(1, 'Address is required'),
 6    port: z.coerce.number()
 7        .gte(1, 'Port must be more than 1')
 8        .lte(65535, 'Port can not be more than 65535')
 9        .or(z.string()),
10    path: z.string(),
11    sni: z.string().optional(),
12    host: z.string().optional(),
13    security: z.enum(['inbound_default', 'none', 'tls']),
14    alpn: z.enum(['none', 'h2', 'http/1.1', 'h2,http/1.1']).optional(),
15    allowinsecure: z.boolean().default(false),
16    fingerprint: z.enum([
17        "none",
18        "chrome",
19        "firefox",
20        "safari",
21        "ios",
22        "android",
23        "edge",
24        "360",
25        "qq",
26        "random",
27        "randomized",
28    ]).optional(),
29});