From 5a720fda0f88f106a2efef0eff03b3950efc6a04 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 16 Jun 2018 15:10:18 -0400 Subject: [PATCH] Add forward destinations to fake data Signed-off-by: Mcat12 --- make-fake-data.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/make-fake-data.js b/make-fake-data.js index a41d5ad..2fb90ec 100644 --- a/make-fake-data.js +++ b/make-fake-data.js @@ -96,6 +96,27 @@ function queryTypes() { return data; } +function forwardDestinations(length) { + const totalQueries = faker.random.number(); + const destinations = []; + const numbers = []; + const names = unique(faker.internet.domainName, length); + const ipAddrs = unique(faker.internet.ip, length); + + for(let i = 0; i < length; i++) + numbers.push(faker.random.number({ max: totalQueries })); + + for(let i = 0; i < length; i++) { + destinations.push({ + name: names[i], + ip: ipAddrs[i], + percent: numbers[i] / totalQueries + }); + } + + return destinations; +} + function topList(length, max, fakeData) { const result = []; const numbers = []; @@ -222,6 +243,7 @@ write("public/fakeAPI/stats/overTime/clients", clientsOverTime(144, 5)); write("public/fakeAPI/stats/summary", summary()); write("public/fakeAPI/stats/history", history(5000)); write("public/fakeAPI/stats/query_types", queryTypes()); +write("public/fakeAPI/stats/forward_destinations", forwardDestinations(30)); write("public/fakeAPI/stats/top_blocked", topBlocked(10)); write("public/fakeAPI/stats/top_domains", topDomains(10)); write("public/fakeAPI/stats/top_clients", topClients(10));