@betterportal/tunnels 1.0.24 → 1.0.26
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/lib/.bsb/clients/service-tunnels-client.d.ts +133 -0
- package/lib/.bsb/clients/service-tunnels-client.d.ts.map +1 -0
- package/lib/.bsb/clients/service-tunnels-client.js +102 -0
- package/lib/.bsb/clients/service-tunnels-client.js.map +1 -0
- package/lib/.bsb/clients/service-tunnels-proxy.d.ts +43 -0
- package/lib/.bsb/clients/service-tunnels-proxy.d.ts.map +1 -0
- package/lib/.bsb/clients/service-tunnels-proxy.js +47 -0
- package/lib/.bsb/clients/service-tunnels-proxy.js.map +1 -0
- package/lib/auth.d.ts +12 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +59 -0
- package/lib/auth.js.map +1 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +406 -0
- package/lib/cli.js.map +1 -0
- package/lib/generated/prisma/client.d.ts +1 -0
- package/lib/generated/prisma/client.js +5 -0
- package/lib/generated/prisma/default.d.ts +1 -0
- package/lib/generated/prisma/default.js +5 -0
- package/lib/generated/prisma/edge.d.ts +1 -0
- package/lib/generated/prisma/edge.js +278 -0
- package/lib/generated/prisma/index-browser.js +304 -0
- package/lib/generated/prisma/index.d.ts +13885 -0
- package/lib/generated/prisma/index.js +278 -0
- package/lib/generated/prisma/package.json +144 -0
- package/lib/generated/prisma/query_compiler_fast_bg.js +2 -0
- package/lib/generated/prisma/query_compiler_fast_bg.wasm +0 -0
- package/lib/generated/prisma/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/lib/generated/prisma/runtime/client.d.ts +3386 -0
- package/lib/generated/prisma/runtime/client.js +86 -0
- package/lib/generated/prisma/runtime/index-browser.d.ts +90 -0
- package/lib/generated/prisma/runtime/index-browser.js +6 -0
- package/lib/generated/prisma/runtime/wasm-compiler-edge.js +76 -0
- package/lib/generated/prisma/schema.prisma +142 -0
- package/lib/generated/prisma/wasm-edge-light-loader.mjs +5 -0
- package/lib/generated/prisma/wasm-worker-loader.mjs +5 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/registry.d.ts +3 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/registry.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/registry.js +152 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/registry.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/route-runtime.d.ts +9 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/route-runtime.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/route-runtime.js +6 -0
- package/lib/plugins/service-tunnels-admin/.bp-generated/route-runtime.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/assets/brand/bettertunnels-horizontal-light.svg +18 -0
- package/lib/plugins/service-tunnels-admin/assets/brand/bettertunnels-square-dark-1024x1024.png +0 -0
- package/lib/plugins/service-tunnels-admin/assets/brand/favicon.svg +12 -0
- package/lib/plugins/service-tunnels-admin/betterportal-logo.png +0 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/GET.d.ts +20 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/GET.js +51 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/_theme.bootstrap1/GET.d.ts +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/_theme.bootstrap1/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/_theme.bootstrap1/GET.js +6 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/_theme.bootstrap1/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/index.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/index.js +12 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/cli-auth/verify/index.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/GET.d.ts +40 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/GET.js +57 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/GET.d.ts +6 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/GET.js +30 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/index.stream.d.ts +6 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/index.stream.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/index.stream.js +9 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/_theme.bootstrap1/index.stream.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/index.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/index.js +14 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/dashboard/index.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/GET.d.ts +25 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/GET.js +34 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/_theme.bootstrap1/GET.d.ts +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/_theme.bootstrap1/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/_theme.bootstrap1/GET.js +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/_theme.bootstrap1/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/index.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/index.js +12 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/downloads/index.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/GET.d.ts +35 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/GET.js +52 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/_theme.bootstrap1/GET.d.ts +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/_theme.bootstrap1/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/_theme.bootstrap1/GET.js +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/_theme.bootstrap1/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/index.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/index.js +12 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/landing/index.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/GET.d.ts +39 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/GET.js +46 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/_theme.bootstrap1/GET.d.ts +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/_theme.bootstrap1/GET.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/_theme.bootstrap1/GET.js +5 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/_theme.bootstrap1/GET.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/index.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/index.js +14 -0
- package/lib/plugins/service-tunnels-admin/bp-routes/tunnels/index.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/brand-assets.d.ts +7 -0
- package/lib/plugins/service-tunnels-admin/brand-assets.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/brand-assets.js +24 -0
- package/lib/plugins/service-tunnels-admin/brand-assets.js.map +1 -0
- package/lib/plugins/service-tunnels-admin/index.d.ts +64 -0
- package/lib/plugins/service-tunnels-admin/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-admin/index.js +116 -0
- package/lib/plugins/service-tunnels-admin/index.js.map +1 -0
- package/lib/plugins/service-tunnels-client/ids.d.ts +6 -0
- package/lib/plugins/service-tunnels-client/ids.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-client/ids.js +17 -0
- package/lib/plugins/service-tunnels-client/ids.js.map +1 -0
- package/lib/plugins/service-tunnels-client/index.d.ts +166 -0
- package/lib/plugins/service-tunnels-client/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-client/index.js +733 -0
- package/lib/plugins/service-tunnels-client/index.js.map +1 -0
- package/lib/plugins/service-tunnels-client/registry.d.ts +39 -0
- package/lib/plugins/service-tunnels-client/registry.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-client/registry.js +20 -0
- package/lib/plugins/service-tunnels-client/registry.js.map +1 -0
- package/lib/plugins/service-tunnels-client/schemas.d.ts +91 -0
- package/lib/plugins/service-tunnels-client/schemas.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-client/schemas.js +73 -0
- package/lib/plugins/service-tunnels-client/schemas.js.map +1 -0
- package/lib/plugins/service-tunnels-proxy/http.d.ts +5 -0
- package/lib/plugins/service-tunnels-proxy/http.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-proxy/http.js +125 -0
- package/lib/plugins/service-tunnels-proxy/http.js.map +1 -0
- package/lib/plugins/service-tunnels-proxy/index.d.ts +85 -0
- package/lib/plugins/service-tunnels-proxy/index.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-proxy/index.js +288 -0
- package/lib/plugins/service-tunnels-proxy/index.js.map +1 -0
- package/lib/plugins/service-tunnels-proxy/verification.d.ts +31 -0
- package/lib/plugins/service-tunnels-proxy/verification.d.ts.map +1 -0
- package/lib/plugins/service-tunnels-proxy/verification.js +211 -0
- package/lib/plugins/service-tunnels-proxy/verification.js.map +1 -0
- package/lib/prisma.d.ts +7 -0
- package/lib/prisma.d.ts.map +1 -0
- package/lib/prisma.js +149 -0
- package/lib/prisma.js.map +1 -0
- package/lib/schemas/service-tunnels-admin.json +129 -0
- package/lib/schemas/service-tunnels-admin.plugin.json +140 -0
- package/lib/schemas/service-tunnels-client.json +320 -0
- package/lib/schemas/service-tunnels-client.plugin.json +97 -0
- package/lib/schemas/service-tunnels-proxy.json +160 -0
- package/lib/schemas/service-tunnels-proxy.plugin.json +123 -0
- package/package.json +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated BSB virtual client for service-tunnels-client
|
|
3
|
+
* DO NOT EDIT - Regenerated on every build
|
|
4
|
+
* @version 1.0.26
|
|
5
|
+
*/
|
|
6
|
+
import { ServiceClient, BSBService } from "@bsb/base";
|
|
7
|
+
import type { Observable, BSBServiceClientDefinition, EventInputType, EventOutputType } from "@bsb/base";
|
|
8
|
+
declare const _wsToOriginSchema: import("anyvali").ObjectSchema<{
|
|
9
|
+
publicServerId: import("anyvali").StringSchema;
|
|
10
|
+
publicSocketId: import("anyvali").StringSchema;
|
|
11
|
+
hostname: import("anyvali").StringSchema;
|
|
12
|
+
path: import("anyvali").StringSchema;
|
|
13
|
+
frameType: import("anyvali").StringSchema;
|
|
14
|
+
event: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
15
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
16
|
+
}>;
|
|
17
|
+
declare const _proxyMetricsSchema: import("anyvali").ObjectSchema<{
|
|
18
|
+
hostname: import("anyvali").StringSchema;
|
|
19
|
+
requestId: import("anyvali").StringSchema;
|
|
20
|
+
totalMs: import("@bsb/base").BSBType;
|
|
21
|
+
clientApiRoundtripMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
22
|
+
cliOverheadMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
23
|
+
originMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
24
|
+
internalServerMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
25
|
+
}>;
|
|
26
|
+
declare const _proxyRequestSchema: import("anyvali").ObjectSchema<{
|
|
27
|
+
hostname: import("anyvali").StringSchema;
|
|
28
|
+
method: import("anyvali").StringSchema;
|
|
29
|
+
path: import("anyvali").StringSchema;
|
|
30
|
+
headers: import("anyvali").RecordSchema<import("anyvali").StringSchema>;
|
|
31
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
32
|
+
webStartedAt: import("@bsb/base").BSBType;
|
|
33
|
+
}>;
|
|
34
|
+
declare const _proxyRequestOutputSchema: import("anyvali").ObjectSchema<{
|
|
35
|
+
requestId: import("anyvali").StringSchema;
|
|
36
|
+
ownerServerId: import("anyvali").StringSchema;
|
|
37
|
+
status: import("@bsb/base").BSBType;
|
|
38
|
+
headers: import("anyvali").RecordSchema<import("anyvali").StringSchema>;
|
|
39
|
+
body: import("anyvali").StringSchema;
|
|
40
|
+
webStartedAt: import("@bsb/base").BSBType;
|
|
41
|
+
clientApiRoundtripMs: import("@bsb/base").BSBType;
|
|
42
|
+
cliOverheadMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
43
|
+
originMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
44
|
+
}>;
|
|
45
|
+
declare const _EventSchemas: {
|
|
46
|
+
readonly onEvents: {
|
|
47
|
+
readonly 'ws.toOrigin': {
|
|
48
|
+
input: import("anyvali").ObjectSchema<{
|
|
49
|
+
publicServerId: import("anyvali").StringSchema;
|
|
50
|
+
publicSocketId: import("anyvali").StringSchema;
|
|
51
|
+
hostname: import("anyvali").StringSchema;
|
|
52
|
+
path: import("anyvali").StringSchema;
|
|
53
|
+
frameType: import("anyvali").StringSchema;
|
|
54
|
+
event: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
55
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
56
|
+
}>;
|
|
57
|
+
description?: string;
|
|
58
|
+
readonly __brand: "fire-and-forget";
|
|
59
|
+
};
|
|
60
|
+
readonly 'proxy.metrics': {
|
|
61
|
+
input: import("anyvali").ObjectSchema<{
|
|
62
|
+
hostname: import("anyvali").StringSchema;
|
|
63
|
+
requestId: import("anyvali").StringSchema;
|
|
64
|
+
totalMs: import("@bsb/base").BSBType;
|
|
65
|
+
clientApiRoundtripMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
66
|
+
cliOverheadMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
67
|
+
originMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
68
|
+
internalServerMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
69
|
+
}>;
|
|
70
|
+
description?: string;
|
|
71
|
+
readonly __brand: "fire-and-forget";
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly onReturnableEvents: {
|
|
75
|
+
readonly 'proxy.request': {
|
|
76
|
+
input: import("anyvali").ObjectSchema<{
|
|
77
|
+
hostname: import("anyvali").StringSchema;
|
|
78
|
+
method: import("anyvali").StringSchema;
|
|
79
|
+
path: import("anyvali").StringSchema;
|
|
80
|
+
headers: import("anyvali").RecordSchema<import("anyvali").StringSchema>;
|
|
81
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
82
|
+
webStartedAt: import("@bsb/base").BSBType;
|
|
83
|
+
}>;
|
|
84
|
+
output: import("anyvali").ObjectSchema<{
|
|
85
|
+
requestId: import("anyvali").StringSchema;
|
|
86
|
+
ownerServerId: import("anyvali").StringSchema;
|
|
87
|
+
status: import("@bsb/base").BSBType;
|
|
88
|
+
headers: import("anyvali").RecordSchema<import("anyvali").StringSchema>;
|
|
89
|
+
body: import("anyvali").StringSchema;
|
|
90
|
+
webStartedAt: import("@bsb/base").BSBType;
|
|
91
|
+
clientApiRoundtripMs: import("@bsb/base").BSBType;
|
|
92
|
+
cliOverheadMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
93
|
+
originMs: import("anyvali").OptionalSchema<import("@bsb/base").BSBType>;
|
|
94
|
+
}>;
|
|
95
|
+
description?: string;
|
|
96
|
+
defaultTimeout?: number;
|
|
97
|
+
readonly __brand: "returnable";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type WsToOriginInput = EventInputType<{
|
|
102
|
+
input: typeof _wsToOriginSchema;
|
|
103
|
+
}>;
|
|
104
|
+
export type ProxyMetricsInput = EventInputType<{
|
|
105
|
+
input: typeof _proxyMetricsSchema;
|
|
106
|
+
}>;
|
|
107
|
+
export type ProxyRequestInput = EventInputType<{
|
|
108
|
+
input: typeof _proxyRequestSchema;
|
|
109
|
+
}>;
|
|
110
|
+
export type ProxyRequestOutput = EventOutputType<{
|
|
111
|
+
output: typeof _proxyRequestOutputSchema;
|
|
112
|
+
}>;
|
|
113
|
+
declare class _PluginRef {
|
|
114
|
+
static PLUGIN_CLIENT: BSBServiceClientDefinition;
|
|
115
|
+
}
|
|
116
|
+
export default class TunnelsClientClient extends ServiceClient<any, typeof _EventSchemas, typeof _PluginRef> {
|
|
117
|
+
constructor(context: BSBService);
|
|
118
|
+
private _requireClientEvents;
|
|
119
|
+
/** Relay a public websocket frame to the connected tunnel client */
|
|
120
|
+
wsToOrigin(obs: Observable, input: WsToOriginInput): Promise<void>;
|
|
121
|
+
/** Relay a public websocket frame to the connected tunnel client for a specific server */
|
|
122
|
+
wsToOriginSpecific(serverId: string, obs: Observable, input: WsToOriginInput): Promise<void>;
|
|
123
|
+
/** Send final proxy request timings to the connected tunnel client */
|
|
124
|
+
proxyMetrics(obs: Observable, input: ProxyMetricsInput): Promise<void>;
|
|
125
|
+
/** Send final proxy request timings to the connected tunnel client for a specific server */
|
|
126
|
+
proxyMetricsSpecific(serverId: string, obs: Observable, input: ProxyMetricsInput): Promise<void>;
|
|
127
|
+
/** Proxy an HTTP request through a connected tunnel client (default timeout: 60s) */
|
|
128
|
+
proxyRequest(obs: Observable, input: ProxyRequestInput, timeout?: number): Promise<ProxyRequestOutput>;
|
|
129
|
+
/** Proxy an HTTP request through a connected tunnel client for a specific server (default timeout: 60s) */
|
|
130
|
+
proxyRequestSpecific(serverId: string, obs: Observable, input: ProxyRequestInput, timeout?: number): Promise<ProxyRequestOutput>;
|
|
131
|
+
}
|
|
132
|
+
export { TunnelsClientClient };
|
|
133
|
+
//# sourceMappingURL=service-tunnels-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-tunnels-client.d.ts","s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AC,IAAI,CAAC;IAKxE,0FAA0F;IACpF,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlG,sEAAsE;IAChE,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5E,4FAA4F;IACtF,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtG,qFAAqF;IAC/E,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKhH,2GAA2G;IACrG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAI3I;AACD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated BSB virtual client for service-tunnels-client
|
|
3
|
+
* DO NOT EDIT - Regenerated on every build
|
|
4
|
+
* @version 1.0.26
|
|
5
|
+
*/
|
|
6
|
+
import { ServiceClient, bsb, optional, createReturnableEvent, createFireAndForgetEvent, createEventSchemas } from "@bsb/base";
|
|
7
|
+
const _wsToOriginSchema = bsb.object({
|
|
8
|
+
"publicServerId": bsb.string(),
|
|
9
|
+
"publicSocketId": bsb.string(),
|
|
10
|
+
"hostname": bsb.string(),
|
|
11
|
+
"path": bsb.string(),
|
|
12
|
+
"frameType": bsb.string(),
|
|
13
|
+
"event": optional(bsb.string()),
|
|
14
|
+
"body": optional(bsb.string())
|
|
15
|
+
});
|
|
16
|
+
const _proxyMetricsSchema = bsb.object({
|
|
17
|
+
"hostname": bsb.string(),
|
|
18
|
+
"requestId": bsb.string(),
|
|
19
|
+
"totalMs": bsb.number(),
|
|
20
|
+
"clientApiRoundtripMs": optional(bsb.number()),
|
|
21
|
+
"cliOverheadMs": optional(bsb.number()),
|
|
22
|
+
"originMs": optional(bsb.number()),
|
|
23
|
+
"internalServerMs": optional(bsb.number())
|
|
24
|
+
});
|
|
25
|
+
const _proxyRequestSchema = bsb.object({
|
|
26
|
+
"hostname": bsb.string(),
|
|
27
|
+
"method": bsb.string(),
|
|
28
|
+
"path": bsb.string(),
|
|
29
|
+
"headers": bsb.record(bsb.string(), bsb.string()),
|
|
30
|
+
"body": optional(bsb.string()),
|
|
31
|
+
"webStartedAt": bsb.number()
|
|
32
|
+
});
|
|
33
|
+
const _proxyRequestOutputSchema = bsb.object({
|
|
34
|
+
"requestId": bsb.string(),
|
|
35
|
+
"ownerServerId": bsb.string(),
|
|
36
|
+
"status": bsb.number(),
|
|
37
|
+
"headers": bsb.record(bsb.string(), bsb.string()),
|
|
38
|
+
"body": bsb.string(),
|
|
39
|
+
"webStartedAt": bsb.number(),
|
|
40
|
+
"clientApiRoundtripMs": bsb.number(),
|
|
41
|
+
"cliOverheadMs": optional(bsb.number()),
|
|
42
|
+
"originMs": optional(bsb.number())
|
|
43
|
+
});
|
|
44
|
+
const _EventSchemas = createEventSchemas({
|
|
45
|
+
onEvents: {
|
|
46
|
+
'ws.toOrigin': createFireAndForgetEvent(_wsToOriginSchema, "Relay a public websocket frame to the connected tunnel client"),
|
|
47
|
+
'proxy.metrics': createFireAndForgetEvent(_proxyMetricsSchema, "Send final proxy request timings to the connected tunnel client"),
|
|
48
|
+
},
|
|
49
|
+
onReturnableEvents: {
|
|
50
|
+
'proxy.request': createReturnableEvent(_proxyRequestSchema, _proxyRequestOutputSchema, "Proxy an HTTP request through a connected tunnel client", 60),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const _PLUGIN_CLIENT = {
|
|
54
|
+
name: "service-tunnels-client",
|
|
55
|
+
};
|
|
56
|
+
class _PluginRef {
|
|
57
|
+
static PLUGIN_CLIENT = _PLUGIN_CLIENT;
|
|
58
|
+
}
|
|
59
|
+
export default class TunnelsClientClient extends ServiceClient {
|
|
60
|
+
constructor(context) {
|
|
61
|
+
super(_PluginRef, context);
|
|
62
|
+
}
|
|
63
|
+
_requireClientEvents(methodName, eventName) {
|
|
64
|
+
const events = this.events;
|
|
65
|
+
if (!events || typeof events[methodName] !== "function") {
|
|
66
|
+
throw new Error(`[BSB Client Error] TunnelsClientClient cannot use "${eventName}" via ${methodName} because this generated client has no events facade yet. Generated service clients are wired by BSB during service setup. Create generated clients in your service constructor with the running BSBService context so BSB can register them before init/run. If this client was created inside init/onRegistered/run and used immediately, move construction to the constructor. If you are trying to listen to an event this same plugin emits, do not instantiate its generated client as a self-listener; listen through the generated client for the emitting service, or use this.createSelf() only for explicit self-invocation of own handlers.`);
|
|
67
|
+
}
|
|
68
|
+
return events;
|
|
69
|
+
}
|
|
70
|
+
/** Relay a public websocket frame to the connected tunnel client */
|
|
71
|
+
async wsToOrigin(obs, input) {
|
|
72
|
+
const events = this._requireClientEvents("emitEvent", "ws.toOrigin");
|
|
73
|
+
await events.emitEvent("ws.toOrigin", obs, input);
|
|
74
|
+
}
|
|
75
|
+
/** Relay a public websocket frame to the connected tunnel client for a specific server */
|
|
76
|
+
async wsToOriginSpecific(serverId, obs, input) {
|
|
77
|
+
const events = this._requireClientEvents("emitEventSpecific", "ws.toOrigin");
|
|
78
|
+
await events.emitEventSpecific("ws.toOrigin", serverId, obs, input);
|
|
79
|
+
}
|
|
80
|
+
/** Send final proxy request timings to the connected tunnel client */
|
|
81
|
+
async proxyMetrics(obs, input) {
|
|
82
|
+
const events = this._requireClientEvents("emitEvent", "proxy.metrics");
|
|
83
|
+
await events.emitEvent("proxy.metrics", obs, input);
|
|
84
|
+
}
|
|
85
|
+
/** Send final proxy request timings to the connected tunnel client for a specific server */
|
|
86
|
+
async proxyMetricsSpecific(serverId, obs, input) {
|
|
87
|
+
const events = this._requireClientEvents("emitEventSpecific", "proxy.metrics");
|
|
88
|
+
await events.emitEventSpecific("proxy.metrics", serverId, obs, input);
|
|
89
|
+
}
|
|
90
|
+
/** Proxy an HTTP request through a connected tunnel client (default timeout: 60s) */
|
|
91
|
+
async proxyRequest(obs, input, timeout = 60) {
|
|
92
|
+
const events = this._requireClientEvents("emitEventAndReturn", "proxy.request");
|
|
93
|
+
return events.emitEventAndReturn("proxy.request", obs, input, timeout);
|
|
94
|
+
}
|
|
95
|
+
/** Proxy an HTTP request through a connected tunnel client for a specific server (default timeout: 60s) */
|
|
96
|
+
async proxyRequestSpecific(serverId, obs, input, timeout = 60) {
|
|
97
|
+
const events = this._requireClientEvents("emitEventAndReturnSpecific", "proxy.request");
|
|
98
|
+
return events.emitEventAndReturnSpecific("proxy.request", serverId, obs, input, timeout);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export { TunnelsClientClient };
|
|
102
|
+
//# sourceMappingURL=service-tunnels-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-tunnels-client.js","sourceRoot":"","sources":["../../../src/.bsb/clients/service-tunnels-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAc,GAAG,EAAE,QAAQ,EAAY,qBAAqB,EAAE,wBAAwB,EAAwB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG1K,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,CAAC;IACjC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;IAC9B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;IAC9B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE;IACxB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,QAAQ,CAAC,G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CAAC,oBAAoB,CAAC,QAAgB,EAAE,GAAe,EAAE,KAAwB,EAAE,UAAkB,EAAE;QAC1G,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;QACxF,OAAO,MAAM,CAAC,0BAA0B,CAAC,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3F,CAAC;CACF;AACD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated BSB virtual client for service-tunnels-proxy
|
|
3
|
+
* DO NOT EDIT - Regenerated on every build
|
|
4
|
+
* @version 1.0.26
|
|
5
|
+
*/
|
|
6
|
+
import { ServiceClient, BSBService } from "@bsb/base";
|
|
7
|
+
import type { Observable, BSBServiceClientDefinition, EventInputType } from "@bsb/base";
|
|
8
|
+
declare const _wsFromOriginSchema: import("anyvali").ObjectSchema<{
|
|
9
|
+
publicSocketId: import("anyvali").StringSchema;
|
|
10
|
+
frameType: import("anyvali").StringSchema;
|
|
11
|
+
event: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
12
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
13
|
+
}>;
|
|
14
|
+
declare const _EventSchemas: {
|
|
15
|
+
readonly onEvents: {
|
|
16
|
+
readonly 'ws.fromOrigin': {
|
|
17
|
+
input: import("anyvali").ObjectSchema<{
|
|
18
|
+
publicSocketId: import("anyvali").StringSchema;
|
|
19
|
+
frameType: import("anyvali").StringSchema;
|
|
20
|
+
event: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
21
|
+
body: import("anyvali").OptionalSchema<import("anyvali").StringSchema>;
|
|
22
|
+
}>;
|
|
23
|
+
description?: string;
|
|
24
|
+
readonly __brand: "fire-and-forget";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type WsFromOriginInput = EventInputType<{
|
|
29
|
+
input: typeof _wsFromOriginSchema;
|
|
30
|
+
}>;
|
|
31
|
+
declare class _PluginRef {
|
|
32
|
+
static PLUGIN_CLIENT: BSBServiceClientDefinition;
|
|
33
|
+
}
|
|
34
|
+
export default class TunnelsProxyClient extends ServiceClient<any, typeof _EventSchemas, typeof _PluginRef> {
|
|
35
|
+
constructor(context: BSBService);
|
|
36
|
+
private _requireClientEvents;
|
|
37
|
+
/** Relay an origin websocket frame to the public websocket */
|
|
38
|
+
wsFromOrigin(obs: Observable, input: WsFromOriginInput): Promise<void>;
|
|
39
|
+
/** Relay an origin websocket frame to the public websocket for a specific server */
|
|
40
|
+
wsFromOriginSpecific(serverId: string, obs: Observable, input: WsFromOriginInput): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export { TunnelsProxyClient };
|
|
43
|
+
//# sourceMappingURL=service-tunnels-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-tunnels-proxy.d.ts","sourceRoot":"","sources":["../../../src/.bsb/clients/service-tunnels-proxy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAsH,MAAM,WAAW,CAAC;AAC1K,OAAO,KAAK,EAAE,UAAU,EAAE,0BAA0B,EAAE,cAAc,EAAmB,MAAM,WAAW,CAAC;AAEzG,QAAA,MAAM,mBAAmB;;;;;EAKrB,CAAC;AAEL,QAAA,MAAM,aAAa;;;;;;;;;;;;;CAIjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAAE,KAAK,EAAE,OAAO,mBAAmB,CAAA;CAAE,CAAC,CAAC;AAMtF,cAAM,UAAU;IACd,MAAM,CAAC,aAAa,6BAAkB;CACvC;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,aAAa,CAAC,GAAG,EAAE,OAAO,aAAa,EAAE,OAAO,UAAU,CAAC;gBAC7F,OAAO,EAAE,UAAU;IAI/B,OAAO,CAAC,oBAAoB;IAQ5B,8DAA8D;IACxD,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5E,oFAAoF;IAC9E,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAIvG;AACD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated BSB virtual client for service-tunnels-proxy
|
|
3
|
+
* DO NOT EDIT - Regenerated on every build
|
|
4
|
+
* @version 1.0.26
|
|
5
|
+
*/
|
|
6
|
+
import { ServiceClient, bsb, optional, createFireAndForgetEvent, createEventSchemas } from "@bsb/base";
|
|
7
|
+
const _wsFromOriginSchema = bsb.object({
|
|
8
|
+
"publicSocketId": bsb.string(),
|
|
9
|
+
"frameType": bsb.string(),
|
|
10
|
+
"event": optional(bsb.string()),
|
|
11
|
+
"body": optional(bsb.string())
|
|
12
|
+
});
|
|
13
|
+
const _EventSchemas = createEventSchemas({
|
|
14
|
+
onEvents: {
|
|
15
|
+
'ws.fromOrigin': createFireAndForgetEvent(_wsFromOriginSchema, "Relay an origin websocket frame to the public websocket"),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const _PLUGIN_CLIENT = {
|
|
19
|
+
name: "service-tunnels-proxy",
|
|
20
|
+
};
|
|
21
|
+
class _PluginRef {
|
|
22
|
+
static PLUGIN_CLIENT = _PLUGIN_CLIENT;
|
|
23
|
+
}
|
|
24
|
+
export default class TunnelsProxyClient extends ServiceClient {
|
|
25
|
+
constructor(context) {
|
|
26
|
+
super(_PluginRef, context);
|
|
27
|
+
}
|
|
28
|
+
_requireClientEvents(methodName, eventName) {
|
|
29
|
+
const events = this.events;
|
|
30
|
+
if (!events || typeof events[methodName] !== "function") {
|
|
31
|
+
throw new Error(`[BSB Client Error] TunnelsProxyClient cannot use "${eventName}" via ${methodName} because this generated client has no events facade yet. Generated service clients are wired by BSB during service setup. Create generated clients in your service constructor with the running BSBService context so BSB can register them before init/run. If this client was created inside init/onRegistered/run and used immediately, move construction to the constructor. If you are trying to listen to an event this same plugin emits, do not instantiate its generated client as a self-listener; listen through the generated client for the emitting service, or use this.createSelf() only for explicit self-invocation of own handlers.`);
|
|
32
|
+
}
|
|
33
|
+
return events;
|
|
34
|
+
}
|
|
35
|
+
/** Relay an origin websocket frame to the public websocket */
|
|
36
|
+
async wsFromOrigin(obs, input) {
|
|
37
|
+
const events = this._requireClientEvents("emitEvent", "ws.fromOrigin");
|
|
38
|
+
await events.emitEvent("ws.fromOrigin", obs, input);
|
|
39
|
+
}
|
|
40
|
+
/** Relay an origin websocket frame to the public websocket for a specific server */
|
|
41
|
+
async wsFromOriginSpecific(serverId, obs, input) {
|
|
42
|
+
const events = this._requireClientEvents("emitEventSpecific", "ws.fromOrigin");
|
|
43
|
+
await events.emitEventSpecific("ws.fromOrigin", serverId, obs, input);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export { TunnelsProxyClient };
|
|
47
|
+
//# sourceMappingURL=service-tunnels-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-tunnels-proxy.js","sourceRoot":"","sources":["../../../src/.bsb/clients/service-tunnels-proxy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAc,GAAG,EAAE,QAAQ,EAAmC,wBAAwB,EAAwB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG1K,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,CAAC;IACnC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;IAC9B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,MA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,CAAC,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;CACF;AACD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/lib/auth.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const AUTH_SESSION_TTL_MS: number;
|
|
2
|
+
export declare const DEVICE_TOKEN_TTL_MS: number;
|
|
3
|
+
export declare function randomToken(bytes?: number): string;
|
|
4
|
+
export declare function shortBrowserKey(): string;
|
|
5
|
+
export declare function hashSecret(value: string): string;
|
|
6
|
+
export declare function verifySecret(value: string, hash: string): boolean;
|
|
7
|
+
export declare function bearerToken(headers: Headers): string | undefined;
|
|
8
|
+
export declare function normalizeIpRange(ip: string): {
|
|
9
|
+
family: "ipv4" | "ipv6";
|
|
10
|
+
cidr: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,QAAiB,CAAC;AAClD,eAAO,MAAM,mBAAmB,QAA4B,CAAC;AAE7D,wBAAgB,WAAW,CAAC,KAAK,SAAK,GAAG,MAAM,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKhE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAclG"}
|
package/lib/auth.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import net from "node:net";
|
|
3
|
+
export const AUTH_SESSION_TTL_MS = 10 * 60 * 1000;
|
|
4
|
+
export const DEVICE_TOKEN_TTL_MS = 365 * 24 * 60 * 60 * 1000;
|
|
5
|
+
export function randomToken(bytes = 32) {
|
|
6
|
+
return randomBytes(bytes).toString("base64url");
|
|
7
|
+
}
|
|
8
|
+
export function shortBrowserKey() {
|
|
9
|
+
return randomBytes(5).toString("base64url").toUpperCase();
|
|
10
|
+
}
|
|
11
|
+
export function hashSecret(value) {
|
|
12
|
+
return createHash("sha256").update(value).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
export function verifySecret(value, hash) {
|
|
15
|
+
const left = Buffer.from(hashSecret(value));
|
|
16
|
+
const right = Buffer.from(hash);
|
|
17
|
+
return left.length === right.length && timingSafeEqual(left, right);
|
|
18
|
+
}
|
|
19
|
+
export function bearerToken(headers) {
|
|
20
|
+
const header = headers.get("authorization");
|
|
21
|
+
if (!header)
|
|
22
|
+
return undefined;
|
|
23
|
+
const [scheme, token] = header.split(/\s+/, 2);
|
|
24
|
+
return scheme?.toLowerCase() === "bearer" && token ? token : undefined;
|
|
25
|
+
}
|
|
26
|
+
export function normalizeIpRange(ip) {
|
|
27
|
+
const clean = ip.trim();
|
|
28
|
+
const family = net.isIP(clean);
|
|
29
|
+
if (family === 4) {
|
|
30
|
+
const parts = clean.split(".").map((part) => Number(part));
|
|
31
|
+
if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255))
|
|
32
|
+
return undefined;
|
|
33
|
+
return { family: "ipv4", cidr: `${parts[0]}.${parts[1]}.${parts[2]}.0/24` };
|
|
34
|
+
}
|
|
35
|
+
if (family === 6) {
|
|
36
|
+
const expanded = expandIpv6(clean);
|
|
37
|
+
if (!expanded)
|
|
38
|
+
return undefined;
|
|
39
|
+
return { family: "ipv6", cidr: `${expanded.slice(0, 4).join(":")}:0000:0000:0000:0000/64` };
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
function expandIpv6(value) {
|
|
44
|
+
const [headRaw, tailRaw] = value.toLowerCase().split("::", 2);
|
|
45
|
+
const head = headRaw ? headRaw.split(":") : [];
|
|
46
|
+
const tail = tailRaw ? tailRaw.split(":") : [];
|
|
47
|
+
if (value.includes("::")) {
|
|
48
|
+
const missing = 8 - head.length - tail.length;
|
|
49
|
+
if (missing < 0)
|
|
50
|
+
return undefined;
|
|
51
|
+
return [...head, ...Array.from({ length: missing }, () => "0"), ...tail].map(padIpv6Part);
|
|
52
|
+
}
|
|
53
|
+
const parts = value.toLowerCase().split(":");
|
|
54
|
+
return parts.length === 8 ? parts.map(padIpv6Part) : undefined;
|
|
55
|
+
}
|
|
56
|
+
function padIpv6Part(value) {
|
|
57
|
+
return value.padStart(4, "0");
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=auth.js.map
|
package/lib/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D,MAAM,UAAU,WAAW,CAAC,KAAK,GAAG,EAAE;IACpC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,WAAW,CAAC,CAAC,CAAC,CA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