fix(ui): показывать ошибки и свежесть NetFlow карты
This commit is contained in:
1 parent
e47e2b4029
commit
1bce4e1ea2
7 files changed
+139
-45
No files matched your search
@@ -18,3 +18,13 @@ export function validateNetworkMapSnapshot(servers:unknown,gre:unknown,probes:un
|
||||
if(tunnels.failures.length)throw new Error("Неполный каталог GRE: "+tunnels.failures.map(failure=>failure.serverName||failure.serverId).join(", "))
|
||||
return {servers:inventory,tunnels:tunnels.tunnels,probes:measurements.probes}
|
||||
}
|
||||
|
||||
import {flowMapHopsDtoSchema} from "@mmapp/contracts/traffic-flow"
|
||||
import {isIpv4String} from "./gre-endpoint-resolve"
|
||||
export const networkMapFlowSchema=flowMapHopsDtoSchema.required().refine(data=>data.rangeMinutes===5&&data.namedBytes<=data.totalBytes&&data.unclassifiedBytes<=data.totalBytes)
|
||||
export function validateNetworkMapDns(raw:unknown,hosts:string[]){
|
||||
const data=z.object({results:z.record(z.string(),z.string().refine(isIpv4String).nullable())}).parse(raw)
|
||||
const requested=new Set(hosts.map(host=>host.toLowerCase()))
|
||||
if(Object.keys(data.results).length!==requested.size||Object.keys(data.results).some(host=>!requested.has(host)))throw new Error("DNS-ответ не соответствует запрошенным именам")
|
||||
return data.results
|
||||
}
|
||||
Reference in new issue
Block a user