forked from medicalwei/flower
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.example.js
More file actions
36 lines (29 loc) · 775 Bytes
/
Copy pathconfig.example.js
File metadata and controls
36 lines (29 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
flower configurations
*/
// the web viewer title
exports.siteName = "Dormitory flow";
exports.siteUri = "http://localhost:3000";
// Ports
exports.netflowPort = 9991;
exports.httpPort = 3000;
// postgresql database uri
exports.databaseUri = "tcp://someone:meow@localhost/flower";
var matcher = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
// valid ip rule
exports.ipRule = function(ip) {
var c = matcher.exec(ip);
if (!c) return false;
return (c[1] == 127 &&
c[2] == 0 &&
c[3] >= 0 && c[3] <= 255 &&
c[4] >= 1 && c[4] <= 254);
}
// banning rule
exports.banningRule = function(user) {
return user.upload + user.download > 3221225472;
}
/* TODO: banning trigger
exports.banningTrigger = function (ip, upload, download) {
}
*/