v1.1: Add CIDR subnet filtering and Agent filter in Devices page

This commit is contained in:
ypratama committed 2026-08-27 12:02:01 +07:00
commit 966058e2fe
422 files changed
+54656

No files matched your search

@@ -0,0 +1,22 @@
// backend/routes/dashboard/telemetryHelper.js
// ─────────────────────────────────────────────────────────────────────────────
// Aggregation helpers for Telemetry routes (SNI, SSL, QUIC fallbacks)
// ─────────────────────────────────────────────────────────────────────────────
const SYSTEM_DOMAINS = ['agents.backone.ai', 'agents.backonedpi.ai'];
async function getSniFallbackData(Flow, matchBase, fieldName) {
const flowBase = { ...matchBase, domain: { $exists: true, $ne: null, $ne: '', $nin: SYSTEM_DOMAINS } };
const flowRaw = await Flow.aggregate([
{ $match: flowBase },
{ $group: { _id: '$domain', download: { $sum: '$download' }, upload: { $sum: '$upload' }, flows: { $sum: 1 } } },
{ $project: { [fieldName]: '$_id', total: { $add: ['$download', '$upload'] }, download: 1, upload: 1, flows: 1, _id: 0 } },
{ $sort: { total: -1 } }
]);
return flowRaw.filter(r => r[fieldName] && !String(r[fieldName]).startsWith('Port '));
}
module.exports = {
SYSTEM_DOMAINS,
getSniFallbackData
};