bdy 1.7.60-dev → 1.8.3-dev

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.
Files changed (95) hide show
  1. package/package.json +42 -11
  2. package/.eslintrc.yml +0 -23
  3. package/bin/cli.js +0 -5
  4. package/dockerfile +0 -15
  5. package/link.sh +0 -3
  6. package/src/agent/linux.js +0 -127
  7. package/src/agent/manager.js +0 -404
  8. package/src/agent/osx.js +0 -150
  9. package/src/agent/socket/tunnel.js +0 -232
  10. package/src/agent/socket.js +0 -260
  11. package/src/agent/system.js +0 -205
  12. package/src/agent/wait.js +0 -20
  13. package/src/agent/windows.js +0 -168
  14. package/src/agent.js +0 -256
  15. package/src/api/agent.js +0 -95
  16. package/src/api/buddy.js +0 -131
  17. package/src/api/socket.js +0 -148
  18. package/src/cfg.js +0 -239
  19. package/src/command/agent/install.js +0 -116
  20. package/src/command/agent/restart.js +0 -27
  21. package/src/command/agent/run.js +0 -16
  22. package/src/command/agent/start.js +0 -27
  23. package/src/command/agent/status.js +0 -44
  24. package/src/command/agent/stop.js +0 -27
  25. package/src/command/agent/tunnel/http.js +0 -45
  26. package/src/command/agent/tunnel/list.js +0 -26
  27. package/src/command/agent/tunnel/remove.js +0 -29
  28. package/src/command/agent/tunnel/start.js +0 -37
  29. package/src/command/agent/tunnel/status.js +0 -31
  30. package/src/command/agent/tunnel/tcp.js +0 -45
  31. package/src/command/agent/tunnel/tls.js +0 -45
  32. package/src/command/agent/tunnel.js +0 -20
  33. package/src/command/agent/uninstall.js +0 -36
  34. package/src/command/agent/update.js +0 -42
  35. package/src/command/agent/version.js +0 -22
  36. package/src/command/agent.js +0 -26
  37. package/src/command/config/add/http.js +0 -31
  38. package/src/command/config/add/tcp.js +0 -31
  39. package/src/command/config/add/tls.js +0 -31
  40. package/src/command/config/add.js +0 -12
  41. package/src/command/config/get/region.js +0 -12
  42. package/src/command/config/get/timeout.js +0 -12
  43. package/src/command/config/get/token.js +0 -12
  44. package/src/command/config/get/tunnel.js +0 -20
  45. package/src/command/config/get/tunnels.js +0 -12
  46. package/src/command/config/get/whitelist.js +0 -12
  47. package/src/command/config/get.js +0 -18
  48. package/src/command/config/remove/tunnel.js +0 -21
  49. package/src/command/config/remove.js +0 -8
  50. package/src/command/config/set/region.js +0 -18
  51. package/src/command/config/set/timeout.js +0 -21
  52. package/src/command/config/set/token.js +0 -18
  53. package/src/command/config/set/whitelist.js +0 -18
  54. package/src/command/config/set.js +0 -14
  55. package/src/command/config.js +0 -14
  56. package/src/command/http.js +0 -33
  57. package/src/command/pre.js +0 -45
  58. package/src/command/start.js +0 -30
  59. package/src/command/tcp.js +0 -31
  60. package/src/command/tls.js +0 -31
  61. package/src/command/version.js +0 -10
  62. package/src/format.js +0 -171
  63. package/src/index.js +0 -38
  64. package/src/input.js +0 -283
  65. package/src/logger.js +0 -92
  66. package/src/output/interactive/tunnel.js +0 -871
  67. package/src/output/noninteractive/agent/tunnels.js +0 -32
  68. package/src/output/noninteractive/config/tunnel.js +0 -51
  69. package/src/output/noninteractive/config/tunnels.js +0 -19
  70. package/src/output/noninteractive/tunnel.js +0 -79
  71. package/src/output.js +0 -131
  72. package/src/server/cert.js +0 -51
  73. package/src/server/http1.js +0 -79
  74. package/src/server/http2.js +0 -79
  75. package/src/server/sftp.js +0 -474
  76. package/src/server/ssh.js +0 -107
  77. package/src/server/tls.js +0 -41
  78. package/src/ssh/client.js +0 -204
  79. package/src/texts.js +0 -445
  80. package/src/tunnel/agent.js +0 -100
  81. package/src/tunnel/compression.js +0 -32
  82. package/src/tunnel/dns.js +0 -55
  83. package/src/tunnel/html/404.html +0 -129
  84. package/src/tunnel/html/503.html +0 -136
  85. package/src/tunnel/html.js +0 -32
  86. package/src/tunnel/http/log.js +0 -204
  87. package/src/tunnel/http/serve.js +0 -127
  88. package/src/tunnel/http/stream.js +0 -47
  89. package/src/tunnel/http.js +0 -406
  90. package/src/tunnel/identification.js +0 -95
  91. package/src/tunnel/latency.js +0 -69
  92. package/src/tunnel/tcp.js +0 -85
  93. package/src/tunnel.js +0 -713
  94. package/src/utils.js +0 -577
  95. package/unlink.sh +0 -3
package/src/format.js DELETED
@@ -1,171 +0,0 @@
1
- const {
2
- TLS_TERMINATE_AT_AGENT,
3
- TLS_TERMINATE_AT_REGION,
4
- TUNNEL_HTTP,
5
- TARGET_ONLY_PORT_REGEX,
6
- TARGET_HTTP_REGEX,
7
- TARGET_TCP_TLS_REGEX,
8
- TUNNEL_TCP,
9
- TUNNEL_TLS,
10
- TUNNEL_IDENTIFIED_HTTP1
11
- } = require('./utils');
12
-
13
- class Format {
14
- static date() {
15
- const dt = new Date();
16
- return dt.toISOString();
17
- }
18
-
19
- static token(token) {
20
- if (!token || token.length < 6) return 'Not provided';
21
- return token.substring(0, 3) + '...' + token.substring(token.length - 3);
22
- }
23
-
24
- static region(region) {
25
- if (!region) return 'Autodetect';
26
- return region.toUpperCase();
27
- }
28
-
29
- static timeout(timeout) {
30
- if (timeout === 1) return '1 second';
31
- return `${timeout} seconds`;
32
- }
33
-
34
- static tunnelTimeout(timeout) {
35
- if (!timeout) return 'Default';
36
- return this.timeout(timeout);
37
- }
38
-
39
- static whitelist(whitelist) {
40
- if (!whitelist || !whitelist.length) return 'Everyone';
41
- if (whitelist.includes('*')) return 'Everyone';
42
- return whitelist.join('\n');
43
- }
44
-
45
- static tunnelWhitelist(whitelist) {
46
- if (!whitelist) return 'Default';
47
- return this.whitelist(whitelist);
48
- }
49
-
50
- static tunnelHeaders(headers) {
51
- if (!headers || !headers.length) return 'Not set';
52
- return headers.map((h) => `${h.name}: ${h.value}`).join('\n');
53
- }
54
-
55
- static tunnelCircuitBreaker(cb) {
56
- if (cb === undefined || cb === null) return 'Not set';
57
- return String(cb);
58
- }
59
-
60
- static tunnelUserAgent(userAgents) {
61
- if (!userAgents || !userAgents.length) return 'Everyone';
62
- return userAgents.join('\n');
63
- }
64
-
65
- static tunnelDomain(domain) {
66
- if (!domain) return 'Default';
67
- return domain;
68
- }
69
-
70
- static type(type) {
71
- return type.toUpperCase();
72
- }
73
-
74
- static tunnelRegion(region) {
75
- if (!region) return 'Default';
76
- return this.region(region);
77
- }
78
-
79
- static identify(identifyType) {
80
- if (identifyType === TUNNEL_IDENTIFIED_HTTP1) return 'Ver. 1.1';
81
- return 'Ver. 2';
82
- }
83
-
84
- static terminate(terminate) {
85
- if (terminate === TLS_TERMINATE_AT_AGENT) return 'AGENT';
86
- if (terminate === TLS_TERMINATE_AT_REGION) return 'REGION';
87
- return 'TARGET';
88
- }
89
-
90
- static serve(serve) {
91
- return serve;
92
- }
93
-
94
- static hostHeader(host) {
95
- if (!host) return 'Not set';
96
- return host;
97
- }
98
-
99
- static basicAuth(login, pass) {
100
- if (!login || !pass) return 'Not set';
101
- return `${login}:${pass}`;
102
- }
103
-
104
- static latency(latency) {
105
- if (latency < 0) return 'Unreachable';
106
- if (latency < 1000) return `${latency.toFixed(0)}ms`;
107
- return `${(latency / 1000).toFixed(0)}s`;
108
- }
109
-
110
- static yesNo(val) {
111
- if (!val) return 'No';
112
- return 'Yes';
113
- }
114
-
115
- static entryHost(tunnel) {
116
- let host = '';
117
- host += tunnel.subdomain;
118
- host += '.';
119
- // todo custom domain
120
- host += tunnel.region.toLowerCase();
121
- host += '-';
122
- host += tunnel.sshId;
123
- host += '.';
124
- host += tunnel.domain;
125
- return host;
126
- }
127
-
128
- static entry(tunnel) {
129
- let entry = '';
130
- if (tunnel.type === TUNNEL_HTTP) entry += 'https://';
131
- entry += this.entryHost(tunnel);
132
- if (tunnel.type === TUNNEL_TCP) entry += `:${tunnel.sshForwardPort}`;
133
- else if (tunnel.type === TUNNEL_TLS) entry += ':443';
134
- return entry;
135
- }
136
-
137
- static target(type, target) {
138
- if (type === TUNNEL_HTTP) {
139
- let port = '80';
140
- let host = 'localhost';
141
- let proto = 'http';
142
- let m = target.match(TARGET_ONLY_PORT_REGEX);
143
- if (m) {
144
- port = m[0];
145
- } else {
146
- m = target.match(TARGET_HTTP_REGEX);
147
- if (m) {
148
- if (m[2]) proto = m[2];
149
- if (m[4]) host = m[4];
150
- if (m[6]) port = m[6];
151
- else if (proto === 'https') port = '443';
152
- }
153
- }
154
- let t = `${proto}://${host}`;
155
- if (proto === 'http' && port !== '80') t += `:${port}`;
156
- else if (proto === 'https' && port !== '443') t += `:${port}`;
157
- return t;
158
- } else {
159
- let host = 'localhost';
160
- let port = '80';
161
- const m = target.match(TARGET_TCP_TLS_REGEX);
162
- if (m) {
163
- if (m[3]) port = m[3];
164
- if (m[2]) host = m[2];
165
- }
166
- return `${host}:${port}`;
167
- }
168
- }
169
- }
170
-
171
- module.exports = Format;
package/src/index.js DELETED
@@ -1,38 +0,0 @@
1
- const commandConfig = require('./command/config.js');
2
- const Output = require('./output.js');
3
- const commandTcp = require('./command/tcp.js');
4
- const commandTls = require('./command/tls.js');
5
- const commandHttp = require('./command/http.js');
6
- const commandStart = require('./command/start.js');
7
- const commandAgent = require('./command/agent.js');
8
- const logger = require('./logger.js');
9
- const commandVersion = require('./command/version.js');
10
- const commandPre = require('./command/pre.js');
11
- const stream = require('stream');
12
- const { isDocker,
13
- formatHelp,
14
- newCommand
15
- } = require('./utils');
16
- const { DESC_PROGRAM } = require('./texts');
17
-
18
- stream.setDefaultHighWaterMark(false, 67108864);
19
- process.title = 'bdy';
20
- process.on('uncaughtException', (err) => {
21
- logger.fatal(err);
22
- Output.exitError(err);
23
- });
24
-
25
- const program = newCommand(null, DESC_PROGRAM);
26
- program.hook('preAction', commandPre);
27
- program.configureHelp({
28
- formatHelp: formatHelp
29
- });
30
- program.addCommand(commandConfig);
31
- program.addCommand(commandTcp);
32
- program.addCommand(commandTls);
33
- program.addCommand(commandHttp);
34
- program.addCommand(commandStart);
35
- if (!isDocker()) program.addCommand(commandAgent);
36
- program.addCommand(commandVersion);
37
-
38
- program.parse();
package/src/input.js DELETED
@@ -1,283 +0,0 @@
1
- const Output = require('./output.js');
2
- const netmask = require('netmask');
3
- const fs = require('fs');
4
- const { statSync } = require('fs');
5
- const tls = require('tls');
6
- const crypto = require('crypto');
7
- const {
8
- isStringRegExp,
9
- REGION_EU,
10
- REGION_US,
11
- TARGET_HTTP_REGEX,
12
- TARGET_ONLY_PORT_REGEX,
13
- TARGET_TCP_TLS_REGEX,
14
- TLS_TERMINATE_AT_AGENT,
15
- TLS_TERMINATE_AT_REGION,
16
- TLS_TERMINATE_AT_TARGET,
17
- TUNNEL_HTTP,
18
- TUNNEL_TCP,
19
- TUNNEL_TLS
20
- } = require('./utils.js');
21
- const {
22
- ERR_BA_IS_NOT_VALID,
23
- ERR_BA_LOGIN_NOT_PROVIDED,
24
- ERR_BA_PASSWORD_NOT_PROVIDED,
25
- ERR_CA_PATH_IS_NOT_VALID,
26
- ERR_CB_THRESHOLD_IS_NOT_VALID,
27
- ERR_CERT_PATH_IS_NOT_VALID,
28
- ERR_DIRECTORY_DOES_NOT_EXISTS,
29
- ERR_DOMAIN_IS_NOT_VALID,
30
- ERR_KEY_PATH_IS_NOT_VALID,
31
- ERR_NAME_WITHOUT_ASTERISK,
32
- ERR_PATH_IS_NOT_DIRECTORY,
33
- ERR_PORT_IS_NOT_VALID,
34
- ERR_REGION_IS_NOT_VALID,
35
- ERR_SUBDOMAIN_IS_NOT_VALID,
36
- ERR_SUBDOMAIN_IS_TOO_LONG,
37
- ERR_SUBDOMAIN_IS_TOO_SHORT,
38
- ERR_TARGET_IS_NOT_VALID,
39
- ERR_TERMINATE_IS_NOT_VALID,
40
- ERR_TIMEOUT_IS_NOT_VALID,
41
- ERR_TYPE_IS_NOT_VALID,
42
- ERR_USER_AGENT_IS_NOT_VALID,
43
- ERR_WHITELIST_IS_NOT_VALID,
44
- ERR_WRONG_CA,
45
- ERR_WRONG_KEY_CERT
46
- } = require('./texts.js');
47
-
48
- class Input {
49
- static timeout(timeout) {
50
- const t = parseInt(timeout, 10);
51
- if (isNaN(t) || t <= 0 || t > 999) {
52
- Output.exitError(ERR_TIMEOUT_IS_NOT_VALID(timeout));
53
- }
54
- return t;
55
- }
56
-
57
- static serve(serve) {
58
- if (!serve) return serve;
59
- try {
60
- const info = statSync(serve);
61
- if (!info.isDirectory()) {
62
- Output.exitError(ERR_PATH_IS_NOT_DIRECTORY(serve));
63
- }
64
- } catch (err) {
65
- Output.exitError(ERR_DIRECTORY_DOES_NOT_EXISTS(serve));
66
- }
67
- return serve;
68
- }
69
-
70
- static circuitBreaker(threshold) {
71
- if (threshold === undefined) return null;
72
- const n = parseFloat(threshold);
73
- if (isNaN(n) || n < 0 || n > 1) {
74
- Output.exitError(ERR_CB_THRESHOLD_IS_NOT_VALID(n));
75
- }
76
- return n;
77
- }
78
-
79
- static headers(headers) {
80
- const r = [];
81
- (headers || []).forEach((h) => {
82
- if (!h) return;
83
- const s = h.split(':');
84
- if (s.length !== 2) return;
85
- r.push({
86
- name: s[0],
87
- value: s[1]
88
- });
89
- });
90
- return r;
91
- }
92
-
93
- static subdomain(subdomain) {
94
- if (!/^[a-z0-9-]+$/i.test(subdomain)) {
95
- Output.exitError(ERR_SUBDOMAIN_IS_NOT_VALID(subdomain));
96
- }
97
- if (subdomain.length < 5) {
98
- Output.exitError(ERR_SUBDOMAIN_IS_TOO_SHORT(subdomain));
99
- }
100
- if (subdomain.length > 63) {
101
- Output.exitError(ERR_SUBDOMAIN_IS_TOO_LONG(subdomain));
102
- }
103
- return subdomain;
104
- }
105
-
106
- static domain(domain) {
107
- if (!/^(?:[A-z0-9](?:[A-z0-9-]{0,61}[A-z0-9])?\.)+[A-z0-9][A-z0-9-]{0,61}[A-z0-9]$/i.test(domain)) {
108
- Output.exitError(ERR_DOMAIN_IS_NOT_VALID(domain));
109
- }
110
- return domain;
111
- }
112
-
113
- static auth(auth) {
114
- const s = auth.split(':');
115
- if (s.length !== 2) {
116
- Output.exitError(ERR_BA_IS_NOT_VALID(auth));
117
- }
118
- if (!s[0]) {
119
- Output.exitError(ERR_BA_LOGIN_NOT_PROVIDED);
120
- }
121
- if (!s[1]) {
122
- Output.exitError(ERR_BA_PASSWORD_NOT_PROVIDED);
123
- }
124
- return {
125
- login: s[0],
126
- password: s[1]
127
- };
128
- }
129
-
130
- static useragents(useragents) {
131
- if (!useragents || !useragents.length) return [];
132
- useragents.forEach((ua) => {
133
- if (isStringRegExp(ua)) {
134
- try {
135
- new RegExp(ua);
136
- } catch (err) {
137
- Output.exitError(ERR_USER_AGENT_IS_NOT_VALID(ua));
138
- }
139
- }
140
- });
141
- return useragents;
142
- }
143
-
144
- static whitelist(whitelist) {
145
- if (!whitelist || !whitelist.length) return [];
146
- for (let i = 0; i < whitelist.length; i += 1) {
147
- const wh = whitelist[i];
148
- if (wh === '*') return ['*'];
149
- try {
150
- new netmask.Netmask(wh);
151
- } catch (err) {
152
- Output.exitError(ERR_WHITELIST_IS_NOT_VALID(wh));
153
- }
154
- }
155
- return whitelist;
156
- }
157
-
158
- static region(region) {
159
- if (!region) Output.exitError(ERR_REGION_IS_NOT_VALID(''));
160
- region = region.toUpperCase();
161
- if (![REGION_EU, REGION_US].includes(region)) {
162
- Output.exitError(ERR_REGION_IS_NOT_VALID(region));
163
- }
164
- return region;
165
- }
166
-
167
- static terminate(terminate) {
168
- if (!terminate) return TLS_TERMINATE_AT_REGION;
169
- terminate = terminate.toUpperCase();
170
- if (![TLS_TERMINATE_AT_AGENT, TLS_TERMINATE_AT_REGION, TLS_TERMINATE_AT_TARGET].includes(terminate)) {
171
- Output.exitError(ERR_TERMINATE_IS_NOT_VALID(terminate));
172
- }
173
- return terminate;
174
- }
175
-
176
- static target(target, type) {
177
- if (!target) return '80';
178
- if (target.length > 200) {
179
- Output.exitError(ERR_TARGET_IS_NOT_VALID(target));
180
- }
181
- target = target.toLowerCase();
182
- // 80
183
- // localhost
184
- // localhost:80
185
- // http://localhost:80
186
- // http://localhost
187
- // http://user:pass@localhost
188
- // http://user:pass@localhost:80
189
- let port;
190
- if ([TUNNEL_TCP, TUNNEL_TLS].includes(type)) {
191
- const m = target.match(TARGET_TCP_TLS_REGEX);
192
- if (!m) {
193
- Output.exitError(ERR_TARGET_IS_NOT_VALID(target));
194
- }
195
- port = m[3];
196
- } else {
197
- let m = target.match(TARGET_ONLY_PORT_REGEX);
198
- if (m) {
199
- port = m[0];
200
- } else {
201
- m = target.match(TARGET_HTTP_REGEX);
202
- if (!m) {
203
- Output.exitError(ERR_TARGET_IS_NOT_VALID(target));
204
- } else {
205
- let proto;
206
- if (m[2]) proto = m[2];
207
- else proto = 'http';
208
- if (m[6]) port = m[6];
209
- else if (proto === 'https') port = '443';
210
- else port = '80';
211
- }
212
- }
213
- }
214
- Input.port(port);
215
- return target;
216
- }
217
-
218
- static port(port) {
219
- const p = parseInt(port, 10);
220
- if (isNaN(p) || p <= 0 || p > 65535) Output.exitError(ERR_PORT_IS_NOT_VALID(port));
221
- return p;
222
- }
223
-
224
- static type(type) {
225
- if (!type) return TUNNEL_TCP;
226
- type = type.toUpperCase();
227
- if (![TUNNEL_TCP, TUNNEL_TLS, TUNNEL_HTTP].includes(type)) {
228
- Output.exitError(ERR_TYPE_IS_NOT_VALID(type));
229
- }
230
- return type;
231
- }
232
-
233
- static name(name) {
234
- if (name.includes('*')) {
235
- Output.exitError(ERR_NAME_WITHOUT_ASTERISK);
236
- }
237
- return name;
238
- }
239
-
240
- static ca(caPath) {
241
- let cert;
242
- try {
243
- cert = fs.readFileSync(caPath, 'utf8');
244
- } catch (err) {
245
- Output.exitError(ERR_CA_PATH_IS_NOT_VALID(caPath));
246
- }
247
- try {
248
- new crypto.X509Certificate(cert);
249
- } catch (err) {
250
- Output.exitError(ERR_WRONG_CA(caPath));
251
- }
252
- return cert;
253
- }
254
-
255
- static keyCert(keyPath, certPath) {
256
- let key;
257
- let cert;
258
- try {
259
- key = fs.readFileSync(keyPath, 'utf8');
260
- } catch (err) {
261
- Output.exitError(ERR_KEY_PATH_IS_NOT_VALID(keyPath));
262
- }
263
- try {
264
- cert = fs.readFileSync(certPath, 'utf8');
265
- } catch (err) {
266
- Output.exitError(ERR_CERT_PATH_IS_NOT_VALID(certPath));
267
- }
268
- try {
269
- tls.createSecureContext({
270
- cert,
271
- key
272
- });
273
- } catch (err) {
274
- Output.exitError(ERR_WRONG_KEY_CERT);
275
- }
276
- return {
277
- cert,
278
- key
279
- };
280
- }
281
- }
282
-
283
- module.exports = Input;
package/src/logger.js DELETED
@@ -1,92 +0,0 @@
1
- const pino = require('pino');
2
- const { resolve } = require('path');
3
- const fs = require('fs');
4
- const {
5
- getHomeDirectory,
6
- } = require('./utils.js');
7
-
8
- class Logger {
9
- rootPath = null;
10
- logPath = null;
11
- log1Path = null;
12
- logStream = null;
13
- p = null;
14
- ts = null;
15
- constructor() {
16
- this.rootPath = getHomeDirectory();
17
- }
18
- checkLogSize() {
19
- try {
20
- const s = fs.statSync(this.logPath);
21
- if (s.size > 5242880) {
22
- fs.copyFileSync(this.logPath, this.log1Path);
23
- fs.truncateSync(this.logPath);
24
- }
25
- } catch {
26
- // do nothing
27
- }
28
- }
29
- getPino() {
30
- if (!this.p) {
31
- this.logPath = resolve(this.rootPath, 'cli.log');
32
- this.log1Path = resolve(this.rootPath, 'cli.1.log');
33
- this.logStream = fs.openSync(this.logPath, 'w');
34
- try {
35
- fs.chmodSync(this.logPath, 0o666);
36
- } catch {
37
- // do nothing
38
- }
39
- this.p = pino({
40
- level: process.env.DEBUG === '1' ? 'debug' : 'info',
41
- timestamp: () => `, "time": "${new Date().toISOString()}"`,
42
- formatters: {
43
- bindings: () => ({}),
44
- level: (label) => ({
45
- level: label.toUpperCase()
46
- })
47
- }
48
- }, pino.destination(this.logStream));
49
- this.checkLogSize();
50
- this.ts = setInterval(() => {
51
- this.checkLogSize();
52
- }, 30000);
53
- }
54
- return this.p;
55
- }
56
- error(...args) {
57
- this.getPino().error(...args);
58
- }
59
- info(...args) {
60
- this.getPino().info(...args);
61
- }
62
- debug(...args){
63
- this.getPino().debug(...args);
64
- }
65
- fatal(...args){
66
- this.getPino().fatal(...args);
67
- }
68
-
69
- stack() {
70
- this.getPino().info(new Error().stack);
71
- }
72
-
73
- changeRootPath(path) {
74
- if (this.ts) {
75
- clearInterval(this.ts);
76
- this.ts = null;
77
- }
78
- if (this.logStream) {
79
- try {
80
- this.logStream.close();
81
- } catch {
82
- // do nothing
83
- }
84
- this.logStream = null;
85
- }
86
- this.p = null;
87
- this.rootPath = path;
88
-
89
- }
90
- }
91
-
92
- module.exports = new Logger();