bdy 1.17.7-dev → 1.17.9-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.
package/distTs/package.json
CHANGED
|
@@ -68,7 +68,7 @@ class Agent extends events_1.default {
|
|
|
68
68
|
else {
|
|
69
69
|
logger_1.default.debug('Socket fetch tunnel after sync push');
|
|
70
70
|
if (this.socket) {
|
|
71
|
-
this.socket.fetch(!this.disabled, null, null, false, []);
|
|
71
|
+
this.socket.fetch(!this.disabled, null, null, false, [], false, 1000);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -99,7 +99,7 @@ class Agent extends events_1.default {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
if (shouldFetch && this.socket) {
|
|
102
|
-
this.socket.fetch(!this.disabled, null, null, false, []);
|
|
102
|
+
this.socket.fetch(!this.disabled, null, null, false, [], false, 1000);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -115,7 +115,8 @@ class Agent extends events_1.default {
|
|
|
115
115
|
try {
|
|
116
116
|
if (data.agent.action)
|
|
117
117
|
await this.makeAction(data.agent.action);
|
|
118
|
-
|
|
118
|
+
const filtered = (data.tunnels || []).filter((t) => !!t.domain);
|
|
119
|
+
this.refreshTunnels(filtered);
|
|
119
120
|
}
|
|
120
121
|
catch (err) {
|
|
121
122
|
logger_1.default.error('Fetch error');
|
|
@@ -224,47 +225,39 @@ class Agent extends events_1.default {
|
|
|
224
225
|
if (this.tunnelsUpdating)
|
|
225
226
|
return;
|
|
226
227
|
this.tunnelsUpdating = true;
|
|
227
|
-
let hasTunnels = false;
|
|
228
|
-
let haveTunnels = false;
|
|
229
228
|
try {
|
|
230
229
|
const tt = [...this.tunnels];
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
sshHostKey
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
else if (tunnel.hasChanged(data)) {
|
|
258
|
-
tunnel.recreate(data);
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
}
|
|
230
|
+
tt.forEach((tunnel) => {
|
|
231
|
+
if (!tunnels.find((t) => t.id === tunnel.id)) {
|
|
232
|
+
this.destroyTunnel(tunnel.id);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
tunnels.forEach((data) => {
|
|
236
|
+
let sshHostKey;
|
|
237
|
+
if (this.manager)
|
|
238
|
+
sshHostKey = this.manager.sshHostKey;
|
|
239
|
+
const tunnel = tt.find((tunnel) => data.id === tunnel.id);
|
|
240
|
+
if (!tunnel) {
|
|
241
|
+
this.addTunnel(new tunnel_1.default({
|
|
242
|
+
...data,
|
|
243
|
+
sshHostKey,
|
|
244
|
+
agent: {
|
|
245
|
+
id: this.id,
|
|
246
|
+
host: this.host,
|
|
247
|
+
token: this.token,
|
|
248
|
+
},
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
251
|
+
else if (tunnel.hasChanged(data)) {
|
|
252
|
+
tunnel.recreate(data);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
262
255
|
}
|
|
263
256
|
catch {
|
|
264
257
|
// do nothing
|
|
265
258
|
}
|
|
266
259
|
this.tunnelsUpdating = false;
|
|
267
|
-
if (!this.service &&
|
|
260
|
+
if (!this.service && !tunnels.length) {
|
|
268
261
|
output_1.default.exitError(texts_1.ERR_TUNNEL_REMOVED);
|
|
269
262
|
}
|
|
270
263
|
}
|
|
@@ -29,19 +29,21 @@ class AgentSocketClient extends events_1.default {
|
|
|
29
29
|
logger_1.default.debug(data);
|
|
30
30
|
this.socket.emit(msg, data);
|
|
31
31
|
}
|
|
32
|
-
fetch(activate = true, action = null, disabled = null, resetFirstHeard = false, tunnels, forceThrough = false) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
fetch(activate = true, action = null, disabled = null, resetFirstHeard = false, tunnels, forceThrough = false, timeout = 0) {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
this.socketEmit('fetchTunnelAgent', {
|
|
35
|
+
id: this.id,
|
|
36
|
+
token: this.token,
|
|
37
|
+
hostname: this.hostname,
|
|
38
|
+
platform: this.platform,
|
|
39
|
+
version: this.version,
|
|
40
|
+
activate,
|
|
41
|
+
action,
|
|
42
|
+
disabled,
|
|
43
|
+
resetFirstHeard,
|
|
44
|
+
tunnels,
|
|
45
|
+
}, forceThrough);
|
|
46
|
+
}, timeout);
|
|
45
47
|
}
|
|
46
48
|
update(activate, tunnels, force = false) {
|
|
47
49
|
const now = Date.now();
|
|
@@ -64,16 +64,19 @@ const installService = async (options) => {
|
|
|
64
64
|
if (!isSupported) {
|
|
65
65
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_SUPPORTED);
|
|
66
66
|
}
|
|
67
|
-
const { token, host } = await input_1.default.tunnelToken(options.token);
|
|
68
67
|
let id = '';
|
|
69
68
|
let agentToken = '';
|
|
70
|
-
let
|
|
69
|
+
let addToken = options.token;
|
|
70
|
+
if (options.id && addToken) {
|
|
71
|
+
id = options.id;
|
|
72
|
+
agentToken = addToken;
|
|
73
|
+
addToken = '';
|
|
74
|
+
}
|
|
75
|
+
const { token, host } = await input_1.default.tunnelToken(addToken);
|
|
71
76
|
const port = input_1.default.port(options.port);
|
|
72
77
|
const target = !!options.target;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
id = options.id;
|
|
76
|
-
agentToken = options.agentToken;
|
|
78
|
+
let agent;
|
|
79
|
+
if (id) {
|
|
77
80
|
try {
|
|
78
81
|
agent = await buddy_1.default.fetchAgent(id, host, agentToken);
|
|
79
82
|
}
|
|
@@ -138,12 +141,14 @@ const installApp = async (options) => {
|
|
|
138
141
|
}
|
|
139
142
|
let id;
|
|
140
143
|
let agentToken;
|
|
144
|
+
let addToken = options.token;
|
|
141
145
|
const port = input_1.default.port(options.port);
|
|
142
|
-
if (options.id &&
|
|
146
|
+
if (options.id && addToken) {
|
|
143
147
|
id = options.id;
|
|
144
|
-
agentToken =
|
|
148
|
+
agentToken = addToken;
|
|
149
|
+
addToken = '';
|
|
145
150
|
}
|
|
146
|
-
const { token, host } = await input_1.default.tunnelToken(
|
|
151
|
+
const { token, host } = await input_1.default.tunnelToken(addToken);
|
|
147
152
|
if (!id) {
|
|
148
153
|
const tags = prepareTags(options.tag);
|
|
149
154
|
try {
|
|
@@ -200,8 +205,7 @@ const installApp = async (options) => {
|
|
|
200
205
|
const commandAgentInstall = (0, utils_1.newCommand)('install', texts_1.DESC_COMMAND_AGENT_INSTALL);
|
|
201
206
|
commandAgentInstall.option('-s, --start [true|false]', texts_1.OPTION_AGENT_START, 'true');
|
|
202
207
|
commandAgentInstall.option('-i, --id <id>', texts_1.OPTION_AGENT_ID);
|
|
203
|
-
commandAgentInstall.option('--
|
|
204
|
-
commandAgentInstall.option('-t, --token <token>', texts_1.OPTION_TOKEN);
|
|
208
|
+
commandAgentInstall.option('-t, --token <token>', texts_1.OPTION_AGENT_TOKEN);
|
|
205
209
|
commandAgentInstall.option('-p, --port <port>', texts_1.OPTION_AGENT_PORT, '7456');
|
|
206
210
|
commandAgentInstall.option('-u, --user <user>', texts_1.OPTION_USER);
|
|
207
211
|
commandAgentInstall.option('-a,--app', texts_1.OPTION_APP);
|
|
@@ -21,7 +21,7 @@ commandSandboxList.action(async (options) => {
|
|
|
21
21
|
output_1.default.exitNormal('No sandboxes found');
|
|
22
22
|
}
|
|
23
23
|
const data = [
|
|
24
|
-
['NAME', 'STATUS', '
|
|
24
|
+
['NAME', 'STATUS', 'SETUP_STATUS', 'ID', 'IDENTIFIER', 'URL'],
|
|
25
25
|
];
|
|
26
26
|
for (const sandbox of sandboxes) {
|
|
27
27
|
data.push([
|
package/distTs/src/texts.js
CHANGED
|
@@ -361,7 +361,7 @@ exports.OPTION_NAME = 'Name of the tunnel';
|
|
|
361
361
|
exports.OPTION_ID = 'Id of the tunnel';
|
|
362
362
|
exports.OPTION_AGENT_ID = 'Start existing agent';
|
|
363
363
|
exports.OPTION_AGENT_START = 'Start agent right away';
|
|
364
|
-
exports.OPTION_AGENT_TOKEN = '
|
|
364
|
+
exports.OPTION_AGENT_TOKEN = 'token to authorize existing agent agent or token to add a new agent';
|
|
365
365
|
exports.OPTION_USER = 'OS user name. Default: root (macOS/Linux), LocalSystem (Windows. Provide as DOMAIN\\USER (use `whoami` to get full username)';
|
|
366
366
|
exports.OPTION_APP = 'Starts bdy agent as standalone process';
|
|
367
367
|
exports.OPTION_PASS = 'Password of the user. Only set for Windows';
|