Docker images / prepare-release (push) Successful in 8s
Docker images / backend-image (push) Failing after 1m31s
Docker images / frontend-image (push) Successful in 2m36s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 42s
Docker images / publish-release (push) Skipped
Считать payload отдельно от overlay GRE/ESP и mesh; вкладка Пути и KPI Wire из счётчиков iface. Co-authored-by: Cursor <[email protected]>
83 lines
2.1 KiB
TypeScript
83 lines
2.1 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import {
|
|
classifyFlowPlane,
|
|
classifyFlowPlaneLite,
|
|
flowBps,
|
|
shouldKeepPlane,
|
|
} from "./traffic-flow-planes.js"
|
|
|
|
const youtubeInner = {
|
|
src: "10.100.1.17",
|
|
dst: "173.194.160.163",
|
|
proto: 6,
|
|
srcPort: 51234,
|
|
dstPort: 443,
|
|
inIface: "gre-client",
|
|
outIface: "NSK-SERVHOST-RTK",
|
|
}
|
|
assert.equal(classifyFlowPlaneLite(youtubeInner), "payload")
|
|
assert.equal(classifyFlowPlane(youtubeInner), "payload")
|
|
|
|
const greOverlay = {
|
|
src: "203.0.113.10",
|
|
dst: "198.51.100.1",
|
|
proto: 47,
|
|
srcPort: 0,
|
|
dstPort: 0,
|
|
inIface: "ether1",
|
|
outIface: "NSK-SERVHOST-RTK",
|
|
}
|
|
assert.equal(classifyFlowPlaneLite(greOverlay), "overlay")
|
|
|
|
const espOverlay = { ...greOverlay, proto: 50 }
|
|
assert.equal(classifyFlowPlaneLite(espOverlay), "overlay")
|
|
|
|
const mesh = {
|
|
src: "10.100.1.17",
|
|
dst: "10.100.1.18",
|
|
proto: 6,
|
|
srcPort: 50000,
|
|
dstPort: 443,
|
|
inIface: "gre-a",
|
|
outIface: "gre-b",
|
|
}
|
|
assert.equal(classifyFlowPlaneLite(mesh), "client_mesh")
|
|
|
|
const mgmt = {
|
|
src: "10.255.254.2",
|
|
dst: "10.255.254.1",
|
|
proto: 17,
|
|
srcPort: 4739,
|
|
dstPort: 4739,
|
|
inIface: "wg-flow",
|
|
outIface: "",
|
|
}
|
|
assert.equal(classifyFlowPlaneLite(mgmt), "mgmt")
|
|
assert.equal(classifyFlowPlaneLite({ ...youtubeInner, outIface: "wg-flow" }), "payload")
|
|
assert.equal(shouldKeepPlane("mgmt", {}), false)
|
|
assert.equal(shouldKeepPlane("overlay", {}), false)
|
|
assert.equal(shouldKeepPlane("client_mesh", {}), false)
|
|
assert.equal(shouldKeepPlane("payload", {}), true)
|
|
assert.equal(shouldKeepPlane("overlay", { excludeOverlay: false }), true)
|
|
assert.equal(shouldKeepPlane("client_mesh", { excludeMesh: false }), true)
|
|
|
|
assert.equal(flowBps(1500, 1_000, 2_000, 300), (1500 * 8) / 1)
|
|
assert.equal(flowBps(1500, 0, 0, 300), (1500 * 8) / 300)
|
|
|
|
const publicJhEn = {
|
|
src: "203.0.113.10",
|
|
dst: "198.51.100.1",
|
|
proto: 6,
|
|
srcPort: 1000,
|
|
dstPort: 443,
|
|
inIface: "ether1",
|
|
outIface: "gre-en",
|
|
}
|
|
assert.equal(classifyFlowPlane(publicJhEn, {
|
|
clientIfaceNames: new Set(["gre-client"]),
|
|
enHosts: new Set(["198.51.100.1"]),
|
|
jhHosts: new Set(["203.0.113.10"]),
|
|
}), "overlay")
|
|
|
|
console.log("traffic-flow-planes.test.ts: ok")
|