bdy 1.25.28 → 1.25.29-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 +1 -1
- package/distTs/src/agent/agent.js +9 -4
- package/distTs/src/agent/manager.js +4 -2
- package/distTs/src/api/client.js +28 -1
- package/distTs/src/cliIndex.js +2 -0
- package/distTs/src/command/integration/add.js +71 -0
- package/distTs/src/command/integration/catalog.js +318 -0
- package/distTs/src/command/integration/delete.js +35 -0
- package/distTs/src/command/integration/get.js +57 -0
- package/distTs/src/command/integration/list.js +50 -0
- package/distTs/src/command/integration/scope.js +66 -0
- package/distTs/src/command/integration/types.js +35 -0
- package/distTs/src/command/integration.js +20 -0
- package/distTs/src/sshKeygen.js +11 -3
- package/distTs/src/texts.js +147 -29
- package/distTs/src/tunnel/tunnel.js +66 -56
- package/distTs/src/utils.js +1 -0
- package/package.json +1 -1
|
@@ -79,8 +79,9 @@ class Tunnel extends events_1.default {
|
|
|
79
79
|
inFlight = new Set();
|
|
80
80
|
constructor({ agent, id, sshHostKey, ...options }) {
|
|
81
81
|
super();
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const { createSshHostKey, isSshHostKeyValid } = require('../sshKeygen');
|
|
83
|
+
if (!isSshHostKeyValid(sshHostKey))
|
|
84
|
+
sshHostKey = createSshHostKey();
|
|
84
85
|
this.agent = agent;
|
|
85
86
|
this.id = id;
|
|
86
87
|
this.sshHostKey = sshHostKey;
|
|
@@ -593,60 +594,69 @@ class Tunnel extends events_1.default {
|
|
|
593
594
|
return;
|
|
594
595
|
this.started = true;
|
|
595
596
|
logger_1.default.info((0, texts_1.LOG_STARTING_TUNNEL)(this.id));
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
this.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
this.
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
597
|
+
try {
|
|
598
|
+
// region latency
|
|
599
|
+
this.regionLatency = new latency_1.default(this.sshIp, this.sshPort);
|
|
600
|
+
this.regionLatency.startChecking();
|
|
601
|
+
// target latency
|
|
602
|
+
if (!this.serve && this.type !== tunnel_1.TUNNEL_TYPE.SSH) {
|
|
603
|
+
this.targetLatency = new latency_1.default(this.targetHost, this.targetPort);
|
|
604
|
+
this.targetLatency.on(tunnel_1.TUNNEL_EVENT_LATENCY.RECONNECTED, () => this.targetReconnected());
|
|
605
|
+
this.targetLatency.startChecking();
|
|
606
|
+
}
|
|
607
|
+
// dns health
|
|
608
|
+
this.dns = new dns_1.default(this.sshIp, this.domain, this.subdomain, this.region, this.sshId);
|
|
609
|
+
this.dns.startChecking();
|
|
610
|
+
if (this.type === tunnel_1.TUNNEL_TYPE.TLS &&
|
|
611
|
+
this.terminate === tunnel_1.TUNNEL_TERMINATE_AT.AGENT) {
|
|
612
|
+
// tls
|
|
613
|
+
const ServerTlsImpl = require('./server/tls').default;
|
|
614
|
+
const tls = new ServerTlsImpl(this.key, this.cert, this.ca);
|
|
615
|
+
tls.on(tunnel_1.TUNNEL_EVENT.TLS_SOCKET, (socket) => this.tlsSocket(socket));
|
|
616
|
+
this.tls = tls;
|
|
617
|
+
}
|
|
618
|
+
else if (this.type === tunnel_1.TUNNEL_TYPE.HTTP) {
|
|
619
|
+
// http
|
|
620
|
+
this.httpLog = new log_1.default(this.log, this.circuitBreaker);
|
|
621
|
+
this.httpLog.on(tunnel_1.TUNNEL_EVENT_HTTP.NEW_REQUEST, (logRequest) => this.httpLogRequest(logRequest));
|
|
622
|
+
this.httpLog.on(tunnel_1.TUNNEL_EVENT_HTTP.NEW_RESPONSE, (logRequest) => this.httpLogResponse(logRequest));
|
|
623
|
+
this.identify = new identification_1.default(this.targetProto, this.targetHost, this.targetPort, this.http2 || !!this.serve);
|
|
624
|
+
this.identify.on(tunnel_1.TUNNEL_EVENT.IDENTIFIED, (type) => this.httpIdentified(type));
|
|
625
|
+
const host = format_1.default.entryHostEncoded(this);
|
|
626
|
+
this.http2server = new http2_1.default(host);
|
|
627
|
+
this.http2server.on(tunnel_1.TUNNEL_EVENT.HTTP_SESSION_OPEN, (session) => this.httpConnectionOpen(session));
|
|
628
|
+
this.http2server.on(tunnel_1.TUNNEL_EVENT.HTTP_SESSION_CLOSED, (session) => this.httpConnectionClosed(session));
|
|
629
|
+
this.http2server.on(tunnel_1.TUNNEL_EVENT.HTTP_REQUEST, async (req, res) => await this.httpRequest(req, res));
|
|
630
|
+
this.http1server = new http1_1.default(host);
|
|
631
|
+
this.http1server.on(tunnel_1.TUNNEL_HTTP_SOCKET.OPEN, (socket) => this.httpConnectionOpen(socket));
|
|
632
|
+
this.http1server.on(tunnel_1.TUNNEL_HTTP_SOCKET.CLOSED, (socket) => this.httpConnectionClosed(socket));
|
|
633
|
+
this.http1server.on(tunnel_1.TUNNEL_EVENT.HTTP_REQUEST, async (req, res) => await this.httpRequest(req, res));
|
|
634
|
+
}
|
|
635
|
+
else if (this.type === tunnel_1.TUNNEL_TYPE.SSH) {
|
|
636
|
+
// ssh server
|
|
637
|
+
const ServerSsh = require('./server/ssh').default;
|
|
638
|
+
this.sshServer = new ServerSsh(this.agent, this.sshClientUser || '', this.sshClientPassword || '', this.sshHostKey);
|
|
639
|
+
}
|
|
640
|
+
// ssh
|
|
641
|
+
const SshClientImpl = require('./ssh/client').default;
|
|
642
|
+
const ssh = new SshClientImpl(this.sshIp, this.sshPort, this.sshUser, this.sshPassword);
|
|
643
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.CONNECTED, () => this.sshConnected());
|
|
644
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.DISCONNECTED, () => this.sshDisconnected());
|
|
645
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.STREAM_TCP, (stream) => this.sshStreamTcp(stream));
|
|
646
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.STREAM_TLS, (stream) => this.sshStreamTls(stream));
|
|
647
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.STREAM_HTTP1, (stream, info, ip) => this.sshStreamHttp1(stream, info, ip));
|
|
648
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.STREAM_HTTP2, (stream, info, ip) => this.sshStreamHttp2(stream, info, ip));
|
|
649
|
+
ssh.on(tunnel_1.TUNNEL_SSH_EVENT.STREAM_SSH, (stream) => this.sshStreamSsh(stream));
|
|
650
|
+
ssh.openKeepAlive();
|
|
651
|
+
this.ssh = ssh;
|
|
652
|
+
}
|
|
653
|
+
catch (err) {
|
|
654
|
+
// Undo the half-started state instead of leaving a tunnel that is "started" but never
|
|
655
|
+
// connected to the region: Agent.refreshTunnels starts it again on the next refresh.
|
|
656
|
+
logger_1.default.error((0, texts_1.LOG_TUNNEL_START_FAILED)(this.id));
|
|
657
|
+
logger_1.default.error(err);
|
|
658
|
+
this.stop(false);
|
|
659
|
+
}
|
|
650
660
|
}
|
|
651
661
|
stop(emitEvent = true) {
|
|
652
662
|
if (!this.started)
|
package/distTs/src/utils.js
CHANGED
|
@@ -95,6 +95,7 @@ var REST_API_SCOPE;
|
|
|
95
95
|
REST_API_SCOPE["ENVIRONMENT_MANAGE"] = "ENVIRONMENT_MANAGE";
|
|
96
96
|
REST_API_SCOPE["ENVIRONMENT_READ"] = "ENVIRONMENT_READ";
|
|
97
97
|
REST_API_SCOPE["ENVIRONMENT_WRITE"] = "ENVIRONMENT_WRITE";
|
|
98
|
+
REST_API_SCOPE["INTEGRATION_MANAGE"] = "INTEGRATION_MANAGE";
|
|
98
99
|
REST_API_SCOPE["INTEGRATION_READ"] = "INTEGRATION_READ";
|
|
99
100
|
REST_API_SCOPE["PROJECT_MANAGE"] = "PROJECT_MANAGE";
|
|
100
101
|
REST_API_SCOPE["PROJECT_READ"] = "PROJECT_READ";
|