fix(netflow): согласовать проверку сетевых параметров формы и сервера
This commit is contained in:
1 parent
32b7812169
commit
b80fa042d5
12 files changed
+56
-20
No files matched your search
@@ -31,15 +31,24 @@ export const trafficFlowSettingsDtoSchema = z.object({
|
||||
peers: z.array(flowHostPeerSchema),
|
||||
})
|
||||
|
||||
// The current overlay allocator and host setup operate on IPv4.
|
||||
export const trafficFlowCollectorIpSchema = z.ipv4("Укажите IPv4-адрес коллектора")
|
||||
export const trafficFlowOverlayPrefixSchema = z.cidrv4("Укажите IPv4-префикс в формате CIDR")
|
||||
export const trafficFlowPublicEndpointSchema = z.string().refine(value => {
|
||||
if (value === "" || z.ipv4().safeParse(value).success || z.ipv6().safeParse(value).success) return true
|
||||
const hostname = value.endsWith(".") ? value.slice(0, -1) : value
|
||||
return hostname.length <= 253 && /[a-z]/i.test(hostname) && hostname.split(".").every(label => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label))
|
||||
}, "Endpoint: укажите IP или DNS-имя без порта и протокола")
|
||||
|
||||
export const trafficFlowSettingsPatchSchema = z.object({
|
||||
enabled: z.boolean().optional(),
|
||||
collectorIp: z.string().min(1).optional(),
|
||||
flowListenPort: z.number().int().positive().optional(),
|
||||
wgListenPort: z.number().int().positive().optional(),
|
||||
prefix: z.string().min(1).optional(),
|
||||
publicEndpoint: z.string().optional(),
|
||||
collectorIp: trafficFlowCollectorIpSchema.optional(),
|
||||
flowListenPort: z.number().int().positive().max(65535).optional(),
|
||||
wgListenPort: z.number().int().positive().max(65535).optional(),
|
||||
prefix: trafficFlowOverlayPrefixSchema.optional(),
|
||||
publicEndpoint: trafficFlowPublicEndpointSchema.optional(),
|
||||
hubServerId: z.number().int().positive().nullable().optional(),
|
||||
retentionHours: z.number().int().positive().optional(),
|
||||
retentionHours: z.number().int().positive().max(2147483647).optional(),
|
||||
topN: z.number().int().positive().max(1000).optional(),
|
||||
mapServiceMinSharePct: z.number().min(0).max(100).optional(),
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user