manner.js 1.0.45 → 1.1.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/client/class/ClientFetch.js +1 -0
- package/client/index.js +1 -0
- package/client/lib/clearCookie.js +1 -0
- package/client/lib/filterNamespace.js +1 -0
- package/client/lib/readCookie.js +1 -0
- package/client/lib/setCookie.js +1 -0
- package/coverage/clover.xml +78 -87
- package/coverage/coverage-final.json +4 -6
- package/coverage/lcov-report/class/Blocks.js.html +1 -1
- package/coverage/lcov-report/class/ByteArray.js.html +286 -0
- package/coverage/lcov-report/class/MultiFetch.js.html +38 -11
- package/coverage/lcov-report/class/Prevents.js.html +18 -18
- package/coverage/lcov-report/class/Tackles.js.html +1 -1
- package/coverage/lcov-report/class/index.html +38 -23
- package/coverage/lcov-report/index.html +29 -29
- package/coverage/lcov-report/lib/byteArray.js.html +1 -1
- package/coverage/lcov-report/lib/errorHandle.js.html +1 -1
- package/coverage/lcov-report/lib/formatHttpDate.js.html +1 -1
- package/coverage/lcov-report/lib/formatHttpKey.js.html +1 -1
- package/coverage/lcov-report/lib/getDateString.js.html +1 -1
- package/coverage/lcov-report/lib/getOwnIpAddresses.js.html +1 -1
- package/coverage/lcov-report/lib/index.html +9 -54
- package/coverage/lcov-report/lib/isIntranetIpv4Address.js.html +1 -1
- package/coverage/lcov-report/lib/isIpv6Address.js.html +4 -4
- package/coverage/lcov-report/lib/nonZeroByteArray.js.html +1 -1
- package/coverage/lcov-report/lib/parseHttpDate.js.html +1 -1
- package/coverage/lcov-report/lib/wrapIpv6.js.html +1 -1
- package/coverage/lcov.info +167 -181
- package/package.json +3 -3
- package/server/class/Blocks.js +1 -0
- package/server/class/ByteArray.js +1 -0
- package/server/class/MultiFetch.js +1 -0
- package/server/class/Prevents.js +1 -0
- package/server/class/Tackles.js +1 -0
- package/server/index.js +1 -0
- package/server/lib/addToLog.js +1 -0
- package/server/lib/appendToLog.js +1 -0
- package/server/lib/byteArray.js +1 -0
- package/server/lib/checkLogPath.js +1 -0
- package/server/lib/discHndl.js +1 -0
- package/server/lib/errorHandle.js +1 -0
- package/server/lib/formatHttpDate.js +1 -0
- package/server/lib/formatHttpKey.js +1 -0
- package/server/lib/getDateString.js +1 -0
- package/server/lib/getGTMNowString.js +1 -0
- package/server/lib/getOwnIpAddresses.js +1 -0
- package/server/lib/isIntranetIpv4Address.js +1 -0
- package/server/lib/isIpv6Address.js +1 -0
- package/server/lib/logOutOfMemory.js +1 -0
- package/server/lib/nonZeroByteArray.js +1 -0
- package/server/lib/parseHttpDate.js +1 -0
- package/server/lib/readCookie.js +1 -0
- package/server/lib/wrapIpv6.js +1 -0
package/coverage/lcov.info
CHANGED
|
@@ -70,76 +70,135 @@ BRF:18
|
|
|
70
70
|
BRH:11
|
|
71
71
|
end_of_record
|
|
72
72
|
TN:
|
|
73
|
+
SF:src/server/class/ByteArray.js
|
|
74
|
+
FN:2,(anonymous_0)
|
|
75
|
+
FN:11,(anonymous_1)
|
|
76
|
+
FN:32,(anonymous_2)
|
|
77
|
+
FN:52,(anonymous_3)
|
|
78
|
+
FNF:4
|
|
79
|
+
FNH:4
|
|
80
|
+
FNDA:2,(anonymous_0)
|
|
81
|
+
FNDA:2,(anonymous_1)
|
|
82
|
+
FNDA:2,(anonymous_2)
|
|
83
|
+
FNDA:2,(anonymous_3)
|
|
84
|
+
DA:3,2
|
|
85
|
+
DA:7,2
|
|
86
|
+
DA:8,2
|
|
87
|
+
DA:17,2
|
|
88
|
+
DA:18,2
|
|
89
|
+
DA:19,0
|
|
90
|
+
DA:21,2
|
|
91
|
+
DA:22,0
|
|
92
|
+
DA:24,2
|
|
93
|
+
DA:25,0
|
|
94
|
+
DA:27,2
|
|
95
|
+
DA:28,0
|
|
96
|
+
DA:38,2
|
|
97
|
+
DA:39,2
|
|
98
|
+
DA:40,2
|
|
99
|
+
DA:41,2
|
|
100
|
+
DA:42,2
|
|
101
|
+
DA:43,6
|
|
102
|
+
DA:44,6
|
|
103
|
+
DA:45,6
|
|
104
|
+
DA:48,2
|
|
105
|
+
DA:49,2
|
|
106
|
+
DA:58,2
|
|
107
|
+
DA:59,2
|
|
108
|
+
DA:60,2
|
|
109
|
+
DA:61,8
|
|
110
|
+
DA:63,2
|
|
111
|
+
LF:27
|
|
112
|
+
LH:23
|
|
113
|
+
BRDA:2,0,0,0
|
|
114
|
+
BRDA:18,1,0,0
|
|
115
|
+
BRDA:18,1,1,2
|
|
116
|
+
BRDA:21,2,0,0
|
|
117
|
+
BRDA:21,2,1,2
|
|
118
|
+
BRDA:24,3,0,0
|
|
119
|
+
BRDA:24,3,1,2
|
|
120
|
+
BRDA:27,4,0,0
|
|
121
|
+
BRDA:27,4,1,2
|
|
122
|
+
BRDA:41,5,0,2
|
|
123
|
+
BRDA:41,5,1,0
|
|
124
|
+
BRF:11
|
|
125
|
+
BRH:5
|
|
126
|
+
end_of_record
|
|
127
|
+
TN:
|
|
73
128
|
SF:src/server/class/MultiFetch.js
|
|
74
129
|
FN:8,(anonymous_0)
|
|
75
130
|
FN:17,(anonymous_1)
|
|
76
|
-
FN:
|
|
77
|
-
|
|
78
|
-
|
|
131
|
+
FN:26,(anonymous_2)
|
|
132
|
+
FN:44,(anonymous_3)
|
|
133
|
+
FNF:4
|
|
134
|
+
FNH:4
|
|
79
135
|
FNDA:1,(anonymous_0)
|
|
80
136
|
FNDA:1,(anonymous_1)
|
|
81
|
-
FNDA:
|
|
137
|
+
FNDA:1,(anonymous_2)
|
|
138
|
+
FNDA:20,(anonymous_3)
|
|
82
139
|
DA:9,1
|
|
83
140
|
DA:10,1
|
|
84
141
|
DA:11,1
|
|
85
|
-
DA:12,
|
|
86
|
-
DA:
|
|
87
|
-
DA:
|
|
88
|
-
DA:
|
|
89
|
-
DA:
|
|
90
|
-
DA:
|
|
91
|
-
DA:22,0
|
|
92
|
-
DA:25,1
|
|
93
|
-
DA:26,0
|
|
94
|
-
DA:27,0
|
|
142
|
+
DA:12,0
|
|
143
|
+
DA:14,1
|
|
144
|
+
DA:22,1
|
|
145
|
+
DA:23,1
|
|
146
|
+
DA:27,1
|
|
147
|
+
DA:28,0
|
|
95
148
|
DA:29,0
|
|
96
149
|
DA:30,0
|
|
97
|
-
DA:
|
|
98
|
-
DA:
|
|
99
|
-
DA:
|
|
100
|
-
DA:
|
|
101
|
-
DA:
|
|
102
|
-
DA:
|
|
103
|
-
DA:
|
|
104
|
-
DA:
|
|
150
|
+
DA:31,0
|
|
151
|
+
DA:34,1
|
|
152
|
+
DA:35,0
|
|
153
|
+
DA:36,0
|
|
154
|
+
DA:38,0
|
|
155
|
+
DA:39,0
|
|
156
|
+
DA:45,20
|
|
157
|
+
DA:46,0
|
|
105
158
|
DA:48,20
|
|
106
|
-
DA:49,
|
|
107
|
-
DA:
|
|
108
|
-
DA:52,
|
|
109
|
-
DA:
|
|
110
|
-
DA:
|
|
111
|
-
DA:
|
|
112
|
-
DA:
|
|
113
|
-
DA:
|
|
114
|
-
DA:
|
|
115
|
-
DA:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
BRDA:
|
|
125
|
-
BRDA:
|
|
126
|
-
BRDA:
|
|
127
|
-
BRDA:
|
|
128
|
-
BRDA:
|
|
129
|
-
BRDA:
|
|
130
|
-
BRDA:
|
|
131
|
-
BRDA:
|
|
132
|
-
BRDA:
|
|
133
|
-
BRDA:
|
|
134
|
-
BRDA:
|
|
135
|
-
BRDA:
|
|
136
|
-
BRDA:
|
|
137
|
-
BRDA:
|
|
138
|
-
BRDA:
|
|
139
|
-
BRDA:
|
|
140
|
-
BRDA:
|
|
141
|
-
BRDA:
|
|
142
|
-
BRDA:
|
|
159
|
+
DA:49,0
|
|
160
|
+
DA:51,20
|
|
161
|
+
DA:52,20
|
|
162
|
+
DA:53,0
|
|
163
|
+
DA:54,0
|
|
164
|
+
DA:57,20
|
|
165
|
+
DA:58,20
|
|
166
|
+
DA:59,15
|
|
167
|
+
DA:61,5
|
|
168
|
+
DA:63,20
|
|
169
|
+
DA:64,20
|
|
170
|
+
DA:65,20
|
|
171
|
+
DA:66,0
|
|
172
|
+
DA:67,0
|
|
173
|
+
DA:69,20
|
|
174
|
+
DA:70,20
|
|
175
|
+
LF:36
|
|
176
|
+
LH:21
|
|
177
|
+
BRDA:11,0,0,0
|
|
178
|
+
BRDA:11,0,1,1
|
|
179
|
+
BRDA:27,1,0,0
|
|
180
|
+
BRDA:27,1,1,1
|
|
181
|
+
BRDA:30,2,0,0
|
|
182
|
+
BRDA:30,2,1,0
|
|
183
|
+
BRDA:34,3,0,0
|
|
184
|
+
BRDA:34,3,1,1
|
|
185
|
+
BRDA:35,4,0,0
|
|
186
|
+
BRDA:35,4,1,0
|
|
187
|
+
BRDA:38,5,0,0
|
|
188
|
+
BRDA:38,5,1,0
|
|
189
|
+
BRDA:44,6,0,20
|
|
190
|
+
BRDA:45,7,0,0
|
|
191
|
+
BRDA:45,7,1,20
|
|
192
|
+
BRDA:48,8,0,0
|
|
193
|
+
BRDA:48,8,1,20
|
|
194
|
+
BRDA:52,9,0,0
|
|
195
|
+
BRDA:52,9,1,20
|
|
196
|
+
BRDA:53,10,0,0
|
|
197
|
+
BRDA:53,10,1,0
|
|
198
|
+
BRDA:58,11,0,15
|
|
199
|
+
BRDA:58,11,1,5
|
|
200
|
+
BRDA:65,12,0,0
|
|
201
|
+
BRDA:65,12,1,20
|
|
143
202
|
BRF:25
|
|
144
203
|
BRH:10
|
|
145
204
|
end_of_record
|
|
@@ -161,8 +220,12 @@ DA:9,1
|
|
|
161
220
|
DA:10,1
|
|
162
221
|
DA:11,1
|
|
163
222
|
DA:12,1
|
|
223
|
+
DA:16,1
|
|
224
|
+
DA:17,0
|
|
164
225
|
DA:19,1
|
|
165
226
|
DA:20,0
|
|
227
|
+
DA:22,1
|
|
228
|
+
DA:23,0
|
|
166
229
|
DA:25,1
|
|
167
230
|
DA:26,0
|
|
168
231
|
DA:31,3
|
|
@@ -203,38 +266,42 @@ DA:82,3
|
|
|
203
266
|
DA:83,3
|
|
204
267
|
DA:84,3
|
|
205
268
|
DA:86,0
|
|
206
|
-
LF:
|
|
207
|
-
LH:
|
|
208
|
-
BRDA:
|
|
209
|
-
BRDA:
|
|
210
|
-
BRDA:
|
|
211
|
-
BRDA:
|
|
212
|
-
BRDA:
|
|
213
|
-
BRDA:
|
|
214
|
-
BRDA:
|
|
215
|
-
BRDA:
|
|
216
|
-
BRDA:
|
|
217
|
-
BRDA:
|
|
218
|
-
BRDA:
|
|
219
|
-
BRDA:
|
|
220
|
-
BRDA:
|
|
221
|
-
BRDA:
|
|
222
|
-
BRDA:
|
|
223
|
-
BRDA:
|
|
224
|
-
BRDA:
|
|
225
|
-
BRDA:
|
|
226
|
-
BRDA:
|
|
227
|
-
BRDA:
|
|
228
|
-
BRDA:
|
|
229
|
-
BRDA:
|
|
230
|
-
BRDA:
|
|
231
|
-
BRDA:
|
|
232
|
-
BRDA:
|
|
233
|
-
BRDA:
|
|
234
|
-
BRDA:
|
|
235
|
-
BRDA:
|
|
236
|
-
|
|
237
|
-
|
|
269
|
+
LF:50
|
|
270
|
+
LH:32
|
|
271
|
+
BRDA:16,0,0,0
|
|
272
|
+
BRDA:16,0,1,1
|
|
273
|
+
BRDA:19,1,0,0
|
|
274
|
+
BRDA:19,1,1,1
|
|
275
|
+
BRDA:22,2,0,0
|
|
276
|
+
BRDA:22,2,1,1
|
|
277
|
+
BRDA:25,3,0,0
|
|
278
|
+
BRDA:25,3,1,1
|
|
279
|
+
BRDA:31,4,0,0
|
|
280
|
+
BRDA:31,4,1,3
|
|
281
|
+
BRDA:34,5,0,0
|
|
282
|
+
BRDA:34,5,1,3
|
|
283
|
+
BRDA:37,6,0,0
|
|
284
|
+
BRDA:37,6,1,3
|
|
285
|
+
BRDA:42,7,0,1
|
|
286
|
+
BRDA:42,7,1,2
|
|
287
|
+
BRDA:53,8,0,0
|
|
288
|
+
BRDA:53,8,1,2
|
|
289
|
+
BRDA:55,9,0,0
|
|
290
|
+
BRDA:55,9,1,0
|
|
291
|
+
BRDA:57,10,0,0
|
|
292
|
+
BRDA:57,10,1,0
|
|
293
|
+
BRDA:65,11,0,1
|
|
294
|
+
BRDA:65,11,1,1
|
|
295
|
+
BRDA:73,12,0,0
|
|
296
|
+
BRDA:73,12,1,3
|
|
297
|
+
BRDA:76,13,0,0
|
|
298
|
+
BRDA:76,13,1,3
|
|
299
|
+
BRDA:79,14,0,0
|
|
300
|
+
BRDA:79,14,1,3
|
|
301
|
+
BRDA:82,15,0,3
|
|
302
|
+
BRDA:82,15,1,0
|
|
303
|
+
BRF:32
|
|
304
|
+
BRH:16
|
|
238
305
|
end_of_record
|
|
239
306
|
TN:
|
|
240
307
|
SF:src/server/class/Tackles.js
|
|
@@ -279,57 +346,6 @@ BRF:10
|
|
|
279
346
|
BRH:4
|
|
280
347
|
end_of_record
|
|
281
348
|
TN:
|
|
282
|
-
SF:src/server/lib/byteArray.js
|
|
283
|
-
FN:3,fromInt
|
|
284
|
-
FN:17,toInt
|
|
285
|
-
FNF:2
|
|
286
|
-
FNH:2
|
|
287
|
-
FNDA:1,fromInt
|
|
288
|
-
FNDA:1,toInt
|
|
289
|
-
DA:1,1
|
|
290
|
-
DA:4,1
|
|
291
|
-
DA:5,1
|
|
292
|
-
DA:6,1
|
|
293
|
-
DA:7,1
|
|
294
|
-
DA:8,3
|
|
295
|
-
DA:9,3
|
|
296
|
-
DA:10,3
|
|
297
|
-
DA:13,1
|
|
298
|
-
DA:14,1
|
|
299
|
-
DA:18,1
|
|
300
|
-
DA:19,1
|
|
301
|
-
DA:20,4
|
|
302
|
-
DA:22,1
|
|
303
|
-
LF:14
|
|
304
|
-
LH:14
|
|
305
|
-
BRDA:6,0,0,1
|
|
306
|
-
BRDA:6,0,1,0
|
|
307
|
-
BRF:2
|
|
308
|
-
BRH:1
|
|
309
|
-
end_of_record
|
|
310
|
-
TN:
|
|
311
|
-
SF:src/server/lib/errorHandle.js
|
|
312
|
-
FN:1,errorHandle
|
|
313
|
-
FN:5,(anonymous_1)
|
|
314
|
-
FNF:2
|
|
315
|
-
FNH:2
|
|
316
|
-
FNDA:2,errorHandle
|
|
317
|
-
FNDA:2,(anonymous_1)
|
|
318
|
-
DA:2,2
|
|
319
|
-
DA:3,0
|
|
320
|
-
DA:5,2
|
|
321
|
-
DA:6,2
|
|
322
|
-
DA:7,2
|
|
323
|
-
DA:9,1
|
|
324
|
-
DA:10,1
|
|
325
|
-
LF:7
|
|
326
|
-
LH:6
|
|
327
|
-
BRDA:2,0,0,0
|
|
328
|
-
BRDA:2,0,1,2
|
|
329
|
-
BRF:2
|
|
330
|
-
BRH:1
|
|
331
|
-
end_of_record
|
|
332
|
-
TN:
|
|
333
349
|
SF:src/server/lib/formatHttpDate.js
|
|
334
350
|
FN:1,formatHttpDate
|
|
335
351
|
FNF:1
|
|
@@ -492,11 +508,11 @@ FNDA:3,isIpv6Address
|
|
|
492
508
|
DA:2,3
|
|
493
509
|
DA:3,3
|
|
494
510
|
DA:4,3
|
|
495
|
-
DA:5,
|
|
496
|
-
DA:6,
|
|
511
|
+
DA:5,99
|
|
512
|
+
DA:6,99
|
|
497
513
|
DA:9,22
|
|
498
514
|
DA:10,22
|
|
499
|
-
DA:12,
|
|
515
|
+
DA:12,77
|
|
500
516
|
DA:13,0
|
|
501
517
|
DA:17,3
|
|
502
518
|
DA:18,1
|
|
@@ -505,49 +521,19 @@ LF:12
|
|
|
505
521
|
LH:11
|
|
506
522
|
BRDA:6,0,0,3
|
|
507
523
|
BRDA:6,0,1,22
|
|
508
|
-
BRDA:6,0,2,
|
|
524
|
+
BRDA:6,0,2,77
|
|
509
525
|
BRDA:12,1,0,0
|
|
510
|
-
BRDA:12,1,1,
|
|
511
|
-
BRDA:12,2,0,
|
|
512
|
-
BRDA:12,2,1,
|
|
513
|
-
BRDA:12,2,2,
|
|
514
|
-
BRDA:12,2,3,
|
|
526
|
+
BRDA:12,1,1,77
|
|
527
|
+
BRDA:12,2,0,77
|
|
528
|
+
BRDA:12,2,1,77
|
|
529
|
+
BRDA:12,2,2,15
|
|
530
|
+
BRDA:12,2,3,15
|
|
515
531
|
BRDA:17,3,0,1
|
|
516
532
|
BRDA:17,3,1,2
|
|
517
533
|
BRF:11
|
|
518
534
|
BRH:10
|
|
519
535
|
end_of_record
|
|
520
536
|
TN:
|
|
521
|
-
SF:src/server/lib/nonZeroByteArray.js
|
|
522
|
-
FN:3,fromInt
|
|
523
|
-
FN:17,toInt
|
|
524
|
-
FNF:2
|
|
525
|
-
FNH:2
|
|
526
|
-
FNDA:1,fromInt
|
|
527
|
-
FNDA:1,toInt
|
|
528
|
-
DA:1,1
|
|
529
|
-
DA:4,1
|
|
530
|
-
DA:5,1
|
|
531
|
-
DA:6,1
|
|
532
|
-
DA:7,1
|
|
533
|
-
DA:8,3
|
|
534
|
-
DA:9,3
|
|
535
|
-
DA:10,3
|
|
536
|
-
DA:13,1
|
|
537
|
-
DA:14,1
|
|
538
|
-
DA:18,1
|
|
539
|
-
DA:19,1
|
|
540
|
-
DA:20,1
|
|
541
|
-
DA:21,4
|
|
542
|
-
DA:23,1
|
|
543
|
-
LF:15
|
|
544
|
-
LH:15
|
|
545
|
-
BRDA:6,0,0,1
|
|
546
|
-
BRDA:6,0,1,0
|
|
547
|
-
BRF:2
|
|
548
|
-
BRH:1
|
|
549
|
-
end_of_record
|
|
550
|
-
TN:
|
|
551
537
|
SF:src/server/lib/parseHttpDate.js
|
|
552
538
|
FN:1,parseHttpDate
|
|
553
539
|
FNF:1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manner.js",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Frontend manner project.",
|
|
5
5
|
"repository": "git@github.com:leoely/manner.js.git",
|
|
6
6
|
"author": "Leo Ely",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"run": "gulp build && node dist/index.js",
|
|
10
10
|
"build": "gulp build && gulp copy",
|
|
11
11
|
"clean": "rm -rf client server",
|
|
12
|
-
"test": "jest
|
|
12
|
+
"test": "jest"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@babel/cli": "^7.20.7",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"jest": "^29.7.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"advising.js": "^1.0.
|
|
25
|
+
"advising.js": "^1.0.36",
|
|
26
26
|
"babel-plugin-root-import": "^6.6.0",
|
|
27
27
|
"gulp": "^4.0.2",
|
|
28
28
|
"node-fetch": "2"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net")),_advising=require("advising.js"),_Tackles=_interopRequireDefault(require("./Tackles"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class Blocks extends _Tackles.default{constructor(e){super(),this.dealParams(e),this.interval=e}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.");if(!Number.isInteger(e/500))throw new Error("[Error] The parameter interval should be divisible by 500 milliseconds.")}examineIpAddress(e,r){if("string"!=typeof e)throw new Error("[Error] The parameter ip should be of string type.");if(!(r instanceof _advising.Router))throw new Error("[Error] The parameter ipRouter should be the router type.");let t=!0;var i,o=r.gain(e);return void 0===o?(r.attach(e,1),i=this.interval,setTimeout(()=>{super.cleanTackle(e)},i)):(i=o,r.revise(e,i+=1),t=!1),t}examine(e){if("string"!=typeof e)throw new Error("[Error] The parameter ip should be of string type.");var r;if(_net.default.isIPv4(e))return r=this.ipv4Router,this.examineIpAddress(e,r);if(_net.default.isIPv6(e))return r=this.ipv6Router,this.examineIpAddress(e,r);throw new Error("[Error] The Ip type is not expected.")}}var _default=exports.default=Blocks;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;class ByteArray{constructor(t={}){this.options=Object.assign({size:256n,shift:0n},t),this.dealOptions()}dealOptions(){var{size:t,shift:r}=this.options;if("bigint"!=typeof t)throw new Error("[Error] The option size should be of type bigInt.");if(!(0n<t))throw new Error("[Error] Option size should be a positive integer.");if("bigint"!=typeof r)throw new Error("[Error] The option shift should be of type bigInt.");if(!(0n<=t))throw new Error("[Error] Option shift should be greater than or equal to zero.")}fromInt(t){var{size:r,shift:e}=this.options,o=[];if(r-2n-e<(t=BigInt(t)))for(;r-e<t;)o.push(Number(t%(r-e)+e)),t/=r-e;return o.push(Number(t+e)),o}toInt(r){var{size:e,shift:o}=this.options;let i=0n;for(let t=0n;t<r.length;t+=1n)i+=(BigInt(r[t])-o)*(e-o)**t;return i}}var _default=exports.default=ByteArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _https=_interopRequireDefault(require("https")),_http=_interopRequireDefault(require("http")),_net=_interopRequireDefault(require("net")),_nodeFetch=_interopRequireDefault(require("node-fetch")),_advising=require("advising.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class MultiFetch{constructor(e,t){this.dealParams(e,t),this.bases=e,void 0!==t&&(this.interval=t),this.index=this.getRandomIndex()}getRandomIndex(){var{length:e}=this.bases;return Math.ceil(e*Math.random())}dealParams(e,t){if(!Array.isArray(e))throw new Error("[Error] The bases parameter bases should be a array type.");if(void 0!==t){if(!Number.isInteger(t))throw new Error("[Error] The interval parameter should be of integer type.");if(t<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}}async fetch(e,t,r={}){if("string"!=typeof e)throw new Error("[Error] The path parameter path should be of string type.");if("object"!=typeof t)throw new Error("[Error] The options parameter should be a object type.");var i,r=r.req;if(void 0===r||r instanceof _http.default.ClientRequest)return r=this.bases,i=(this.index<r.length-1?this.index+=1:this.index=0,this).index,(r=r[i]).startsWith("https")&&(i=new _https.default.Agent({rejectUnauthorized:!1}),t.agent=i),(0,_nodeFetch.default)(r+e,t);throw new Error("[Error] Need to pass http request objec.")}}var _default=exports.default=MultiFetch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _http=_interopRequireDefault(require("http")),_net=_interopRequireDefault(require("net")),_advising=require("advising.js"),_parseHttpDate=_interopRequireDefault(require("../lib/parseHttpDate")),_Tackles=_interopRequireDefault(require("./Tackles"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class Prevents extends _Tackles.default{constructor(e,r){super(),this.dealParams(e,r),this.threshold=e,this.interval=r}dealParams(e,r){if(!Number.isInteger(e))throw new Error("[Error] The parameter threshold should be of integer type.");if(!(0<e))throw new Error("[Error] The parameter threshold should be of positive integer type.");if(!Number.isInteger(r))throw new Error("[Error] The parameter interval should be of integer type.");if(!(0<r))throw new Error("[Error] The parameter interval should be of positive integer type.")}inspectStaticFile(e,r,t){if("string"!=typeof e)throw new Error("[Error] The parameter ip should be of string type.");if(r instanceof _http.default.ClientRequest)throw new Error("[Error] The parameter req should be the clientRequest type.");if(!(t instanceof _advising.Router))throw new Error("[Error] The parameter ipPevents should be the router type.");let i=!0;var o,s=t.gain(e);return void 0===s?(t.attach(e,1n),o=this.interval,setTimeout(()=>{super.cleanTackle(e)},o)):(o=s,t.revise(e,o+=1n),r=("string"==typeof(s=r.headers["if-modified-since"])&&"number"!=typeof(t=(0,_parseHttpDate.default)(s).getTime())&&t<=(new Date).getTime()&&(i=!1),this).threshold,r<=o&&(i=!1)),i}inspect(e,r){if("string"!=typeof e)throw new Error("[Error] The parameter ip should be of string type.");if(r instanceof _http.default.ClientRequest)throw new Error("[Error] The parameter req should be the clientRequest type.");var t;if(_net.default.isIPv4(e))return t=this.ipv4Router,this.inspectStaticFile(e,r,t);if(_net.default.isIPv6(e))return t=this.ipv6Router,this.inspectStaticFile(e,r,t);throw new Error("[Error] The Ip type is not expected.")}}var _default=exports.default=Prevents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net")),_advising=require("advising.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class Tackles{constructor(){this.ipv4Router=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Router=new _advising.Ipv6Router({debug:!1,hideError:!0})}getCount(e){var r;if(_net.default.isIPv4(e))return r=this.ipv4Router,r.gain(e);if(_net.default.isIPv6(e))return r=this.ipv6Router,r.gain(e);throw new Error("[Error] The Ip type is not expected.")}cleanTackle(e){if("string"!=typeof e)throw new Error("[Error] The parameter ip should be of string type.");let r;if(_net.default.isIPv4(e))r=this.ipv4Router;else{if(!_net.default.isIPv6(e))throw new Error("[Error] The Ip type is not expected");r=this.ipv6Router}r.ruin(e)}}var _default=exports.default=Tackles;
|
package/server/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Blocks",{enumerable:!0,get:function(){return _Blocks.default}}),Object.defineProperty(exports,"ByteArray",{enumerable:!0,get:function(){return _ByteArray.default}}),Object.defineProperty(exports,"MultiFetch",{enumerable:!0,get:function(){return _MultiFetch.default}}),Object.defineProperty(exports,"Prevents",{enumerable:!0,get:function(){return _Prevents.default}}),Object.defineProperty(exports,"addToLog",{enumerable:!0,get:function(){return _addToLog.default}}),Object.defineProperty(exports,"appendToLog",{enumerable:!0,get:function(){return _appendToLog.default}}),Object.defineProperty(exports,"checkLogPath",{enumerable:!0,get:function(){return _checkLogPath.default}}),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,"getDateString",{enumerable:!0,get:function(){return _getDateString.default}}),Object.defineProperty(exports,"getGTMNowString",{enumerable:!0,get:function(){return _getGTMNowString.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}}),Object.defineProperty(exports,"logOutOfMemory",{enumerable:!0,get:function(){return _logOutOfMemory.default}}),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")),_Prevents=_interopRequireDefault(require("./class/Prevents")),_ByteArray=_interopRequireDefault(require("./class/ByteArray")),_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")),_appendToLog=_interopRequireDefault(require("./lib/appendToLog")),_addToLog=_interopRequireDefault(require("./lib/addToLog")),_getDateString=_interopRequireDefault(require("./lib/getDateString")),_getGTMNowString=_interopRequireDefault(require("./lib/getGTMNowString")),_checkLogPath=_interopRequireDefault(require("./lib/checkLogPath")),_logOutOfMemory=_interopRequireDefault(require("./lib/logOutOfMemory"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=addToLog;var _fs=_interopRequireDefault(require("fs")),_path=_interopRequireDefault(require("path")),_getDateString=_interopRequireDefault(require("./getDateString"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function addToLog(e,t){var r=(0,_getDateString.default)();_fs.default.appendFileSync(_path.default.join(e,r),t)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=appendToLog;var _fs=_interopRequireDefault(require("fs")),_path=_interopRequireDefault(require("path")),_getDateString=_interopRequireDefault(require("./getDateString")),_getGTMNowString=_interopRequireDefault(require("./getGTMNowString"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function appendToLog(e,t){var r=(0,_getDateString.default)();_fs.default.appendFileSync(_path.default.join(e,r),(0,_getGTMNowString.default)()+t)}
|
|
@@ -0,0 +1 @@
|
|
|
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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=checkLogPath;var _fs=_interopRequireDefault(require("fs"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function checkLogPath(e){_fs.default.existsSync(e)||_fs.default.mkdirSync(e,{recursive:!0})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function discHndl(e,o){if("boolean"!=typeof e)throw new Error("[Error] The parameter whether to connect needs to be of booean type.");if("function"!=typeof o)throw new Error("[Error] Parameter handling should be function type.");!1===e&&await o()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=discHndl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function errorHandle(t){if("function"!=typeof t)throw new Error("[Error] The parameter request listener needs to be of function type.");return async(e,r)=>{try{await t(e,r)}catch(e){r.writeHead(500),r.end()}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=errorHandle;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function getDateString(e){return[(e=void 0===e?new Date:e).getFullYear(),e.getMonth()+1,e.getDate()].join("-")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=getDateString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function getGTMNoweString(){return(new Date).toString()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=getGTMNoweString;
|
|
@@ -0,0 +1 @@
|
|
|
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}
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=logOutOfMemory;var _appendToLog=_interopRequireDefault(require("./appendToLog"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function logOutOfMemory(e,o){(0,_appendToLog.default)(e," || ████ ❗❗❗❗FREEMEN:"+o+" ████ & ████ REASON: Out fo memory ████ ||\n")}
|
|
@@ -0,0 +1 @@
|
|
|
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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function parseHttpDate(e){var[,e]=e.split(", ");let[a,s,t,r]=e.split(" ");var[e,c,p]=r.split(":"),n=new Date;switch(n.setFullYear(parseInt(t)),s){case"Jan":s=0;break;case"Feb":s=1;break;case"Mar":s=2;break;case"Apr":s=3;break;case"May":s=4;break;case"Jun":s=5;break;case"Jul":s=6;break;case"Aug":s=7;break;case"Sep":s=8;break;case"Oct":s=9;break;case"Nov":s=10;break;case"Dec":s=11}return n.setMonth(s),n.setUTCDate(parseInt(a)),n.setHours(parseInt(e)),n.setMinutes(parseInt(c)),n.setSeconds(parseInt(p)),n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=parseHttpDate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function readCookie(e){let t={},i=("string"==typeof e&&e.split(";").forEach(e=>{var[e,o]=e.split("=");t[e.trim()]=o}),{});return Object.keys(t).forEach(e=>{var o,r=e.split("_");2===r.length&&([r,o]=r,void 0===i[r]&&(i[r]={}),i[r][o]=t[e])}),i}Object.defineProperty(exports,"__esModule",{value:!0}),exports.readCookie=readCookie;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function wrapIpv6(e){return"["+e+"]"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=wrapIpv6;
|