bdy 1.17.24-dev → 1.17.26-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 +2 -1
- package/distTs/src/agent/agent.js +59 -21
- package/distTs/src/agent/manager.js +100 -8
- package/distTs/src/command/agent/install.js +6 -2
- package/distTs/src/command/agent/proxy/disable.js +27 -0
- package/distTs/src/command/agent/proxy/enable.js +27 -0
- package/distTs/src/command/agent/proxy/status.js +32 -0
- package/distTs/src/command/agent/proxy.js +15 -0
- package/distTs/src/command/agent/status.js +19 -5
- package/distTs/src/command/agent/tunnel/disable.js +27 -0
- package/distTs/src/command/agent/tunnel/enable.js +27 -0
- package/distTs/src/command/agent/tunnel/status.js +11 -1
- package/distTs/src/command/agent/tunnel.js +4 -0
- package/distTs/src/command/agent.js +2 -0
- package/distTs/src/command/login.js +3 -0
- package/distTs/src/command/project/link.js +2 -7
- package/distTs/src/command/tunnel/http.js +1 -1
- package/distTs/src/command/tunnel/start.js +1 -1
- package/distTs/src/command/tunnel/tcp.js +1 -1
- package/distTs/src/command/tunnel/tls.js +1 -1
- package/distTs/src/output.js +118 -89
- package/distTs/src/texts.js +30 -13
- package/distTs/src/tunnel/api/agent.js +18 -0
- package/distTs/src/tunnel/api/buddy.js +35 -3
- package/package.json +2 -1
|
@@ -59,7 +59,7 @@ const makeRequest = async (host, path, body, method = 'POST', respAsJson = true,
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
class ApiBuddyClass {
|
|
62
|
-
async register(service, target, host, token, tags, onDefaultRegion) {
|
|
62
|
+
async register(service, target, tunneling, proxy, host, token, tags, onDefaultRegion) {
|
|
63
63
|
const version = (0, utils_1.getVersion)();
|
|
64
64
|
const hostname = (0, utils_1.getHostname)();
|
|
65
65
|
const platform = (0, utils_1.getPlatform)();
|
|
@@ -72,12 +72,14 @@ class ApiBuddyClass {
|
|
|
72
72
|
service,
|
|
73
73
|
tags,
|
|
74
74
|
target,
|
|
75
|
+
tunneling,
|
|
76
|
+
proxy
|
|
75
77
|
});
|
|
76
78
|
logger_1.default.info((0, texts_1.LOG_AGENT_REGISTERED)(r.id));
|
|
77
79
|
logger_1.default.info((0, texts_1.LOG_REGION_DETECTED)(r.region));
|
|
78
80
|
if (onDefaultRegion)
|
|
79
81
|
onDefaultRegion(r.region);
|
|
80
|
-
return new agent_1.default(r.id, host, r.token, service, target, r.tags || [], this, false);
|
|
82
|
+
return new agent_1.default(r.id, host, r.token, service, target, tunneling, proxy, r.tags || [], this, false);
|
|
81
83
|
}
|
|
82
84
|
async unregister(id, host, token) {
|
|
83
85
|
logger_1.default.info(texts_1.LOG_UNREGISTERING_AGENT);
|
|
@@ -93,7 +95,9 @@ class ApiBuddyClass {
|
|
|
93
95
|
token,
|
|
94
96
|
id,
|
|
95
97
|
});
|
|
96
|
-
|
|
98
|
+
const tunneling = typeof (r.tunneling) === 'boolean' ? r.tunneling : true;
|
|
99
|
+
const proxy = typeof (r.proxy) === 'boolean' ? r.proxy : false;
|
|
100
|
+
return new agent_1.default(r.id, host, token, !!r.service, !!r.target, tunneling, proxy, r.tags || [], this, !!r.disabled);
|
|
97
101
|
}
|
|
98
102
|
async fetchAgentKeys(id, host, token) {
|
|
99
103
|
return await makeRequest(host, '/tunnel/agent/fetch/keys', {
|
|
@@ -108,6 +112,20 @@ class ApiBuddyClass {
|
|
|
108
112
|
token,
|
|
109
113
|
});
|
|
110
114
|
}
|
|
115
|
+
async disableTunneling(agentId, host, token) {
|
|
116
|
+
logger_1.default.info(texts_1.LOG_DISABLING_AGENT_TUNNELING);
|
|
117
|
+
await makeRequest(host, '/tunnel/agent/tunneling/disable', {
|
|
118
|
+
agentId,
|
|
119
|
+
token,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async disableProxy(agentId, host, token) {
|
|
123
|
+
logger_1.default.info(texts_1.LOG_DISABLING_AGENT_PROXY);
|
|
124
|
+
await makeRequest(host, '/tunnel/agent/proxy/disable', {
|
|
125
|
+
agentId,
|
|
126
|
+
token,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
111
129
|
async enableTarget(agentId, host, token) {
|
|
112
130
|
logger_1.default.info(texts_1.LOG_ENABLING_AGENT_TARGET);
|
|
113
131
|
await makeRequest(host, '/tunnel/agent/target/enable', {
|
|
@@ -115,6 +133,20 @@ class ApiBuddyClass {
|
|
|
115
133
|
token,
|
|
116
134
|
});
|
|
117
135
|
}
|
|
136
|
+
async enableTunneling(agentId, host, token) {
|
|
137
|
+
logger_1.default.info(texts_1.LOG_ENABLING_AGENT_TUNNELING);
|
|
138
|
+
await makeRequest(host, '/tunnel/agent/tunneling/enable', {
|
|
139
|
+
agentId,
|
|
140
|
+
token,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async enableProxy(agentId, host, token) {
|
|
144
|
+
logger_1.default.info(texts_1.LOG_ENABLING_AGENT_PROXY);
|
|
145
|
+
await makeRequest(host, '/tunnel/agent/proxy/enable', {
|
|
146
|
+
agentId,
|
|
147
|
+
token,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
118
150
|
async markAgentAsInactive(agentId, host, token) {
|
|
119
151
|
await makeRequest(host, '/tunnel/agent/target/mark-inactive', {
|
|
120
152
|
agentId,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.17.
|
|
4
|
+
"version": "1.17.26-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@scalar/types": "0.5.10",
|
|
48
48
|
"@scalar/openapi-types": "0.5.3",
|
|
49
49
|
"fastify": "4.29.1",
|
|
50
|
+
"@inquirer/prompts": "8.2.0",
|
|
50
51
|
"fdir": "6.5.0",
|
|
51
52
|
"open": "11.0.0",
|
|
52
53
|
"fflate": "0.8.2",
|