@hyperwatch/hyperwatch 3.8.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@hyperwatch/hyperwatch",
3
+ "version": "3.9.0",
3
4
  "description": "Open Source HTTP Traffic Manager",
4
5
  "license": "Apache-2.0",
5
6
  "author": "François Hodierne <francois@hodierne.net>",
@@ -11,7 +12,6 @@
11
12
  "type": "git",
12
13
  "url": "https://github.com/hyperwatch/hyperwatch.git"
13
14
  },
14
- "version": "3.8.2",
15
15
  "main": "hyperwatch.js",
16
16
  "bin": {
17
17
  "hyperwatch": "./bin/hyperwatch"
@@ -27,39 +27,39 @@
27
27
  "prettier:write": "npm run prettier -- --write"
28
28
  },
29
29
  "dependencies": {
30
- "@hyperwatch/useragent": "^3.7.4",
30
+ "@hyperwatch/useragent": "^3.9.1",
31
31
  "accept-language-parser": "^1.5.0",
32
- "ajv": "^8.6.2",
33
- "ajv-formats": "^2.1.0",
32
+ "ajv": "^8.11.0",
33
+ "ajv-formats": "^2.1.1",
34
34
  "chalk": "^4.1.0",
35
- "country-code-emoji": "^2.1.0",
36
- "debug": "^4.3.1",
35
+ "country-code-emoji": "^2.3.0",
36
+ "debug": "^4.3.4",
37
37
  "dnsbl": "^3.2.0",
38
- "express": "^4.17.1",
38
+ "express": "^4.18.2",
39
39
  "express-ws": "^5.0.2",
40
- "geoip-lite": "^1.4.2",
41
- "immutable": "^4.0.0-rc.12",
42
- "ip-cidr": "^3.0.3",
43
- "lodash": "^4.17.20",
44
- "lru-cache": "^6.0.0",
40
+ "geoip-lite": "^1.4.6",
41
+ "immutable": "^4.1.0",
42
+ "ip-cidr": "^3.0.10",
43
+ "lodash": "^4.17.21",
44
+ "lru-cache": "^7.14.0",
45
45
  "micro-strptime": "^0.2.3",
46
- "proxy-addr": "^2.0.6",
46
+ "proxy-addr": "^2.0.7",
47
47
  "rc": "^1.2.8",
48
48
  "syslog-parse": "^1.3.1",
49
- "tail": "^2.0.4",
50
- "uuid": "^8.3.2",
51
- "ws": "^8.0.0"
49
+ "tail": "^2.2.4",
50
+ "uuid": "^9.0.0",
51
+ "ws": "^8.9.0"
52
52
  },
53
53
  "devDependencies": {
54
- "depcheck": "^1.3.1",
55
- "eslint": "^7.15.0",
56
- "eslint-plugin-import": "^2.22.1",
54
+ "depcheck": "^1.4.3",
55
+ "eslint": "^8.25.0",
56
+ "eslint-plugin-import": "^2.26.0",
57
57
  "eslint-plugin-node": "^11.1.0",
58
58
  "husky": "^4.3.5",
59
59
  "lint-staged": "^10.5.3",
60
- "mocha": "^9.0.2",
61
- "prettier": "^2.2.1",
62
- "prettier-package-json": "^2.1.3"
60
+ "mocha": "^10.0.0",
61
+ "prettier": "^2.7.1",
62
+ "prettier-package-json": "^2.7.0"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=12.0"
package/src/index.js CHANGED
@@ -18,7 +18,7 @@ function init(config = {}) {
18
18
  return;
19
19
  }
20
20
  merge(constants, config);
21
- modules.load();
21
+ modules.init();
22
22
  initialized = true;
23
23
  }
24
24
 
@@ -27,7 +27,7 @@ function start() {
27
27
  console.warn(`Can't start, Hyperwatch was not initialized.`);
28
28
  return;
29
29
  }
30
- modules.beforeStart();
30
+ modules.start();
31
31
  return Promise.all([app.start(), pipeline.start()]);
32
32
  }
33
33
 
@@ -11,11 +11,11 @@ function fill(log) {
11
11
  return log;
12
12
  }
13
13
 
14
- function load() {
14
+ function init() {
15
15
  pipeline.getNode('main').map(fill).registerNode('main');
16
16
  }
17
17
 
18
- function beforeStart() {
18
+ function start() {
19
19
  const aggregator = new Aggregator();
20
20
 
21
21
  aggregator.setIdentifier(identifier);
@@ -26,6 +26,6 @@ function beforeStart() {
26
26
  }
27
27
 
28
28
  module.exports = {
29
- load,
30
- beforeStart,
29
+ init,
30
+ start,
31
31
  };
@@ -66,7 +66,7 @@ const osFormat = (log) => {
66
66
  return agentOs.get('family');
67
67
  };
68
68
 
69
- function load() {
69
+ function init() {
70
70
  pipeline.getNode('main').map(augment).registerNode('main');
71
71
 
72
72
  aggregator.defaultFormatter.insertFormat('agent', agentFormat, {
@@ -84,7 +84,7 @@ function load() {
84
84
  module.exports = {
85
85
  lookup,
86
86
  augment,
87
- load,
87
+ init,
88
88
  agentFormat,
89
89
  osFormat,
90
90
  };
@@ -35,11 +35,11 @@ function augment(log) {
35
35
  return log;
36
36
  }
37
37
 
38
- function load() {
38
+ function init() {
39
39
  pipeline.getNode('main').map(augment).registerNode('main');
40
40
  }
41
41
 
42
42
  module.exports = {
43
43
  augment,
44
- load,
44
+ init,
45
45
  };
@@ -33,7 +33,7 @@ const xblFormat = (log, output) => {
33
33
  }
34
34
  };
35
35
 
36
- function load() {
36
+ function init() {
37
37
  pipeline.getNode('main').map(augment).registerNode('main');
38
38
 
39
39
  aggregator.defaultFormatter.insertFormat('xbl', xblFormat, {
@@ -44,5 +44,5 @@ function load() {
44
44
 
45
45
  module.exports = {
46
46
  augment,
47
- load,
47
+ init,
48
48
  };
@@ -34,7 +34,7 @@ const country = (log, output) => {
34
34
  }
35
35
  };
36
36
 
37
- function load() {
37
+ function init() {
38
38
  pipeline.getNode('main').map(augment).registerNode('main');
39
39
 
40
40
  aggregator.defaultFormatter.insertFormat('country', country, {
@@ -53,6 +53,6 @@ function load() {
53
53
 
54
54
  module.exports = {
55
55
  lookup,
56
- load,
56
+ init,
57
57
  augment,
58
58
  };
@@ -78,12 +78,12 @@ async function augment(log, { fast = false } = {}) {
78
78
  return log;
79
79
  }
80
80
 
81
- function load() {
81
+ function init() {
82
82
  pipeline.getNode('main').map(augment).registerNode('main');
83
83
  }
84
84
 
85
85
  module.exports = {
86
86
  lookup,
87
87
  augment,
88
- load,
88
+ init,
89
89
  };
@@ -174,6 +174,10 @@ function augment(log) {
174
174
  return hostname && hostname.endsWith('.arquivo.pt')
175
175
  ? log.set('identity', 'Arquivo')
176
176
  : log;
177
+ case 'SeekportBot':
178
+ return hostname && hostname.endsWith('.007ac9.net')
179
+ ? log.set('identity', 'Seekport')
180
+ : log;
177
181
 
178
182
  // Per hostname + CIDR
179
183
  case 'Twitterbot':
@@ -310,11 +314,11 @@ const identifier = (log) =>
310
314
  log.getIn(['address', 'value']) ||
311
315
  log.getIn(['request', 'address']);
312
316
 
313
- function load() {
317
+ function init() {
314
318
  pipeline.getNode('main').map(augment).registerNode('main');
315
319
  }
316
320
 
317
- function beforeStart() {
321
+ function start() {
318
322
  const aggregator = new Aggregator();
319
323
 
320
324
  aggregator.setIdentifier(identifier);
@@ -326,6 +330,6 @@ function beforeStart() {
326
330
 
327
331
  module.exports = {
328
332
  augment,
329
- load,
330
- beforeStart,
333
+ init,
334
+ start,
331
335
  };
@@ -45,25 +45,25 @@ function activeModules() {
45
45
  .filter((m) => m);
46
46
  }
47
47
 
48
- function load() {
48
+ function init() {
49
49
  for (const module of activeModules()) {
50
- if (module && module.load) {
51
- module.load();
50
+ if (module && module.init) {
51
+ module.init();
52
52
  }
53
53
  }
54
54
  }
55
55
 
56
- function beforeStart() {
56
+ function start() {
57
57
  for (const module of activeModules()) {
58
- if (module && module.beforeStart) {
59
- module.beforeStart();
58
+ if (module && module.start) {
59
+ module.start();
60
60
  }
61
61
  }
62
62
  }
63
63
 
64
64
  module.exports = {
65
65
  get,
66
- load,
67
- beforeStart,
66
+ init,
67
+ start,
68
68
  activeModules,
69
69
  };
@@ -29,7 +29,7 @@ const language = (log) => {
29
29
  }
30
30
  };
31
31
 
32
- function load() {
32
+ function init() {
33
33
  pipeline.getNode('main').map(augment).registerNode('main');
34
34
 
35
35
  aggregator.defaultFormatter.insertFormat('language', language, {
@@ -40,5 +40,5 @@ function load() {
40
40
 
41
41
  module.exports = {
42
42
  augment,
43
- load,
43
+ init,
44
44
  };
@@ -2,7 +2,7 @@ const { api, websocket } = require('../app');
2
2
  const { defaultFormatter } = require('../lib/logger');
3
3
  const pipeline = require('../lib/pipeline');
4
4
 
5
- function beforeStart() {
5
+ function start() {
6
6
  for (const [name, stream] of Object.entries(pipeline.nodes)) {
7
7
  websocket.streamToWebsocket(`/logs/${name}`, stream, {
8
8
  name: `WebSocket (${name} logs)`,
@@ -16,4 +16,4 @@ function beforeStart() {
16
16
  }
17
17
  }
18
18
 
19
- module.exports = { beforeStart };
19
+ module.exports = { start };
@@ -56,11 +56,11 @@ function augment(log) {
56
56
  return log;
57
57
  }
58
58
 
59
- function load() {
59
+ function init() {
60
60
  pipeline.getNode('main').map(augment).registerNode('main');
61
61
  }
62
62
 
63
- function beforeStart() {
63
+ function start() {
64
64
  const aggregator = new Aggregator();
65
65
 
66
66
  aggregator.setIdentifier((log) => log.getIn(['signature', 'id']));
@@ -127,6 +127,6 @@ function beforeStart() {
127
127
  }
128
128
 
129
129
  module.exports = {
130
- load,
131
- beforeStart,
130
+ init,
131
+ start,
132
132
  };
@@ -21,12 +21,12 @@ sparkline ('${id}', ${JSON.stringify(points)}, '#797979', 14, 5);
21
21
  </script>`;
22
22
  };
23
23
 
24
- function load() {
24
+ function init() {
25
25
  aggregator.defaultFormatter.insertFormat('activity', (entry) =>
26
26
  sparkline(entry, 'per_minute')
27
27
  );
28
28
  }
29
29
 
30
30
  module.exports = {
31
- load,
31
+ init,
32
32
  };
@@ -22,7 +22,7 @@ function mapper(entry, format) {
22
22
  };
23
23
  }
24
24
 
25
- function beforeStart() {
25
+ function start() {
26
26
  api.get('/status(.:format(txt|json))?', (req, res) => {
27
27
  const raw = req.query.raw ? true : false;
28
28
  const format = req.params.format || (raw ? 'json' : null);
@@ -48,4 +48,4 @@ function beforeStart() {
48
48
  });
49
49
  }
50
50
 
51
- module.exports = { beforeStart };
51
+ module.exports = { start };
package/PARSER DELETED
@@ -1,59 +0,0 @@
1
-
2
-
3
-
4
-
5
- Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
6
-
7
-
8
- Mozilla/5.0
9
- AppleWebKit/537.36 -> Generic Webkit
10
- Safari/537.36
11
- HeadlessChrome/
12
-
13
- Chrome/
14
- UCBrowser/11.3.5.908 -> UC Browser
15
- Edg/80.0.361.66
16
- Edge/18.19041 -> Edge
17
- OPR/68.0.3618.125 -> Opera
18
- QQBrowser/9.0.2524.400
19
- coc_coc_browser/86.0.172
20
- YaBrowser/20.6.0.905
21
- SamsungBrowser/11.2
22
-
23
- Chrome/83.0.4103.83 Mobile -> Chrome Mobile
24
-
25
- AppleWebKit/ -> Other Webkits
26
- FxiOS
27
- CriOS/83.0.4103.88 -> Chrome Mobile iOS
28
- Version/5.1.9 Safari/534.59.8 -> Safari
29
-
30
- Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0)
31
- Gecko/20100101
32
-
33
- FlipboardProxy/1.2
34
-
35
- Firefox/76.0 -> Firefox
36
-
37
-
38
- Generic compatible
39
-
40
-
41
- Mozilla/5.0 (compatible; AhrefsBot/6.1; +http://ahrefs.com/robot/)
42
- Mozilla/5.0 (compatible; SemrushBot/6~bl; +http://www.semrush.com/bot.html)
43
- (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
44
-
45
- (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
46
-
47
- Other
48
-
49
- BarkRowler/0.9 (+https://babbar.tech/crawler)
50
- Scrapy/1.6.0 (+https://scrapy.org) -> Generic Robot
51
- bitlybot/3.0 (+http://bit.ly/)
52
-
53
- Riddler (http://riddler.io/about)
54
-
55
- sentry/20.7.0.dev0 (https://sentry.io) -> Generic Robot
56
-
57
- AwarioSmartBot/1.0 (+https://awario.com/bots.html; bots@awario.com) -> Generic Robot
58
-
59
- python-requests/2.22.0 Generic Agent
package/TODO DELETED
@@ -1,7 +0,0 @@
1
-
2
- - Cloudflare blocking
3
- -
4
-
5
-
6
-
7
- - Live bot detection
package/USERAGENT DELETED
@@ -1,96 +0,0 @@
1
- if (
2
- !result.family ||
3
- ![
4
- // Browser
5
- 'Firefox',
6
- 'Firefox Mobile',
7
- 'Firefox iOS',
8
- 'Chrome',
9
- 'Chrome Mobile',
10
- 'Chrome Mobile iOS',
11
- 'Chrome Mobile WebView',
12
- 'Edge',
13
- 'Edge Mobile',
14
- 'Safari',
15
- 'Mobile Safari',
16
- 'Opera',
17
- 'Opera Mobile',
18
- 'Chromium',
19
- 'SeaMonkey',
20
- 'Samsung Internet',
21
- 'Epiphany',
22
- 'Yandex Browser',
23
- 'MiuiBrowser',
24
- 'UC Browser',
25
- 'Vivaldi',
26
- 'Pale Moon',
27
- 'QQ Browser',
28
- 'QQ Browser Mobile',
29
- // App
30
- 'Atom',
31
- 'VS Code',
32
- 'Facebook',
33
- // Mail
34
- 'Apple Mail',
35
- 'Outlook',
36
- ].includes(result.family)
37
- ) {
38
- // console.log(result);
39
- } else {
40
- // console.log(`-> ${result.family}`);
41
- }
42
-
43
- // console.log(`-> ${result.family}`);
44
-
45
-
46
-
47
-
48
- Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [FBAN/FBIOS;FBDV/iPhone10,4;FBMD/iPhone;FBSN/iOS;FBSV/13.4.1;FBSS/2;FBID/phone;FBLC/en_GB;FBOP/5]
49
-
50
- Facebook App
51
-
52
- family: 'Mobile Safari UI/WKWebView',
53
- major: '13',
54
-
55
-
56
-
57
- Package Control Default Channel Server
58
-
59
-
60
-
61
-
62
- text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
63
- text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
64
-
65
-
66
- ther Accept-Language header en
67
-
68
- Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SP-engine/2.19.0 main%2F1.0 baiduboxapp/11.23.5.16 (Baidu; P2 13.4.1) NABar/1.0
69
-
70
- Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko; googleweblight) Chrome/38.0.1025.166 Mobile Safari/535.19
71
-
72
-
73
- n41-09-02.opera-mini.net+ ZA Opera Mini 4
74
-
75
-
76
-
77
-
78
- DomainStatsBot/1.0 (https://domainstats.com/pages/our-bot)
79
- {
80
- family: 'DomainStatsBot',
81
- major: '1',
82
- minor: '0',
83
- patch: undefined,
84
- patch_minor: undefined,
85
- device: { family: 'Spider', brand: 'Spider', model: 'Desktop' }
86
- }
87
-
88
-
89
-
90
- Accept:*/*
91
- Accept-Encoding:gzip
92
- Accept-Language:en;q=0.9
93
- User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15
94
- User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
95
-
96
-
package/check-ips.js DELETED
@@ -1,15 +0,0 @@
1
- const ips = require('./ips');
2
- const modules = require('./src/modules');
3
-
4
- async function run() {
5
- for (const ip of ips) {
6
- const lookup = await modules.get('hostname').lookup(ip);
7
- if (lookup) {
8
- console.log(ip, lookup.value);
9
- } else {
10
- console.log(ip, 'No');
11
- }
12
- }
13
- }
14
-
15
- run();