@rstreamlabs/tunnels 1.0.5 → 1.0.6
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/dist/index.d.mts +291 -1
- package/dist/index.d.ts +291 -1
- package/dist/index.js +17 -1
- package/dist/index.mjs +16 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
createPATTURNCredentials: () => createPATTURNCredentials,
|
|
58
58
|
createTURNCredentials: () => createTURNCredentials,
|
|
59
59
|
eventSchema: () => eventSchema,
|
|
60
|
+
formatTunnelHost: () => formatTunnelHost,
|
|
60
61
|
listClientsParamsSchema: () => listClientsParamsSchema,
|
|
61
62
|
listClientsResponseSchema: () => listClientsResponseSchema,
|
|
62
63
|
listTunnelsParamsSchema: () => listTunnelsParamsSchema,
|
|
@@ -126,6 +127,7 @@ function select(base) {
|
|
|
126
127
|
|
|
127
128
|
// src/tunnel.ts
|
|
128
129
|
var z2 = __toESM(require("zod"));
|
|
130
|
+
var DEFAULT_PUBLISHED_PORT = 443;
|
|
129
131
|
var tunnelSchema = z2.object({
|
|
130
132
|
// common properties
|
|
131
133
|
client_id: z2.string(),
|
|
@@ -148,6 +150,8 @@ var tunnelSchema = z2.object({
|
|
|
148
150
|
geo_ip: z2.array(z2.string()).optional(),
|
|
149
151
|
trusted_ips: z2.array(z2.string()).optional(),
|
|
150
152
|
host: z2.string().optional(),
|
|
153
|
+
hostname: z2.string().optional(),
|
|
154
|
+
port: z2.number().int().min(1).max(65535).optional(),
|
|
151
155
|
tls_mode: z2.enum(["passthrough", "terminated"]).optional(),
|
|
152
156
|
tls_alpns: z2.array(z2.string()).optional(),
|
|
153
157
|
tls_min_version: z2.string().optional(),
|
|
@@ -156,6 +160,7 @@ var tunnelSchema = z2.object({
|
|
|
156
160
|
mtls_ca_cert_pem: z2.string().optional(),
|
|
157
161
|
http_version: z2.enum(["http/1.1", "h2", "h2c", "h3"]).optional(),
|
|
158
162
|
http_use_tls: z2.boolean().optional(),
|
|
163
|
+
upstream_tls: z2.boolean().optional(),
|
|
159
164
|
token_auth: z2.boolean().optional(),
|
|
160
165
|
rstream_auth: z2.boolean().optional(),
|
|
161
166
|
challenge_mode: z2.boolean().optional()
|
|
@@ -165,12 +170,20 @@ var listTunnelsParamsSchema = z2.object({
|
|
|
165
170
|
filters: tunnelSchema.pick({
|
|
166
171
|
status: true,
|
|
167
172
|
client_id: true,
|
|
173
|
+
hostname: true,
|
|
168
174
|
protocol: true,
|
|
169
175
|
publish: true,
|
|
170
176
|
labels: true
|
|
171
177
|
}).partial().optional()
|
|
172
178
|
});
|
|
173
179
|
var listTunnelsResponseSchema = z2.array(tunnelSchema);
|
|
180
|
+
function formatTunnelHost(tunnel) {
|
|
181
|
+
if (!tunnel.hostname) return tunnel.host;
|
|
182
|
+
if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
|
|
183
|
+
return tunnel.hostname;
|
|
184
|
+
}
|
|
185
|
+
return `${tunnel.hostname}:${tunnel.port}`;
|
|
186
|
+
}
|
|
174
187
|
|
|
175
188
|
// src/auth.ts
|
|
176
189
|
var z3 = __toESM(require("zod"));
|
|
@@ -521,12 +534,14 @@ var firewallSchema = z5.discriminatedUnion("decision", [
|
|
|
521
534
|
var routedTunnelSchema = z5.object({
|
|
522
535
|
tunnelId: nonEmptyStringSchema2.optional(),
|
|
523
536
|
tunnelName: z5.string().optional(),
|
|
537
|
+
hostname: z5.string().optional(),
|
|
524
538
|
protocol: z5.string().optional(),
|
|
525
539
|
published: z5.boolean().optional(),
|
|
526
540
|
type: z5.string().optional(),
|
|
527
541
|
tlsMode: z5.string().optional(),
|
|
528
542
|
httpVersion: z5.string().optional(),
|
|
529
543
|
httpUseTls: z5.boolean().optional(),
|
|
544
|
+
upstreamTls: z5.boolean().optional(),
|
|
530
545
|
tokenAuth: z5.boolean().optional(),
|
|
531
546
|
mtls: z5.boolean().optional()
|
|
532
547
|
});
|
|
@@ -1355,7 +1370,7 @@ function parser(tunnel) {
|
|
|
1355
1370
|
}
|
|
1356
1371
|
const candidate = {
|
|
1357
1372
|
tunnel_id: tunnel.id,
|
|
1358
|
-
host: tunnel
|
|
1373
|
+
host: formatTunnelHost(tunnel),
|
|
1359
1374
|
token_auth: tunnel.token_auth === true,
|
|
1360
1375
|
os_family: tunnelLabels["rstream.webtty.os_family"],
|
|
1361
1376
|
arch: tunnelLabels["rstream.webtty.arch"],
|
|
@@ -1403,6 +1418,7 @@ function parseWebTTYServers(tunnels) {
|
|
|
1403
1418
|
createPATTURNCredentials,
|
|
1404
1419
|
createTURNCredentials,
|
|
1405
1420
|
eventSchema,
|
|
1421
|
+
formatTunnelHost,
|
|
1406
1422
|
listClientsParamsSchema,
|
|
1407
1423
|
listClientsResponseSchema,
|
|
1408
1424
|
listTunnelsParamsSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -46,6 +46,7 @@ function select(base) {
|
|
|
46
46
|
|
|
47
47
|
// src/tunnel.ts
|
|
48
48
|
import * as z2 from "zod";
|
|
49
|
+
var DEFAULT_PUBLISHED_PORT = 443;
|
|
49
50
|
var tunnelSchema = z2.object({
|
|
50
51
|
// common properties
|
|
51
52
|
client_id: z2.string(),
|
|
@@ -68,6 +69,8 @@ var tunnelSchema = z2.object({
|
|
|
68
69
|
geo_ip: z2.array(z2.string()).optional(),
|
|
69
70
|
trusted_ips: z2.array(z2.string()).optional(),
|
|
70
71
|
host: z2.string().optional(),
|
|
72
|
+
hostname: z2.string().optional(),
|
|
73
|
+
port: z2.number().int().min(1).max(65535).optional(),
|
|
71
74
|
tls_mode: z2.enum(["passthrough", "terminated"]).optional(),
|
|
72
75
|
tls_alpns: z2.array(z2.string()).optional(),
|
|
73
76
|
tls_min_version: z2.string().optional(),
|
|
@@ -76,6 +79,7 @@ var tunnelSchema = z2.object({
|
|
|
76
79
|
mtls_ca_cert_pem: z2.string().optional(),
|
|
77
80
|
http_version: z2.enum(["http/1.1", "h2", "h2c", "h3"]).optional(),
|
|
78
81
|
http_use_tls: z2.boolean().optional(),
|
|
82
|
+
upstream_tls: z2.boolean().optional(),
|
|
79
83
|
token_auth: z2.boolean().optional(),
|
|
80
84
|
rstream_auth: z2.boolean().optional(),
|
|
81
85
|
challenge_mode: z2.boolean().optional()
|
|
@@ -85,12 +89,20 @@ var listTunnelsParamsSchema = z2.object({
|
|
|
85
89
|
filters: tunnelSchema.pick({
|
|
86
90
|
status: true,
|
|
87
91
|
client_id: true,
|
|
92
|
+
hostname: true,
|
|
88
93
|
protocol: true,
|
|
89
94
|
publish: true,
|
|
90
95
|
labels: true
|
|
91
96
|
}).partial().optional()
|
|
92
97
|
});
|
|
93
98
|
var listTunnelsResponseSchema = z2.array(tunnelSchema);
|
|
99
|
+
function formatTunnelHost(tunnel) {
|
|
100
|
+
if (!tunnel.hostname) return tunnel.host;
|
|
101
|
+
if (!tunnel.port || tunnel.port === DEFAULT_PUBLISHED_PORT) {
|
|
102
|
+
return tunnel.hostname;
|
|
103
|
+
}
|
|
104
|
+
return `${tunnel.hostname}:${tunnel.port}`;
|
|
105
|
+
}
|
|
94
106
|
|
|
95
107
|
// src/auth.ts
|
|
96
108
|
import * as z3 from "zod";
|
|
@@ -441,12 +453,14 @@ var firewallSchema = z5.discriminatedUnion("decision", [
|
|
|
441
453
|
var routedTunnelSchema = z5.object({
|
|
442
454
|
tunnelId: nonEmptyStringSchema2.optional(),
|
|
443
455
|
tunnelName: z5.string().optional(),
|
|
456
|
+
hostname: z5.string().optional(),
|
|
444
457
|
protocol: z5.string().optional(),
|
|
445
458
|
published: z5.boolean().optional(),
|
|
446
459
|
type: z5.string().optional(),
|
|
447
460
|
tlsMode: z5.string().optional(),
|
|
448
461
|
httpVersion: z5.string().optional(),
|
|
449
462
|
httpUseTls: z5.boolean().optional(),
|
|
463
|
+
upstreamTls: z5.boolean().optional(),
|
|
450
464
|
tokenAuth: z5.boolean().optional(),
|
|
451
465
|
mtls: z5.boolean().optional()
|
|
452
466
|
});
|
|
@@ -1275,7 +1289,7 @@ function parser(tunnel) {
|
|
|
1275
1289
|
}
|
|
1276
1290
|
const candidate = {
|
|
1277
1291
|
tunnel_id: tunnel.id,
|
|
1278
|
-
host: tunnel
|
|
1292
|
+
host: formatTunnelHost(tunnel),
|
|
1279
1293
|
token_auth: tunnel.token_auth === true,
|
|
1280
1294
|
os_family: tunnelLabels["rstream.webtty.os_family"],
|
|
1281
1295
|
arch: tunnelLabels["rstream.webtty.arch"],
|
|
@@ -1322,6 +1336,7 @@ export {
|
|
|
1322
1336
|
createPATTURNCredentials,
|
|
1323
1337
|
createTURNCredentials,
|
|
1324
1338
|
eventSchema,
|
|
1339
|
+
formatTunnelHost,
|
|
1325
1340
|
listClientsParamsSchema,
|
|
1326
1341
|
listClientsResponseSchema,
|
|
1327
1342
|
listTunnelsParamsSchema,
|