mirror of
https://github.com/gosticks/web.git
synced 2026-12-03 17:51:39 +00:00
Add forward destinations to fake data
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user