manner.js 1.0.7 → 1.0.10

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.
Files changed (47) hide show
  1. package/client/index.js +1 -34
  2. package/client/lib/clearCookie.js +1 -20
  3. package/client/lib/filterNamespace.js +1 -15
  4. package/client/lib/readCookie.js +1 -38
  5. package/client/lib/setCookie.js +1 -25
  6. package/coverage/clover.xml +105 -28
  7. package/coverage/coverage-final.json +4 -2
  8. package/coverage/lcov-report/byteArray.js.html +154 -0
  9. package/coverage/lcov-report/class/Blockable.js.html +262 -0
  10. package/coverage/lcov-report/class/Blocks.js.html +202 -0
  11. package/coverage/lcov-report/class/MultiFetch.js.html +131 -29
  12. package/coverage/lcov-report/class/index.html +44 -14
  13. package/coverage/lcov-report/formatHttpDate.js.html +2 -5
  14. package/coverage/lcov-report/formatHttpKey.js.html +1 -1
  15. package/coverage/lcov-report/getOwnIpAddresses.js.html +220 -0
  16. package/coverage/lcov-report/index.html +19 -19
  17. package/coverage/lcov-report/isIntranetIpv4Address.js.html +196 -0
  18. package/coverage/lcov-report/isIpv6Address.js.html +148 -0
  19. package/coverage/lcov-report/lib/byteArray.js.html +1 -1
  20. package/coverage/lcov-report/lib/formatHttpDate.js.html +1 -1
  21. package/coverage/lcov-report/lib/formatHttpKey.js.html +1 -1
  22. package/coverage/lcov-report/lib/getOwnIpAddresses.js.html +1 -1
  23. package/coverage/lcov-report/lib/index.html +1 -1
  24. package/coverage/lcov-report/lib/isIntranetIpv4Address.js.html +1 -1
  25. package/coverage/lcov-report/lib/isIpv6Address.js.html +4 -4
  26. package/coverage/lcov-report/lib/nonZeroByteArray.js.html +1 -1
  27. package/coverage/lcov-report/lib/parseHttpDate.js.html +1 -1
  28. package/coverage/lcov-report/lib/wrapIpv6.js.html +1 -1
  29. package/coverage/lcov-report/nonZeroByteArray.js.html +157 -0
  30. package/coverage/lcov-report/parseHttpDate.js.html +238 -0
  31. package/coverage/lcov-report/wrapIpv6.js.html +94 -0
  32. package/coverage/lcov.info +199 -49
  33. package/package.json +3 -1
  34. package/server/class/Blockable.js +1 -0
  35. package/server/class/Blocks.js +1 -0
  36. package/server/class/MultiFetch.js +1 -59
  37. package/server/index.js +1 -77
  38. package/server/lib/byteArray.js +1 -28
  39. package/server/lib/formatHttpDate.js +1 -12
  40. package/server/lib/formatHttpKey.js +1 -11
  41. package/server/lib/getOwnIpAddresses.js +1 -66
  42. package/server/lib/isIntranetIpv4Address.js +1 -44
  43. package/server/lib/isIpv6Address.js +1 -27
  44. package/server/lib/nonZeroByteArray.js +1 -31
  45. package/server/lib/parseHttpDate.js +1 -57
  46. package/server/lib/readCookie.js +1 -27
  47. package/server/lib/wrapIpv6.js +1 -9
@@ -1,53 +1,203 @@
1
1
  TN:
2
- SF:src/server/class/MultiFetch.js
3
- FN:5,(anonymous_0)
4
- FN:11,(anonymous_1)
5
- FN:21,(anonymous_2)
2
+ SF:src/server/class/Blockable.js
3
+ FN:3,getIntervalFromTime
4
+ FN:9,(anonymous_1)
5
+ FN:19,(anonymous_2)
6
+ FN:37,(anonymous_3)
7
+ FN:44,(anonymous_4)
8
+ FN:49,(anonymous_5)
9
+ FNF:6
10
+ FNH:5
11
+ FNDA:28,getIntervalFromTime
12
+ FNDA:0,(anonymous_1)
13
+ FNDA:28,(anonymous_2)
14
+ FNDA:29,(anonymous_3)
15
+ FNDA:3,(anonymous_4)
16
+ FNDA:25,(anonymous_5)
17
+ DA:4,28
18
+ DA:5,28
19
+ DA:10,0
20
+ DA:11,0
21
+ DA:13,0
22
+ DA:14,0
23
+ DA:16,0
24
+ DA:21,28
25
+ DA:22,28
26
+ DA:23,0
27
+ DA:24,0
28
+ DA:26,0
29
+ DA:28,28
30
+ DA:29,28
31
+ DA:30,3
32
+ DA:31,3
33
+ DA:32,3
34
+ DA:38,29
35
+ DA:39,29
36
+ DA:40,29
37
+ DA:41,4
38
+ DA:42,4
39
+ DA:43,4
40
+ DA:44,4
41
+ DA:46,25
42
+ DA:47,25
43
+ DA:48,25
44
+ DA:49,25
45
+ DA:50,25
46
+ DA:52,0
47
+ DA:55,29
48
+ LF:31
49
+ LH:22
50
+ BRDA:10,0,0,0
51
+ BRDA:10,0,1,0
52
+ BRDA:13,1,0,0
53
+ BRDA:13,1,1,0
54
+ BRDA:21,2,0,28
55
+ BRDA:21,2,1,0
56
+ BRDA:23,3,0,0
57
+ BRDA:23,3,1,0
58
+ BRDA:29,4,0,3
59
+ BRDA:29,4,1,25
60
+ BRDA:31,5,0,3
61
+ BRDA:31,5,1,0
62
+ BRDA:40,6,0,4
63
+ BRDA:40,6,1,25
64
+ BRDA:47,7,0,25
65
+ BRDA:47,7,1,0
66
+ BRF:16
67
+ BRH:7
68
+ end_of_record
69
+ TN:
70
+ SF:src/server/class/Blocks.js
71
+ FN:6,(anonymous_0)
72
+ FN:14,(anonymous_1)
73
+ FN:23,(anonymous_2)
6
74
  FNF:3
7
75
  FNH:3
8
76
  FNDA:1,(anonymous_0)
9
77
  FNDA:1,(anonymous_1)
10
- FNDA:20,(anonymous_2)
11
- DA:6,1
78
+ FNDA:6,(anonymous_2)
12
79
  DA:7,1
13
80
  DA:8,1
14
- DA:12,1
15
- DA:13,0
16
- DA:14,0
17
- DA:15,0
81
+ DA:9,1
82
+ DA:10,1
83
+ DA:11,1
84
+ DA:15,1
18
85
  DA:16,0
19
- DA:22,20
86
+ DA:18,1
87
+ DA:19,0
88
+ DA:24,6
89
+ DA:25,6
90
+ DA:26,6
91
+ DA:27,6
92
+ DA:28,6
93
+ DA:29,0
94
+ DA:30,0
95
+ DA:31,0
96
+ DA:33,0
97
+ LF:18
98
+ LH:12
99
+ BRDA:15,0,0,0
100
+ BRDA:15,0,1,1
101
+ BRDA:18,1,0,0
102
+ BRDA:18,1,1,1
103
+ BRDA:24,2,0,6
104
+ BRDA:24,2,1,0
105
+ BRDA:26,3,0,6
106
+ BRDA:26,3,1,0
107
+ BRDA:29,4,0,0
108
+ BRDA:29,4,1,0
109
+ BRF:10
110
+ BRH:4
111
+ end_of_record
112
+ TN:
113
+ SF:src/server/class/MultiFetch.js
114
+ FN:8,(anonymous_0)
115
+ FN:21,(anonymous_1)
116
+ FN:39,(anonymous_2)
117
+ FNF:3
118
+ FNH:3
119
+ FNDA:2,(anonymous_0)
120
+ FNDA:2,(anonymous_1)
121
+ FNDA:43,(anonymous_2)
122
+ DA:9,2
123
+ DA:10,2
124
+ DA:11,2
125
+ DA:12,2
126
+ DA:13,2
127
+ DA:14,1
128
+ DA:16,2
129
+ DA:17,2
130
+ DA:18,2
131
+ DA:22,2
20
132
  DA:23,0
21
- DA:25,20
133
+ DA:24,0
134
+ DA:25,0
22
135
  DA:26,0
23
- DA:28,20
24
- DA:29,20
25
- DA:30,20
26
- DA:31,16
27
- DA:33,4
28
- DA:35,20
29
- DA:36,20
30
- DA:37,20
31
- DA:38,0
32
- DA:39,0
33
- DA:41,20
34
- DA:42,20
35
- LF:24
36
- LH:16
37
- BRDA:12,0,0,0
38
- BRDA:12,0,1,1
39
- BRDA:15,1,0,0
40
- BRDA:15,1,1,0
41
- BRDA:22,2,0,0
42
- BRDA:22,2,1,20
43
- BRDA:25,3,0,0
44
- BRDA:25,3,1,20
45
- BRDA:30,4,0,16
46
- BRDA:30,4,1,4
47
- BRDA:37,5,0,0
48
- BRDA:37,5,1,20
49
- BRF:12
50
- BRH:6
136
+ DA:29,2
137
+ DA:30,1
138
+ DA:31,0
139
+ DA:33,1
140
+ DA:34,0
141
+ DA:40,43
142
+ DA:41,0
143
+ DA:43,43
144
+ DA:44,0
145
+ DA:46,43
146
+ DA:48,43
147
+ DA:49,23
148
+ DA:50,23
149
+ DA:51,23
150
+ DA:52,23
151
+ DA:53,0
152
+ DA:54,0
153
+ DA:55,0
154
+ DA:57,0
155
+ DA:60,43
156
+ DA:61,21
157
+ DA:63,22
158
+ DA:64,22
159
+ DA:65,18
160
+ DA:67,4
161
+ DA:69,22
162
+ DA:70,22
163
+ DA:71,22
164
+ DA:72,0
165
+ DA:73,0
166
+ DA:75,22
167
+ DA:76,22
168
+ LF:46
169
+ LH:32
170
+ BRDA:13,0,0,1
171
+ BRDA:13,0,1,1
172
+ BRDA:22,1,0,0
173
+ BRDA:22,1,1,2
174
+ BRDA:25,2,0,0
175
+ BRDA:25,2,1,0
176
+ BRDA:29,3,0,1
177
+ BRDA:29,3,1,1
178
+ BRDA:30,4,0,0
179
+ BRDA:30,4,1,1
180
+ BRDA:33,5,0,0
181
+ BRDA:33,5,1,1
182
+ BRDA:39,6,0,20
183
+ BRDA:40,7,0,0
184
+ BRDA:40,7,1,43
185
+ BRDA:43,8,0,0
186
+ BRDA:43,8,1,43
187
+ BRDA:48,9,0,23
188
+ BRDA:48,9,1,20
189
+ BRDA:50,10,0,23
190
+ BRDA:50,10,1,0
191
+ BRDA:53,11,0,0
192
+ BRDA:53,11,1,0
193
+ BRDA:60,12,0,21
194
+ BRDA:60,12,1,22
195
+ BRDA:64,13,0,18
196
+ BRDA:64,13,1,4
197
+ BRDA:71,14,0,0
198
+ BRDA:71,14,1,22
199
+ BRF:29
200
+ BRH:18
51
201
  end_of_record
52
202
  TN:
53
203
  SF:src/server/lib/byteArray.js
@@ -225,11 +375,11 @@ FNDA:3,isIpv6Address
225
375
  DA:2,3
226
376
  DA:3,3
227
377
  DA:4,3
228
- DA:5,100
229
- DA:6,100
378
+ DA:5,98
379
+ DA:6,98
230
380
  DA:9,22
231
381
  DA:10,22
232
- DA:12,78
382
+ DA:12,76
233
383
  DA:13,0
234
384
  DA:17,3
235
385
  DA:18,1
@@ -238,13 +388,13 @@ LF:12
238
388
  LH:11
239
389
  BRDA:6,0,0,3
240
390
  BRDA:6,0,1,22
241
- BRDA:6,0,2,78
391
+ BRDA:6,0,2,76
242
392
  BRDA:12,1,0,0
243
- BRDA:12,1,1,78
244
- BRDA:12,2,0,78
245
- BRDA:12,2,1,78
246
- BRDA:12,2,2,15
247
- BRDA:12,2,3,15
393
+ BRDA:12,1,1,76
394
+ BRDA:12,2,0,76
395
+ BRDA:12,2,1,76
396
+ BRDA:12,2,2,14
397
+ BRDA:12,2,3,14
248
398
  BRDA:17,3,0,1
249
399
  BRDA:17,3,1,2
250
400
  BRF:11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manner.js",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "Frontend mode project.",
5
5
  "repository": "git@github.com:leobrad/mode.git",
6
6
  "author": "Leo Ely",
@@ -18,9 +18,11 @@
18
18
  "@babel/preset-react": "^7.23.3",
19
19
  "@babel/register": "^7.22.5",
20
20
  "gulp-babel": "^8.0.0",
21
+ "gulp-uglify": "^3.0.2",
21
22
  "jest": "^29.7.0"
22
23
  },
23
24
  "dependencies": {
25
+ "advising.js": "^1.0.13",
24
26
  "babel-plugin-root-import": "^6.6.0",
25
27
  "gulp": "^4.0.2",
26
28
  "node-fetch": "2"
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getIntervalFromTime(e){var t=(new Date).getTime();return Math.floor(t-e)}class Blockable{setInterval(e){if(!Number.isInteger(e))throw new Error("[Error] The interval parameter should be of integer type.");if(e<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.");this.interval=e}cleanIpAddress(e,t){let r;if(_net.default.isIPv4(e))r=this.ipv4Block;else{if(!_net.default.isIpv6(e))throw new Error("[Error] The Ip type is not expected");r=this.ipv6Block}var i=r.gain(e);void 0!==i&&getIntervalFromTime(i)<t&&r.ruin(e)}examineIpAddress(t,r){let e=!0;var i=r.gain(t);if(void 0===i){var a=(new Date).getTime();r.attach(t,a);let e=this.interval;setTimeout(()=>this.cleanIpAddress(t,e),e)}else getIntervalFromTime(i)<this.interval?(a=this.interval-i,setTimeout(()=>this.cleanIpAddress(t,this.interval),a),e=!1):r.ruin(t);return e}}var _default=exports.default=Blockable;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net")),_advising=require("advising.js"),_Blockable=_interopRequireDefault(require("./Blockable"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class Blocks extends _Blockable.default{constructor(e){super(),this.dealParams(e),this.interval=e,this.ipv4Block=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Block=new _advising.Ipv6Router({debug:!1,hideError:!0})}dealParams(e){if(!Number.isInteger(e))throw new Error("[Error] The interval parameter should be of integer type.");if(e<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}examine(e){if(void 0!==e){var r,{}=this;if(_net.default.isIPv4(e))return r=this.ipv4Block,this.examineIpAddress(e,r);if(_net.default.isIPv6(e))return r=this.ipv6Block,this.examineIpAddress(e,r);throw new Error("[Error] The Ip type is not expected.")}}}var _default=exports.default=Blocks;
@@ -1,59 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _https = _interopRequireDefault(require("https"));
8
- var _nodeFetch = _interopRequireDefault(require("node-fetch"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- class MultiFetch {
11
- constructor(bases) {
12
- this.index = -1;
13
- this.dealParams(bases);
14
- this.bases = bases;
15
- }
16
- dealParams(bases) {
17
- if (!Array.isArray(bases)) {
18
- throw new Error('[Error] The bases parameter bases should be a array type.');
19
- const {
20
- length
21
- } = bases;
22
- if (length === 0) {
23
- throw new Error('[Error] The bases parameter bases cannot have zero length.');
24
- }
25
- }
26
- }
27
- async fetch(path, options) {
28
- if (typeof path !== 'string') {
29
- throw new Error('[Error] The path parameter path should be of string type.');
30
- }
31
- if (typeof options !== 'object') {
32
- throw new Error('[Error] The options parameter should be a object type.');
33
- }
34
- const {
35
- bases
36
- } = this;
37
- const {
38
- length
39
- } = bases;
40
- if (this.index < length - 1) {
41
- this.index += 1;
42
- } else {
43
- this.index = 0;
44
- }
45
- const {
46
- index
47
- } = this;
48
- const base = bases[index];
49
- if (base.startsWith('https')) {
50
- const httpsAgent = new _https.default.Agent({
51
- rejectUnauthorized: false
52
- });
53
- options.agent = httpsAgent;
54
- }
55
- const url = base + path;
56
- return (0, _nodeFetch.default)(url, options);
57
- }
58
- }
59
- var _default = exports.default = MultiFetch;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _https=_interopRequireDefault(require("https")),_net=_interopRequireDefault(require("net")),_nodeFetch=_interopRequireDefault(require("node-fetch")),_advising=require("advising.js"),_Blockable=_interopRequireDefault(require("./Blockable"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class MultiFetch extends _Blockable.default{constructor(e,r){super(),this.index=-1,this.dealParams(e,r),this.bases=e,void 0!==r&&(this.interval=r),this.ipv4Block=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Block=new _advising.Ipv6Router({debug:!1,hideError:!0}),this.cleanIpAddress=this.cleanIpAddress.bind(this)}dealParams(e,r){if(!Array.isArray(e))throw new Error("[Error] The bases parameter bases should be a array type.");if(void 0!==r){if(!Number.isInteger(r))throw new Error("[Error] The interval parameter should be of integer type.");if(r<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}}async fetch(e,r,t={}){if("string"!=typeof e)throw new Error("[Error] The path parameter path should be of string type.");if("object"!=typeof r)throw new Error("[Error] The options parameter should be a object type.");t=t.ip;let i;if(void 0!==t){var{}=this;if(_net.default.isIPv4(t)){var s=this.ipv4Block;i=this.examineIpAddress(t,s)}else{if(!_net.default.isIPv6(t))throw new Error("[Error] The Ip type is not expected.");s=this.ipv6Block;i=this.examineIpAddress(t,s)}}if(!1===i)throw new Error("[Error] The current IP address is blocked because it is accessed too frequently.");var t=this.bases,s=(this.index<t.length-1?this.index+=1:this.index=0,this).index,t=t[s],s=(t.startsWith("https")&&(s=new _https.default.Agent({rejectUnauthorized:!1}),r.agent=s),t+e);return(0,_nodeFetch.default)(s,r)}}var _default=exports.default=MultiFetch;
package/server/index.js CHANGED
@@ -1,77 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "MultiFetch", {
7
- enumerable: true,
8
- get: function () {
9
- return _MultiFetch.default;
10
- }
11
- });
12
- exports.byteArray = void 0;
13
- Object.defineProperty(exports, "formatHttpDate", {
14
- enumerable: true,
15
- get: function () {
16
- return _formatHttpDate.default;
17
- }
18
- });
19
- Object.defineProperty(exports, "formatHttpKey", {
20
- enumerable: true,
21
- get: function () {
22
- return _formatHttpKey.default;
23
- }
24
- });
25
- Object.defineProperty(exports, "getOwnIpAddresses", {
26
- enumerable: true,
27
- get: function () {
28
- return _getOwnIpAddresses.default;
29
- }
30
- });
31
- Object.defineProperty(exports, "isIntranetIpv4Address", {
32
- enumerable: true,
33
- get: function () {
34
- return _isIntranetIpv4Address.default;
35
- }
36
- });
37
- Object.defineProperty(exports, "isIpv6Address", {
38
- enumerable: true,
39
- get: function () {
40
- return _isIpv6Address.default;
41
- }
42
- });
43
- exports.nonZeroByteArray = void 0;
44
- Object.defineProperty(exports, "parseHttpDate", {
45
- enumerable: true,
46
- get: function () {
47
- return _parseHttpDate.default;
48
- }
49
- });
50
- Object.defineProperty(exports, "readCookie", {
51
- enumerable: true,
52
- get: function () {
53
- return _readCookie.default;
54
- }
55
- });
56
- Object.defineProperty(exports, "wrapIpv6", {
57
- enumerable: true,
58
- get: function () {
59
- return _wrapIpv.default;
60
- }
61
- });
62
- var _MultiFetch = _interopRequireDefault(require("./class/MultiFetch"));
63
- var _readCookie = _interopRequireDefault(require("./lib/readCookie"));
64
- var _formatHttpKey = _interopRequireDefault(require("./lib/formatHttpKey"));
65
- var _formatHttpDate = _interopRequireDefault(require("./lib/formatHttpDate"));
66
- var _parseHttpDate = _interopRequireDefault(require("./lib/parseHttpDate"));
67
- var _isIntranetIpv4Address = _interopRequireDefault(require("./lib/isIntranetIpv4Address"));
68
- var _isIpv6Address = _interopRequireDefault(require("./lib/isIpv6Address"));
69
- var _getOwnIpAddresses = _interopRequireDefault(require("./lib/getOwnIpAddresses"));
70
- var _wrapIpv = _interopRequireDefault(require("./lib/wrapIpv6"));
71
- var _byteArray = _interopRequireWildcard(require("./lib/byteArray"));
72
- exports.byteArray = _byteArray;
73
- var _nonZeroByteArray = _interopRequireWildcard(require("./lib/nonZeroByteArray"));
74
- exports.nonZeroByteArray = _nonZeroByteArray;
75
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
76
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
77
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Blocks",{enumerable:!0,get:function(){return _Blocks.default}}),Object.defineProperty(exports,"MultiFetch",{enumerable:!0,get:function(){return _MultiFetch.default}}),exports.byteArray=void 0,Object.defineProperty(exports,"formatHttpDate",{enumerable:!0,get:function(){return _formatHttpDate.default}}),Object.defineProperty(exports,"formatHttpKey",{enumerable:!0,get:function(){return _formatHttpKey.default}}),Object.defineProperty(exports,"getOwnIpAddresses",{enumerable:!0,get:function(){return _getOwnIpAddresses.default}}),Object.defineProperty(exports,"isIntranetIpv4Address",{enumerable:!0,get:function(){return _isIntranetIpv4Address.default}}),Object.defineProperty(exports,"isIpv6Address",{enumerable:!0,get:function(){return _isIpv6Address.default}}),exports.nonZeroByteArray=void 0,Object.defineProperty(exports,"parseHttpDate",{enumerable:!0,get:function(){return _parseHttpDate.default}}),Object.defineProperty(exports,"readCookie",{enumerable:!0,get:function(){return _readCookie.default}}),Object.defineProperty(exports,"wrapIpv6",{enumerable:!0,get:function(){return _wrapIpv.default}});var _MultiFetch=_interopRequireDefault(require("./class/MultiFetch")),_Blocks=_interopRequireDefault(require("./class/Blocks")),_readCookie=_interopRequireDefault(require("./lib/readCookie")),_formatHttpKey=_interopRequireDefault(require("./lib/formatHttpKey")),_formatHttpDate=_interopRequireDefault(require("./lib/formatHttpDate")),_parseHttpDate=_interopRequireDefault(require("./lib/parseHttpDate")),_isIntranetIpv4Address=_interopRequireDefault(require("./lib/isIntranetIpv4Address")),_isIpv6Address=_interopRequireDefault(require("./lib/isIpv6Address")),_getOwnIpAddresses=_interopRequireDefault(require("./lib/getOwnIpAddresses")),_wrapIpv=_interopRequireDefault(require("./lib/wrapIpv6")),_byteArray=_interopRequireWildcard(require("./lib/byteArray")),_nonZeroByteArray=(exports.byteArray=_byteArray,_interopRequireWildcard(require("./lib/nonZeroByteArray")));function _interopRequireWildcard(e,r){var o,u;return"function"==typeof WeakMap&&(o=new WeakMap,u=new WeakMap),(_interopRequireWildcard=function(r,e){if(!e&&r&&r.__esModule)return r;var t,n,i={__proto__:null,default:r};if(null!==r&&("object"==typeof r||"function"==typeof r)){if(t=e?u:o){if(t.has(r))return t.get(r);t.set(r,i)}for(let e in r)"default"!==e&&{}.hasOwnProperty.call(r,e)&&((n=(t=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,e))&&(n.get||n.set)?t(i,e,n):i[e]=r[e])}return i})(e,r)}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}exports.nonZeroByteArray=_nonZeroByteArray;
@@ -1,28 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fromInt = fromInt;
7
- exports.toInt = toInt;
8
- const size = 256n;
9
- function fromInt(n) {
10
- n = BigInt(n);
11
- const ans = [];
12
- if (n > size - 1n) {
13
- while (n > size) {
14
- const q = n % size;
15
- ans.push(Number(q));
16
- n = n / size;
17
- }
18
- }
19
- ans.push(Number(n));
20
- return ans;
21
- }
22
- function toInt(buf) {
23
- let n = 0n;
24
- for (let i = 0n; i < buf.length; i += 1n) {
25
- n += BigInt(buf[i]) * size ** i;
26
- }
27
- return n;
28
- }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.fromInt=fromInt,exports.toInt=toInt;let size=256n;function fromInt(e){var t=[];if((e=BigInt(e))>size-1n)for(;e>size;){var n=e%size;t.push(Number(n)),e/=size}return t.push(Number(e)),t}function toInt(t){let n=0n;for(let e=0n;e<t.length;e+=1n)n+=BigInt(t[e])*size**e;return n}
@@ -1,12 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = formatHttpDate;
7
- function formatHttpDate(ms) {
8
- const date = new Date(ms);
9
- let [week, month, day, year, time, zone] = date.toString().split(' ');
10
- zone = zone.split('+')[0];
11
- return week + ', ' + day + ' ' + month + ' ' + year + ' ' + time + ' ' + zone;
12
- }
1
+ function formatHttpDate(t){let[e,r,o,a,p,l]=new Date(t).toString().split(" ");return e+", "+o+" "+r+" "+a+" "+p+" "+(l=l.split("+")[0])}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=formatHttpDate;
@@ -1,11 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = formatHttpKey;
7
- function formatHttpKey(key) {
8
- return key.split('-').map(v => {
9
- return v.substring(0, 1).toUpperCase() + v.substring(1, v.length);
10
- }).join('-');
11
- }
1
+ function formatHttpKey(t){return t.split("-").map(t=>t.substring(0,1).toUpperCase()+t.substring(1,t.length)).join("-")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=formatHttpKey;
@@ -1,66 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getOwnIpAddresses;
7
- var _os = _interopRequireDefault(require("os"));
8
- var _isIntranetIpv4Address = _interopRequireDefault(require("./isIntranetIpv4Address"));
9
- var _isIpv6Address = _interopRequireDefault(require("./isIpv6Address"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function getOwnIpAddresses() {
12
- const nets = _os.default.networkInterfaces();
13
- const ans = [];
14
- Object.keys(nets).forEach(key => {
15
- const net = nets[key];
16
- const {
17
- length
18
- } = net;
19
- if (length >= 2) {
20
- let ipv4;
21
- let ipv6;
22
- for (let i = 0; i < length; i += 1) {
23
- const ip = net[i];
24
- const {
25
- internal
26
- } = ip;
27
- if (internal === true) {
28
- break;
29
- } else {
30
- const {
31
- family
32
- } = ip;
33
- switch (family) {
34
- case 'IPv6':
35
- {
36
- const {
37
- address
38
- } = ip;
39
- if ((0, _isIpv6Address.default)(address)) {
40
- ipv6 = address;
41
- }
42
- break;
43
- }
44
- case 'IPv4':
45
- {
46
- const {
47
- address
48
- } = ip;
49
- if ((0, _isIntranetIpv4Address.default)(address)) {
50
- ipv4 = address;
51
- }
52
- break;
53
- }
54
- }
55
- if (ipv4 !== undefined && ipv6 !== undefined) {
56
- ans.push({
57
- ipv4,
58
- ipv6
59
- });
60
- }
61
- }
62
- }
63
- }
64
- });
65
- return ans;
66
- }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=getOwnIpAddresses;var _os=_interopRequireDefault(require("os")),_isIntranetIpv4Address=_interopRequireDefault(require("./isIntranetIpv4Address")),_isIpv6Address=_interopRequireDefault(require("./isIpv6Address"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getOwnIpAddresses(){let r=_os.default.networkInterfaces(),u=[];return Object.keys(r).forEach(e=>{var t=r[e],d=t.length;if(2<=d){let r,s;for(let e=0;e<d;e+=1){var i=t[e],a=i.internal;if(!0===a)break;a=i.family;switch(a){case"IPv6":var n=i.address;(0,_isIpv6Address.default)(n)&&(s=n);break;case"IPv4":n=i.address;(0,_isIntranetIpv4Address.default)(n)&&(r=n)}void 0!==r&&void 0!==s&&u.push({ipv4:r,ipv6:s})}}}),u}
@@ -1,44 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = isIntranetIpv4Address;
7
- function isIntranetIpv4Address(address) {
8
- let total = 0;
9
- let sectionValue = 0;
10
- ;
11
- let sectionCount = 0;
12
- for (let i = 0; i <= address.length; i += 1) {
13
- const char = address.charAt(i);
14
- switch (char) {
15
- case '':
16
- case '.':
17
- sectionCount += 1;
18
- total *= 256;
19
- total += sectionValue;
20
- sectionValue = 0;
21
- break;
22
- default:
23
- if (!(char >= '0' && char <= '9')) {
24
- return false;
25
- }
26
- sectionValue *= 10;
27
- sectionValue += parseInt(char);
28
- }
29
- }
30
- if (sectionCount !== 4) {
31
- return false;
32
- }
33
- let ans = false;
34
- if (total >= 167772160 && total <= 184549375) {
35
- ans = true;
36
- }
37
- if (total >= 2886729728 && total <= 2887778303) {
38
- ans = true;
39
- }
40
- if (total >= 3232235520 && total <= 3232301055) {
41
- ans = true;
42
- }
43
- return ans;
44
- }
1
+ function isIntranetIpv4Address(t){let r=0,s=0,n=0;for(let e=0;e<=t.length;e+=1){var a=t.charAt(e);switch(a){case"":case".":n+=1,r=(r*=256)+s,s=0;break;default:if(!("0"<=a&&a<="9"))return!1;s=(s*=10)+parseInt(a)}}if(4!==n)return!1;let e=!1;return 167772160<=r&&r<=184549375&&(e=!0),2886729728<=r&&r<=2887778303&&(e=!0),e=3232235520<=r&&r<=3232301055?!0:e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=isIntranetIpv4Address;
@@ -1,27 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = isIpv6Address;
7
- function isIpv6Address(address) {
8
- let sectionCount = 0;
9
- let ans = true;
10
- for (let i = 0; i <= address.length; i += 1) {
11
- const char = address.charAt(i);
12
- switch (char) {
13
- case '':
14
- case ':':
15
- sectionCount += 1;
16
- break;
17
- default:
18
- if (!(char >= '0' && char <= '9' || char >= 'a' && char <= 'f')) {
19
- ans = false;
20
- }
21
- }
22
- }
23
- if (sectionCount !== 8) {
24
- ans = false;
25
- }
26
- return ans;
27
- }
1
+ function isIpv6Address(t){let r=0,s=!0;for(let e=0;e<=t.length;e+=1){var a=t.charAt(e);switch(a){case"":case":":r+=1;break;default:"0"<=a&&a<="9"||"a"<=a&&a<="f"||(s=!1)}}return s=8!==r?!1:s}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=isIpv6Address;
@@ -1,31 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fromInt = fromInt;
7
- exports.toInt = toInt;
8
- const size = 256n;
9
- function fromInt(n) {
10
- n = BigInt(n);
11
- const ans = [];
12
- if (n > size - 2n) {
13
- while (n > size - 1n) {
14
- const q = n % (size - 1n);
15
- ans.push(Number(q + 1n));
16
- n = n / (size - 1n);
17
- }
18
- }
19
- ans.push(Number(n + 1n));
20
- return ans;
21
- }
22
- function toInt(buf) {
23
- let n = 0n;
24
- const {
25
- length
26
- } = buf;
27
- for (let i = 0n; i < buf.length; i += 1n) {
28
- n += (BigInt(buf[i]) - 1n) * (size - 1n) ** i;
29
- }
30
- return n;
31
- }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.fromInt=fromInt,exports.toInt=toInt;let size=256n;function fromInt(n){var e=[];if((n=BigInt(n))>size-2n)for(;n>size-1n;){var t=n%(size-1n);e.push(Number(t+1n)),n/=size-1n}return e.push(Number(n+1n)),e}function toInt(e){let t=0n;var{}=e;for(let n=0n;n<e.length;n+=1n)t+=(BigInt(e[n])-1n)*(size-1n)**n;return t}