feat(traffic): разделить плоскости IPFIX и показать путь JH→EN
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]>
This commit is contained in:
Denozordec
2026-09-07 11:39:14 +07:00
co-authored by Cursor
parent cb799da13a
commit 90c8c393e5
32 changed files with 1656 additions and 65 deletions
@@ -96,10 +96,92 @@ resetFlowTemplatesForTests()
parseFlowPacket(tpl, "10.255.254.3")
const named = parseFlowPacket(data, "10.255.254.3")
assert.equal(named.length, 1)
assert.equal(named[0]?.inIface, "ether1")
assert.equal(named[0]?.inIface, "13")
assert.equal(named[0]?.src, "10.1.1.8")
}
resetFlowTemplatesForTests()
{
const tpl = Buffer.alloc(16 + 20)
tpl.writeUInt16BE(10, 0)
tpl.writeUInt16BE(tpl.length, 2)
tpl.writeUInt16BE(2, 16)
tpl.writeUInt16BE(20, 18)
tpl.writeUInt16BE(256, 20)
tpl.writeUInt16BE(3, 22)
tpl.writeUInt16BE(8, 24)
tpl.writeUInt16BE(4, 26)
tpl.writeUInt16BE(12, 28)
tpl.writeUInt16BE(4, 30)
tpl.writeUInt16BE(82, 32)
tpl.writeUInt16BE(6, 34)
const data = Buffer.alloc(16 + 18)
data.writeUInt16BE(10, 0)
data.writeUInt16BE(data.length, 2)
data.writeUInt16BE(256, 16)
data.writeUInt16BE(18, 18)
data[20] = 10; data[21] = 1; data[22] = 1; data[23] = 8
data[24] = 8; data[25] = 8; data[26] = 8; data[27] = 8
data.write("ether1", 28)
parseFlowPacket(tpl, "10.255.254.4")
const namedOnly = parseFlowPacket(data, "10.255.254.4")
assert.equal(namedOnly[0]?.inIface, "ether1")
}
resetFlowTemplatesForTests()
{
const fieldSpecs: Array<[number, number]> = [
[8, 4],
[12, 4],
[10, 4],
[14, 4],
[15, 4],
[152, 8],
[153, 8],
[1, 4],
]
const tplSetLen = 4 + 4 + fieldSpecs.length * 4
const tpl = Buffer.alloc(16 + tplSetLen)
tpl.writeUInt16BE(10, 0)
tpl.writeUInt16BE(tpl.length, 2)
tpl.writeUInt16BE(2, 16)
tpl.writeUInt16BE(tplSetLen, 18)
tpl.writeUInt16BE(256, 20)
tpl.writeUInt16BE(fieldSpecs.length, 22)
let off = 24
for (const [type, len] of fieldSpecs) {
tpl.writeUInt16BE(type, off)
tpl.writeUInt16BE(len, off + 2)
off += 4
}
const recLen = fieldSpecs.reduce((n, [, len]) => n + len, 0)
const data = Buffer.alloc(16 + 4 + recLen)
data.writeUInt16BE(10, 0)
data.writeUInt16BE(data.length, 2)
data.writeUInt16BE(256, 16)
data.writeUInt16BE(4 + recLen, 18)
let d = 20
data[d] = 10; data[d + 1] = 100; data[d + 2] = 1; data[d + 3] = 17; d += 4
data[d] = 173; data[d + 1] = 194; data[d + 2] = 160; data[d + 3] = 163; d += 4
data.writeUInt32BE(13, d); d += 4
data.writeUInt32BE(42, d); d += 4
data[d] = 198; data[d + 1] = 51; data[d + 2] = 100; data[d + 3] = 1; d += 4
data.writeBigUInt64BE(1_700_000_000_000n, d); d += 8
data.writeBigUInt64BE(1_700_000_060_000n, d); d += 8
data.writeUInt32BE(1500, d)
parseFlowPacket(tpl, "10.255.254.5")
const extra = parseFlowPacket(data, "10.255.254.5")
assert.equal(extra.length, 1)
assert.equal(extra[0]?.src, "10.100.1.17")
assert.equal(extra[0]?.dst, "173.194.160.163")
assert.equal(extra[0]?.inIface, "13")
assert.equal(extra[0]?.outIface, "42")
assert.equal(extra[0]?.nextHop, "198.51.100.1")
assert.equal(extra[0]?.flowStartMs, 1_700_000_000_000)
assert.equal(extra[0]?.flowEndMs, 1_700_000_060_000)
assert.equal(extra[0]?.bytes, 1500)
}
resetFlowTemplatesForTests()
{
const tpl = Buffer.alloc(16 + 16 + 20)