@rstreamlabs/tunnels 1.0.4 → 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 +302 -1
- package/dist/index.d.ts +302 -1
- package/dist/index.js +19 -2
- package/dist/index.mjs +18 -2
- 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"));
|
|
@@ -402,7 +415,8 @@ var streamTLSInfoSchema = z5.object({
|
|
|
402
415
|
version: z5.string().min(1).optional(),
|
|
403
416
|
cipher: z5.string().min(1).optional(),
|
|
404
417
|
protocol: z5.string().min(1).optional(),
|
|
405
|
-
curve: z5.string().min(1).optional()
|
|
418
|
+
curve: z5.string().min(1).optional(),
|
|
419
|
+
ech: z5.boolean().optional()
|
|
406
420
|
});
|
|
407
421
|
var streamEndpointSchema = z5.object({
|
|
408
422
|
ip: ipAddressSchema.optional(),
|
|
@@ -520,12 +534,14 @@ var firewallSchema = z5.discriminatedUnion("decision", [
|
|
|
520
534
|
var routedTunnelSchema = z5.object({
|
|
521
535
|
tunnelId: nonEmptyStringSchema2.optional(),
|
|
522
536
|
tunnelName: z5.string().optional(),
|
|
537
|
+
hostname: z5.string().optional(),
|
|
523
538
|
protocol: z5.string().optional(),
|
|
524
539
|
published: z5.boolean().optional(),
|
|
525
540
|
type: z5.string().optional(),
|
|
526
541
|
tlsMode: z5.string().optional(),
|
|
527
542
|
httpVersion: z5.string().optional(),
|
|
528
543
|
httpUseTls: z5.boolean().optional(),
|
|
544
|
+
upstreamTls: z5.boolean().optional(),
|
|
529
545
|
tokenAuth: z5.boolean().optional(),
|
|
530
546
|
mtls: z5.boolean().optional()
|
|
531
547
|
});
|
|
@@ -1354,7 +1370,7 @@ function parser(tunnel) {
|
|
|
1354
1370
|
}
|
|
1355
1371
|
const candidate = {
|
|
1356
1372
|
tunnel_id: tunnel.id,
|
|
1357
|
-
host: tunnel
|
|
1373
|
+
host: formatTunnelHost(tunnel),
|
|
1358
1374
|
token_auth: tunnel.token_auth === true,
|
|
1359
1375
|
os_family: tunnelLabels["rstream.webtty.os_family"],
|
|
1360
1376
|
arch: tunnelLabels["rstream.webtty.arch"],
|
|
@@ -1402,6 +1418,7 @@ function parseWebTTYServers(tunnels) {
|
|
|
1402
1418
|
createPATTURNCredentials,
|
|
1403
1419
|
createTURNCredentials,
|
|
1404
1420
|
eventSchema,
|
|
1421
|
+
formatTunnelHost,
|
|
1405
1422
|
listClientsParamsSchema,
|
|
1406
1423
|
listClientsResponseSchema,
|
|
1407
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";
|
|
@@ -322,7 +334,8 @@ var streamTLSInfoSchema = z5.object({
|
|
|
322
334
|
version: z5.string().min(1).optional(),
|
|
323
335
|
cipher: z5.string().min(1).optional(),
|
|
324
336
|
protocol: z5.string().min(1).optional(),
|
|
325
|
-
curve: z5.string().min(1).optional()
|
|
337
|
+
curve: z5.string().min(1).optional(),
|
|
338
|
+
ech: z5.boolean().optional()
|
|
326
339
|
});
|
|
327
340
|
var streamEndpointSchema = z5.object({
|
|
328
341
|
ip: ipAddressSchema.optional(),
|
|
@@ -440,12 +453,14 @@ var firewallSchema = z5.discriminatedUnion("decision", [
|
|
|
440
453
|
var routedTunnelSchema = z5.object({
|
|
441
454
|
tunnelId: nonEmptyStringSchema2.optional(),
|
|
442
455
|
tunnelName: z5.string().optional(),
|
|
456
|
+
hostname: z5.string().optional(),
|
|
443
457
|
protocol: z5.string().optional(),
|
|
444
458
|
published: z5.boolean().optional(),
|
|
445
459
|
type: z5.string().optional(),
|
|
446
460
|
tlsMode: z5.string().optional(),
|
|
447
461
|
httpVersion: z5.string().optional(),
|
|
448
462
|
httpUseTls: z5.boolean().optional(),
|
|
463
|
+
upstreamTls: z5.boolean().optional(),
|
|
449
464
|
tokenAuth: z5.boolean().optional(),
|
|
450
465
|
mtls: z5.boolean().optional()
|
|
451
466
|
});
|
|
@@ -1274,7 +1289,7 @@ function parser(tunnel) {
|
|
|
1274
1289
|
}
|
|
1275
1290
|
const candidate = {
|
|
1276
1291
|
tunnel_id: tunnel.id,
|
|
1277
|
-
host: tunnel
|
|
1292
|
+
host: formatTunnelHost(tunnel),
|
|
1278
1293
|
token_auth: tunnel.token_auth === true,
|
|
1279
1294
|
os_family: tunnelLabels["rstream.webtty.os_family"],
|
|
1280
1295
|
arch: tunnelLabels["rstream.webtty.arch"],
|
|
@@ -1321,6 +1336,7 @@ export {
|
|
|
1321
1336
|
createPATTURNCredentials,
|
|
1322
1337
|
createTURNCredentials,
|
|
1323
1338
|
eventSchema,
|
|
1339
|
+
formatTunnelHost,
|
|
1324
1340
|
listClientsParamsSchema,
|
|
1325
1341
|
listClientsResponseSchema,
|
|
1326
1342
|
listTunnelsParamsSchema,
|