fix(ui): сохранять данные Firewall при сбоях загрузки
This commit is contained in:
1 parent
92ba474ca9
commit
59440555cd
6 files changed
+173
-47
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { z } from "zod"
|
||||
|
||||
const context = { id: z.string().min(1), rosId: z.string().min(1), serverId: z.string().min(1), serverName: z.string(), family: z.enum(["ip", "ip6"]) }
|
||||
export const firewallResponseSchema = z.object({
|
||||
rules: z.array(z.object({
|
||||
...context, table: z.enum(["filter", "nat", "mangle", "raw"]), chain: z.string(), action: z.string(),
|
||||
proto: z.string(), src: z.string(), dst: z.string(), port: z.string(), iface: z.string(),
|
||||
comment: z.string(), enabled: z.boolean(), hits: z.number().int().nonnegative(),
|
||||
log: z.boolean().optional(), logPrefix: z.string().optional(), tlsHost: z.string().optional(),
|
||||
connRateLimit: z.string().optional(), layer7Proto: z.string().optional(), nfqueueId: z.number().int().nonnegative().optional(),
|
||||
})).refine(rows => new Set(rows.map(row => row.id)).size === rows.length),
|
||||
addressLists: z.array(z.object({ ...context, list: z.string(), address: z.string(), comment: z.string(), disabled: z.boolean(), timeout: z.string().optional() }))
|
||||
.refine(rows => new Set(rows.map(row => row.id)).size === rows.length),
|
||||
})
|
||||
|
||||
export const firewallServersSchema = z.array(z.object({
|
||||
id: z.number().int().positive(), name: z.string(), host: z.string(), enabled: z.boolean(), country: z.string(),
|
||||
type: z.enum(["jump-host", "exit-node", "home-router"]), site: z.string().default(""), asn: z.string().default(""),
|
||||
status: z.enum(["online", "offline", "degraded"]).nullable().default(null), latency: z.number().finite().nullable().default(null),
|
||||
})).refine(rows => new Set(rows.map(row => row.id)).size === rows.length)
|
||||
|
||||
export type FirewallBackendServer = z.infer<typeof firewallServersSchema>[number]
|
||||
Reference in new issue
Block a user