mtproto-checker 0.4.0 → 0.4.2
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/LICENSE +24 -0
- package/README.md +10 -2
- package/check.js +20 -1
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
CHANGED
|
@@ -345,7 +345,15 @@ server {
|
|
|
345
345
|
proxy_set_header X-Real-IP $remote_addr;
|
|
346
346
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
347
347
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
348
|
-
|
|
348
|
+
|
|
349
|
+
# Объявляем переменную с таймаутом (600s = 10 минут)
|
|
350
|
+
set $custom_timeout 600s;
|
|
351
|
+
|
|
352
|
+
# Используем переменную для всех таймаутов
|
|
353
|
+
proxy_read_timeout $custom_timeout;
|
|
354
|
+
proxy_connect_timeout $custom_timeout;
|
|
355
|
+
proxy_send_timeout $custom_timeout;
|
|
356
|
+
send_timeout $custom_timeout;
|
|
349
357
|
}
|
|
350
358
|
}
|
|
351
359
|
|
|
@@ -394,4 +402,4 @@ docker compose up -d
|
|
|
394
402
|
|
|
395
403
|
## 📜 License
|
|
396
404
|
|
|
397
|
-
|
|
405
|
+
[Unlicense](LICENSE) — completely free to use, no restrictions.
|
package/check.js
CHANGED
|
@@ -641,6 +641,12 @@ function createServer({ auth, checkUrl, logger = console.error }) {
|
|
|
641
641
|
let statusCode = 500
|
|
642
642
|
|
|
643
643
|
try {
|
|
644
|
+
if (req.url === '/health') {
|
|
645
|
+
statusCode = 200
|
|
646
|
+
jsonResponse(res, statusCode, { status: 'ok', uptime: process.uptime() })
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
|
|
644
650
|
if (!isAuthorized(req, auth)) {
|
|
645
651
|
statusCode = 401
|
|
646
652
|
jsonResponse(res, statusCode, { error: 'Unauthorized' }, { 'www-authenticate': realm })
|
|
@@ -751,7 +757,20 @@ async function startServer(opts = {}) {
|
|
|
751
757
|
})
|
|
752
758
|
|
|
753
759
|
console.error(`[mtproto-checker] ⚡ HTTP server listening on http://localhost:${port}`)
|
|
754
|
-
console.error(`[mtproto-checker]
|
|
760
|
+
console.error(`[mtproto-checker] GET /health (no auth)`)
|
|
761
|
+
console.error(`[mtproto-checker] POST /check (Basic auth: ${user}:***)`)
|
|
762
|
+
|
|
763
|
+
const shutdown = signal => {
|
|
764
|
+
console.error(`\n[mtproto-checker] ${signal} received, shutting down...`)
|
|
765
|
+
server.close(() => {
|
|
766
|
+
console.error('[mtproto-checker] Server closed.')
|
|
767
|
+
process.exit(0)
|
|
768
|
+
})
|
|
769
|
+
setTimeout(() => { process.exit(1) }, 5000)
|
|
770
|
+
}
|
|
771
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'))
|
|
772
|
+
process.on('SIGINT', () => shutdown('SIGINT'))
|
|
773
|
+
|
|
755
774
|
return server
|
|
756
775
|
}
|
|
757
776
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mtproto-checker",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Check Telegram MTProto proxies via a real TDLib handshake (testProxy), like tdesktop does",
|
|
5
5
|
"main": "check.js",
|
|
6
6
|
"exports": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"start": "node check.js"
|
|
27
27
|
},
|
|
28
|
+
"license": "Unlicense",
|
|
28
29
|
"engines": {
|
|
29
30
|
"node": ">=18"
|
|
30
31
|
},
|