mtproto-checker 0.3.0 โ 0.4.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/README.md +182 -34
- package/check.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Telegram MTProto proxy health checker powered by **TDLib**. Performs a real `tes
|
|
|
5
5
|
## โก Features
|
|
6
6
|
|
|
7
7
|
- ๐ค Real MTProto handshake (not just a port scan)
|
|
8
|
-
- ๐ก Check from remote URLs, local files,
|
|
8
|
+
- ๐ก Check from remote URLs, local files, direct proxy links, or any mix
|
|
9
9
|
- ๐ Multi-iteration filtering โ only survivors advance
|
|
10
10
|
- ๐ Built-in HTTP API server with Basic Auth
|
|
11
11
|
- ๐งน Auto de-duplication by `server:port:secret`
|
|
@@ -15,10 +15,14 @@ Telegram MTProto proxy health checker powered by **TDLib**. Performs a real `tes
|
|
|
15
15
|
## ๐ฆ Install
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
+
# Global โ gives you the `mtproto-checker` command
|
|
19
|
+
npm install -g mtproto-checker
|
|
20
|
+
|
|
21
|
+
# Local dependency
|
|
18
22
|
npm install mtproto-checker
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
Or clone
|
|
25
|
+
Or clone:
|
|
22
26
|
|
|
23
27
|
```bash
|
|
24
28
|
git clone https://github.com/Tar4s/mtproto-checker.git
|
|
@@ -44,32 +48,46 @@ npm install @tar4s/mtproto-checker
|
|
|
44
48
|
| `TG_API_HASH` | โ
| Telegram API Hash |
|
|
45
49
|
| `CHECK_AUTH_USER` | ๐ | HTTP Basic Auth username (server mode) |
|
|
46
50
|
| `CHECK_AUTH_PASSWORD` | ๐ | HTTP Basic Auth password (server mode) |
|
|
47
|
-
| `PORT` | โ | Server port (default `
|
|
51
|
+
| `PORT` | โ | Server port (default `8080`) |
|
|
52
|
+
|
|
53
|
+
## ๐ Quick Start (Global)
|
|
54
|
+
|
|
55
|
+
After `npm i -g mtproto-checker`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Start HTTP server (no arguments)
|
|
59
|
+
TG_API_ID=12345 TG_API_HASH=abcdef \
|
|
60
|
+
CHECK_AUTH_USER=admin CHECK_AUTH_PASSWORD=secret \
|
|
61
|
+
check-proxies
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
# CLI mode (with arguments)
|
|
64
|
+
TG_API_ID=12345 TG_API_HASH=abcdef check-proxies --sources urls.txt
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## ๐ฅ CLI Usage
|
|
50
68
|
|
|
51
69
|
```bash
|
|
52
|
-
TG_API_ID=12345 TG_API_HASH=abcdef
|
|
70
|
+
TG_API_ID=12345 TG_API_HASH=abcdef check-proxies [sources] [options]
|
|
53
71
|
```
|
|
54
72
|
|
|
55
73
|
### Input Methods
|
|
56
74
|
|
|
57
75
|
```bash
|
|
58
76
|
# Single proxy link
|
|
59
|
-
|
|
77
|
+
check-proxies --proxy "tg://proxy?server=1.2.3.4&port=443&secret=ee..."
|
|
60
78
|
|
|
61
79
|
# Remote URLs (positional or --url flag, repeatable)
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
check-proxies https://example.com/proxies.txt
|
|
81
|
+
check-proxies --url URL1 --url URL2
|
|
64
82
|
|
|
65
83
|
# File with source URLs (one per line, # comments ok)
|
|
66
|
-
|
|
84
|
+
check-proxies --sources urls.txt
|
|
67
85
|
|
|
68
86
|
# Local proxy file
|
|
69
|
-
|
|
87
|
+
check-proxies ./my-proxies.txt
|
|
70
88
|
|
|
71
89
|
# Stdin
|
|
72
|
-
cat proxies.txt |
|
|
90
|
+
cat proxies.txt | check-proxies
|
|
73
91
|
```
|
|
74
92
|
|
|
75
93
|
### โ๏ธ Options
|
|
@@ -94,23 +112,29 @@ cat proxies.txt | node check.js
|
|
|
94
112
|
|
|
95
113
|
## ๐ HTTP API Server
|
|
96
114
|
|
|
97
|
-
Start with **no arguments
|
|
115
|
+
Start with **no arguments** โ works both globally and locally:
|
|
98
116
|
|
|
99
117
|
```bash
|
|
118
|
+
# Global
|
|
119
|
+
TG_API_ID=12345 TG_API_HASH=abcdef \
|
|
120
|
+
CHECK_AUTH_USER=admin CHECK_AUTH_PASSWORD=secret \
|
|
121
|
+
check-proxies
|
|
122
|
+
|
|
123
|
+
# Local
|
|
100
124
|
TG_API_ID=12345 TG_API_HASH=abcdef \
|
|
101
125
|
CHECK_AUTH_USER=admin CHECK_AUTH_PASSWORD=secret \
|
|
102
126
|
node check.js
|
|
103
127
|
```
|
|
104
128
|
|
|
105
129
|
```
|
|
106
|
-
[mtproto-checker] โก HTTP server listening on http://localhost:
|
|
130
|
+
[mtproto-checker] โก HTTP server listening on http://localhost:8080
|
|
107
131
|
[mtproto-checker] POST /check (Basic auth: admin:***)
|
|
108
132
|
```
|
|
109
133
|
|
|
110
134
|
### `POST /check`
|
|
111
135
|
|
|
112
136
|
```bash
|
|
113
|
-
curl -u admin:secret http://localhost:
|
|
137
|
+
curl -u admin:secret http://localhost:8080/check \
|
|
114
138
|
-H "Content-Type: application/json" \
|
|
115
139
|
-d '{"url": "https://example.com/proxies.txt", "iterations": 2, "concurrency": 20}'
|
|
116
140
|
```
|
|
@@ -119,21 +143,39 @@ curl -u admin:secret http://localhost:3080/check \
|
|
|
119
143
|
|
|
120
144
|
| Field | Type | Default | Description |
|
|
121
145
|
|-------|------|:-------:|-------------|
|
|
122
|
-
| `url` | string | โ | Proxy list URL or
|
|
146
|
+
| `url` / `urls` / `uri` / `uris` | string \| string[] | โ | Proxy link(s), list URL(s), or any mix |
|
|
123
147
|
| `iterations` | int | `1` | Check rounds |
|
|
124
148
|
| `concurrency` | int | `30` | Parallel checks |
|
|
125
149
|
|
|
150
|
+
All input formats work:
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
// Single proxy link
|
|
154
|
+
{ "url": "tg://proxy?server=1.2.3.4&port=443&secret=ee..." }
|
|
155
|
+
|
|
156
|
+
// Single list URL
|
|
157
|
+
{ "url": "https://example.com/proxies.txt" }
|
|
158
|
+
|
|
159
|
+
// Array โ mix of direct links and list URLs
|
|
160
|
+
{ "urls": [
|
|
161
|
+
"tg://proxy?server=1.2.3.4&port=443&secret=ee...",
|
|
162
|
+
"https://t.me/proxy?server=5.6.7.8&port=443&secret=dd...",
|
|
163
|
+
"https://example.com/list.txt"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
126
168
|
**Response:**
|
|
127
169
|
|
|
128
170
|
```json
|
|
129
171
|
{
|
|
130
|
-
"
|
|
172
|
+
"uris": ["https://example.com/proxies.txt"],
|
|
131
173
|
"iterations": 2,
|
|
132
174
|
"concurrency": 20,
|
|
133
175
|
"count": 150,
|
|
134
176
|
"working": 42,
|
|
135
177
|
"results": [
|
|
136
|
-
{ "server": "1.2.3.4", "port": 443, "sni": "example.com", "ok": true, "ms": 312, "error": null
|
|
178
|
+
{ "proxy": { "raw": "tg://proxy?...", "server": "1.2.3.4", "port": 443, "secret": "ee...", "sni": "example.com" }, "ok": true, "ms": 312, "error": null }
|
|
137
179
|
]
|
|
138
180
|
}
|
|
139
181
|
```
|
|
@@ -164,32 +206,31 @@ const results = await checkProxyLink(
|
|
|
164
206
|
|
|
165
207
|
### `checkProxiesFromURIs(uris, opts)` โ `Promise<Array>`
|
|
166
208
|
|
|
167
|
-
Check proxies from remote URLs, local files, or
|
|
209
|
+
Check proxies from remote URLs, local files, direct proxy links, or any mix. Auto-detects type per entry, de-duplicates automatically.
|
|
168
210
|
|
|
169
211
|
```js
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
'https://example.com/proxies.txt',
|
|
173
|
-
{ apiId: 12345, apiHash: 'abcdef' }
|
|
174
|
-
)
|
|
212
|
+
// Single source
|
|
213
|
+
await checkProxiesFromURIs('https://example.com/proxies.txt', opts)
|
|
175
214
|
|
|
176
|
-
//
|
|
177
|
-
|
|
215
|
+
// Direct proxy link
|
|
216
|
+
await checkProxiesFromURIs('tg://proxy?server=1.2.3.4&port=443&secret=ee...', opts)
|
|
178
217
|
|
|
179
|
-
// Mix
|
|
180
|
-
|
|
181
|
-
'
|
|
182
|
-
'
|
|
183
|
-
'https://example.com/
|
|
218
|
+
// Mix of everything
|
|
219
|
+
await checkProxiesFromURIs([
|
|
220
|
+
'tg://proxy?server=1.2.3.4&port=443&secret=ee...',
|
|
221
|
+
'https://t.me/proxy?server=5.6.7.8&port=443&secret=dd...',
|
|
222
|
+
'https://example.com/list.txt',
|
|
223
|
+
'./local-list.txt'
|
|
184
224
|
], { apiId: 12345, apiHash: 'abcdef', iterations: 2, concurrency: 20 })
|
|
185
225
|
```
|
|
186
226
|
|
|
187
227
|
```
|
|
188
|
-
[mtproto-checker] Loading
|
|
189
|
-
|
|
228
|
+
[mtproto-checker] Loading 4 source(s)...
|
|
229
|
+
โก 1.2.3.4:443
|
|
230
|
+
โก 5.6.7.8:443
|
|
231
|
+
โ https://example.com/list.txt
|
|
190
232
|
โ ./local-list.txt
|
|
191
|
-
|
|
192
|
-
[mtproto-checker] Checking 150 proxies (dc=2, timeout=10s, concurrency=30, iterations=2)...
|
|
233
|
+
[mtproto-checker] Checking 150 proxies (dc=2, timeout=10s, concurrency=20, iterations=2)...
|
|
193
234
|
|
|
194
235
|
[ 1/150] โ 312ms 1.2.3.4:443 [example.com]
|
|
195
236
|
[ 2/150] โ Timeout 5.6.7.8:443
|
|
@@ -235,6 +276,113 @@ https://t.me/proxy?server=1.2.3.4&port=443&secret=ee...
|
|
|
235
276
|
|
|
236
277
|
Secrets: hex (`ee...`, `dd...`), plain hex, or base64url โ auto-detected. `tg://socks` links are ignored.
|
|
237
278
|
|
|
279
|
+
## ๐ณ Docker Deployment
|
|
280
|
+
|
|
281
|
+
Structure on the server:
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
/etc/mtproto-checker/ โ source code (auto-pulled)
|
|
285
|
+
โโโ check.js
|
|
286
|
+
โโโ Dockerfile
|
|
287
|
+
โโโ package.json
|
|
288
|
+
โโโ ...
|
|
289
|
+
|
|
290
|
+
/opt/mtproto-checker/ โ configs & certs (manual)
|
|
291
|
+
โโโ docker-compose.yml
|
|
292
|
+
โโโ default.conf
|
|
293
|
+
โโโ fullchain.pem
|
|
294
|
+
โโโ privkey.key
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### `docker-compose.yml`
|
|
298
|
+
|
|
299
|
+
```yaml
|
|
300
|
+
services:
|
|
301
|
+
app:
|
|
302
|
+
container_name: mtproto-checker
|
|
303
|
+
build: /etc/mtproto-checker
|
|
304
|
+
restart: unless-stopped
|
|
305
|
+
environment:
|
|
306
|
+
- TG_API_ID=your_api_id
|
|
307
|
+
- TG_API_HASH=your_api_hash
|
|
308
|
+
- CHECK_AUTH_USER=admin
|
|
309
|
+
- CHECK_AUTH_PASSWORD=your_password
|
|
310
|
+
- PORT=8080
|
|
311
|
+
expose:
|
|
312
|
+
- "8080"
|
|
313
|
+
|
|
314
|
+
nginx:
|
|
315
|
+
container_name: mtproto-checker-nginx
|
|
316
|
+
image: nginx:alpine
|
|
317
|
+
restart: unless-stopped
|
|
318
|
+
ports:
|
|
319
|
+
- "443:443"
|
|
320
|
+
- "80:80"
|
|
321
|
+
volumes:
|
|
322
|
+
- ./default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
323
|
+
- ./privkey.key:/etc/nginx/ssl/privkey.key:ro
|
|
324
|
+
- ./fullchain.pem:/etc/nginx/ssl/fullchain.pem:ro
|
|
325
|
+
depends_on:
|
|
326
|
+
- app
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### `default.conf`
|
|
330
|
+
|
|
331
|
+
```nginx
|
|
332
|
+
server {
|
|
333
|
+
listen 443 ssl;
|
|
334
|
+
server_name _;
|
|
335
|
+
|
|
336
|
+
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
|
337
|
+
ssl_certificate_key /etc/nginx/ssl/privkey.key;
|
|
338
|
+
|
|
339
|
+
ssl_protocols TLSv1.2 TLSv1.3;
|
|
340
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
341
|
+
|
|
342
|
+
location / {
|
|
343
|
+
proxy_pass http://app:8080;
|
|
344
|
+
proxy_set_header Host $host;
|
|
345
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
346
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
347
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
348
|
+
proxy_read_timeout 120s;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
server {
|
|
353
|
+
listen 80;
|
|
354
|
+
server_name _;
|
|
355
|
+
return 301 https://$host$request_uri;
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### SSL Certificate
|
|
360
|
+
|
|
361
|
+
Install acme.sh:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
sudo apt-get install cron socat
|
|
365
|
+
curl https://get.acme.sh | sh -s email=your@email.com && source ~/.bashrc
|
|
366
|
+
acme.sh --set-default-ca --server letsencrypt
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Issue certificate:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
acme.sh --issue --standalone -d 'your-domain.example.com' \
|
|
373
|
+
--key-file /opt/mtproto-checker/privkey.key \
|
|
374
|
+
--fullchain-file /opt/mtproto-checker/fullchain.pem
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Auto-renewal is set up via cron automatically. Verify with `crontab -l | grep acme`.
|
|
378
|
+
|
|
379
|
+
### Deploy
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
docker compose build --no-cache
|
|
383
|
+
docker compose up -d
|
|
384
|
+
```
|
|
385
|
+
|
|
238
386
|
## ๐ Troubleshooting
|
|
239
387
|
|
|
240
388
|
| Problem | Fix |
|
package/check.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* CLI usage:
|
|
21
21
|
* TG_API_ID=12345 TG_API_HASH=abcdef CHECK_AUTH_USER=admin CHECK_AUTH_PASSWORD=secret node check.js
|
|
22
|
-
* # starts the HTTP API server on PORT (default
|
|
22
|
+
* # starts the HTTP API server on PORT (default 8080)
|
|
23
23
|
* TG_API_ID=12345 TG_API_HASH=abcdef... node check.js [sources] [options]
|
|
24
24
|
* # sources: any positional http(s) URL, a local file path, or stdin
|
|
25
25
|
* node check.js https://raw.githubusercontent.com/u/r/main/list.txt
|
|
@@ -726,7 +726,7 @@ async function startServer(opts = {}) {
|
|
|
726
726
|
const apiHash = opts.apiHash ?? process.env.TG_API_HASH
|
|
727
727
|
const user = opts.user ?? process.env.CHECK_AUTH_USER
|
|
728
728
|
const password = opts.password ?? process.env.CHECK_AUTH_PASSWORD
|
|
729
|
-
const port = opts.port ?? parseInt(process.env.PORT || '
|
|
729
|
+
const port = opts.port ?? parseInt(process.env.PORT || '8080', 10)
|
|
730
730
|
|
|
731
731
|
if (!apiId || !apiHash) throw new Error('Set TG_API_ID and TG_API_HASH (get them at https://my.telegram.org).')
|
|
732
732
|
if (!user || !password) throw new Error('Set CHECK_AUTH_USER and CHECK_AUTH_PASSWORD for HTTP Basic auth.')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mtproto-checker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Check Telegram MTProto proxies via a real TDLib handshake (testProxy), like tdesktop does",
|
|
5
5
|
"main": "check.js",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/Tar4s/mtproto-checker#readme",
|
|
17
17
|
"bin": {
|
|
18
|
-
"
|
|
18
|
+
"mtproto-checker": "check.js"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"check.js",
|