@fkn/lib 0.2.0 → 0.3.0
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/api/dns/index.d.ts +7 -0
- package/api/dns/lookup.d.ts +8 -0
- package/api/events.d.ts +7 -0
- package/api/index.d.ts +66 -0
- package/api/proxy/extension-proxy-fetch.d.ts +4 -0
- package/api/proxy/index.d.ts +7 -0
- package/api/proxy/proxy-fetch.d.ts +5 -0
- package/api/utils/event-target.d.ts +7 -0
- package/api/utils/index.d.ts +1 -0
- package/api/webvpn/index.d.ts +60 -0
- package/api/webvpn/packets/metadata.d.ts +30 -0
- package/api/webvpn/packets/tcp-listener.d.ts +39 -0
- package/api/webvpn/packets/tcp-listener.test.d.ts +1 -0
- package/api/webvpn/packets/tcp.d.ts +88 -0
- package/api/webvpn/packets/tcp.test.d.ts +1 -0
- package/api/webvpn/packets/udp.d.ts +196 -0
- package/api/webvpn/packets/udp.test.d.ts +1 -0
- package/api/webvpn/packets/utils.d.ts +23 -0
- package/api/webvpn/packets/utils.test.d.ts +1 -0
- package/api/webvpn/tcp-listener.d.ts +11 -0
- package/api/webvpn/tcp.d.ts +47 -0
- package/api/webvpn/udp.d.ts +30 -0
- package/api/webvpn/utils.d.ts +26 -0
- package/api/webvpn/utils.test.d.ts +1 -0
- package/api/webvpn/webtransport.d.ts +63 -0
- package/background-BKX-_a5c.js +914 -0
- package/background-CJX0MYvT.cjs +1 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +615 -0
- package/{build → lib}/api.d.ts +16 -23
- package/lib/proxy.d.ts +5 -0
- package/{build → lib}/webvpn/dgram.d.ts +10 -3
- package/{build → lib}/webvpn/net.d.ts +18 -11
- package/locator-BcexQUF6.js +1104 -0
- package/locator-i9-DjgYk.cjs +31 -0
- package/package.json +16 -37
- package/router/home.d.ts +2 -0
- package/router/index.d.ts +2 -0
- package/router/path.d.ts +9 -0
- package/README.md +0 -8
- package/build/index.cjs +0 -1
- package/build/index.d.ts +0 -3
- package/build/index.js +0 -480
- package/build/proxy.d.ts +0 -13
- package/build/test.d.ts +0 -0
- /package/{build/webextension/declarativeNetRequest.d.ts → api/webvpn/packets/metadata.test.d.ts} +0 -0
- /package/{build/webextension/index.d.ts → api/webvpn/packets/proptest.test.d.ts} +0 -0
- /package/{build → lib}/dom.d.ts +0 -0
- /package/{build → lib}/webvpn/index.d.ts +0 -0
- /package/{build → lib}/webvpn/utils.d.ts +0 -0
package/build/index.js
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
import { expose as T } from "osra";
|
|
2
|
-
import { Stream as V } from "stream";
|
|
3
|
-
import { EventEmitter as p } from "events";
|
|
4
|
-
import { Address4 as g, Address6 as v } from "ip-address";
|
|
5
|
-
const _ = "https://fkn.app", l = globalThis?.document.querySelector(`iframe[src="${_}/sandbox-api"]`), c = globalThis.document?.createElement("iframe");
|
|
6
|
-
!l && c && (c.src = `${_}/sandbox-api`, c.style.display = "none", document.body.appendChild(c));
|
|
7
|
-
const w = l || c, z = w.contentWindow;
|
|
8
|
-
if (!w.contentWindow)
|
|
9
|
-
throw new Error("Missing iframe content window");
|
|
10
|
-
const C = () => new Promise((r, e) => {
|
|
11
|
-
T({}, { key: "fkn-api", local: window, remote: z }).then(r).catch(e), setTimeout(() => {
|
|
12
|
-
e(new Error("Timeout waiting for api to be exposed"));
|
|
13
|
-
}, 50);
|
|
14
|
-
}), P = () => C().then((r) => r).catch((r) => {
|
|
15
|
-
if (r.message === "Timeout waiting for api to be exposed")
|
|
16
|
-
return P();
|
|
17
|
-
throw r;
|
|
18
|
-
}), a = P(), W = async (r, e) => {
|
|
19
|
-
const t = r, o = e, { body: s, ...n } = await (await a).SERVER_PROXY_FETCH({ input: t, init: o });
|
|
20
|
-
return new Response(
|
|
21
|
-
s,
|
|
22
|
-
{
|
|
23
|
-
...n,
|
|
24
|
-
headers: {
|
|
25
|
-
...n.headers,
|
|
26
|
-
...n.headers && {
|
|
27
|
-
setCookie: n.headers["set-cookie"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}, I = new TextEncoder();
|
|
33
|
-
new TextDecoder();
|
|
34
|
-
const h = (r) => g.isValid(r), m = (r) => v.isValid(r), S = (r) => h(r) ? 4 : m(r) ? 6 : 0, b = (...r) => {
|
|
35
|
-
if (typeof r[0] == "string")
|
|
36
|
-
throw new Error("FKN WebVPN does not support IPC connections");
|
|
37
|
-
const e = typeof r.at(-1) == "function" ? r.at(-1) : void 0;
|
|
38
|
-
return r[0] && typeof r[0] == "object" ? {
|
|
39
|
-
...r[0],
|
|
40
|
-
callback: e
|
|
41
|
-
} : {
|
|
42
|
-
port: r[0] ?? 0,
|
|
43
|
-
host: typeof r[1] == "string" ? r[1] : "localhost",
|
|
44
|
-
callback: e
|
|
45
|
-
};
|
|
46
|
-
}, R = (...r) => {
|
|
47
|
-
const e = typeof r.at(-1) == "function" ? r.at(-1) : void 0, t = r[0] ?? 0, o = typeof r[1] == "string" ? r[1] : "localhost";
|
|
48
|
-
return typeof r[0] == "object" ? {
|
|
49
|
-
...r[0],
|
|
50
|
-
address: r[0].address ?? o,
|
|
51
|
-
port: r[0].port ?? t,
|
|
52
|
-
callback: e
|
|
53
|
-
} : {
|
|
54
|
-
address: o,
|
|
55
|
-
port: t,
|
|
56
|
-
callback: e
|
|
57
|
-
};
|
|
58
|
-
}, x = (...r) => {
|
|
59
|
-
const e = typeof r.at(-1) == "function" ? r.at(-1) : void 0, t = r[0];
|
|
60
|
-
if (typeof r[2] == "number") {
|
|
61
|
-
const o = r[1], s = r[2], n = typeof r[3] == "number" ? r[3] : 0, i = typeof r[4] == "string" ? r[4] : "localhost";
|
|
62
|
-
return {
|
|
63
|
-
message: t,
|
|
64
|
-
offset: o,
|
|
65
|
-
length: s,
|
|
66
|
-
port: n,
|
|
67
|
-
address: i,
|
|
68
|
-
callback: e
|
|
69
|
-
};
|
|
70
|
-
} else {
|
|
71
|
-
const o = typeof r[1] == "number" ? r[1] : 0, s = typeof r[2] == "string" ? r[2] : "localhost";
|
|
72
|
-
return {
|
|
73
|
-
message: t,
|
|
74
|
-
offset: 0,
|
|
75
|
-
length: t.length,
|
|
76
|
-
port: o,
|
|
77
|
-
address: s,
|
|
78
|
-
callback: e
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
class d extends V.Duplex {
|
|
83
|
-
_localAddress;
|
|
84
|
-
_remoteAddress;
|
|
85
|
-
_webVPNTcpSocketPromise;
|
|
86
|
-
constructor(e) {
|
|
87
|
-
if (e?.fd !== void 0)
|
|
88
|
-
throw new Error("FKN WebVPN does not support file descriptors");
|
|
89
|
-
super(e), e?.connection && this.__webvpn_tcp_socket_init__(e.connection);
|
|
90
|
-
}
|
|
91
|
-
__webvpn_tcp_socket_init__(e) {
|
|
92
|
-
if (this._webVPNTcpSocketPromise = e.then((t) => {
|
|
93
|
-
const o = t.dataReadableStream.getReader(), s = t.dataWritableStream.getWriter();
|
|
94
|
-
return this._localAddress = {
|
|
95
|
-
address: t.localAddress,
|
|
96
|
-
family: t.localFamily,
|
|
97
|
-
port: t.localPort
|
|
98
|
-
}, this._remoteAddress = {
|
|
99
|
-
address: t.remoteAddress,
|
|
100
|
-
family: t.remoteFamily,
|
|
101
|
-
port: t.remotePort
|
|
102
|
-
}, {
|
|
103
|
-
...t,
|
|
104
|
-
reader: o,
|
|
105
|
-
writer: s
|
|
106
|
-
};
|
|
107
|
-
}).catch((t) => {
|
|
108
|
-
this.emit("error", t);
|
|
109
|
-
}), !this._webVPNTcpSocketPromise)
|
|
110
|
-
throw new Error("Socket not connected");
|
|
111
|
-
return this._webVPNTcpSocketPromise.then((t) => {
|
|
112
|
-
!t || this.emit("connect");
|
|
113
|
-
}), this._webVPNTcpSocketPromise;
|
|
114
|
-
}
|
|
115
|
-
_read(e) {
|
|
116
|
-
if (!this._webVPNTcpSocketPromise)
|
|
117
|
-
throw new Error("Socket not connected");
|
|
118
|
-
this._webVPNTcpSocketPromise.then((t) => {
|
|
119
|
-
if (!t)
|
|
120
|
-
throw new Error("Socket not connected");
|
|
121
|
-
t.reader.read().then(({ value: o, done: s }) => {
|
|
122
|
-
if (s) {
|
|
123
|
-
this.push(null);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
this.push(o);
|
|
127
|
-
}).catch((o) => {
|
|
128
|
-
this.emit("error", o), this.destroy(o);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
_write(e, t, o) {
|
|
133
|
-
if (!this._webVPNTcpSocketPromise)
|
|
134
|
-
throw new Error("Socket not connected");
|
|
135
|
-
this._webVPNTcpSocketPromise.then((s) => {
|
|
136
|
-
if (!s)
|
|
137
|
-
throw new Error("Socket not connected");
|
|
138
|
-
s.writer.write(e), o && o();
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
connect(...e) {
|
|
142
|
-
const t = b(...e), o = this.__webvpn_tcp_socket_init__(
|
|
143
|
-
a.then(
|
|
144
|
-
(s) => s.WEBVPN_TCP_SOCKET({
|
|
145
|
-
remoteAddress: t.host,
|
|
146
|
-
remotePort: t.port
|
|
147
|
-
})
|
|
148
|
-
)
|
|
149
|
-
);
|
|
150
|
-
return t.callback && o.then((s) => {
|
|
151
|
-
!s || t.callback();
|
|
152
|
-
}), this;
|
|
153
|
-
}
|
|
154
|
-
_end(...e) {
|
|
155
|
-
return this._webVPNTcpSocketPromise ? (e.length !== 0 && this.write(e[0], e[1], e[2]), this._webVPNTcpSocketPromise.then(async (t) => {
|
|
156
|
-
!t || await t.end();
|
|
157
|
-
}), this) : this;
|
|
158
|
-
}
|
|
159
|
-
_destroy(e) {
|
|
160
|
-
return this._webVPNTcpSocketPromise ? (this._webVPNTcpSocketPromise.then(async (t) => {
|
|
161
|
-
!t || await t.destroy();
|
|
162
|
-
}), this) : this;
|
|
163
|
-
}
|
|
164
|
-
destroySoon() {
|
|
165
|
-
!this._webVPNTcpSocketPromise || this._webVPNTcpSocketPromise.then(async (e) => {
|
|
166
|
-
!e || await e.destroySoon();
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
resetAndDestroy() {
|
|
170
|
-
return this._webVPNTcpSocketPromise ? (this._webVPNTcpSocketPromise.then(async (e) => {
|
|
171
|
-
!e || await e.resetAndDestroy();
|
|
172
|
-
}), this) : this;
|
|
173
|
-
}
|
|
174
|
-
setTimeout(e, t) {
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
setNoDelay(e) {
|
|
178
|
-
return this;
|
|
179
|
-
}
|
|
180
|
-
setKeepAlive(e, t) {
|
|
181
|
-
return this;
|
|
182
|
-
}
|
|
183
|
-
write(e, t, ...o) {
|
|
184
|
-
return super.write(e, t, ...o);
|
|
185
|
-
}
|
|
186
|
-
address() {
|
|
187
|
-
return this._localAddress ?? {};
|
|
188
|
-
}
|
|
189
|
-
unref() {
|
|
190
|
-
return this;
|
|
191
|
-
}
|
|
192
|
-
ref() {
|
|
193
|
-
return this;
|
|
194
|
-
}
|
|
195
|
-
autoSelectFamilyAttemptedAddresses;
|
|
196
|
-
bufferSize;
|
|
197
|
-
bytesRead;
|
|
198
|
-
bytesWritten;
|
|
199
|
-
connecting;
|
|
200
|
-
pending;
|
|
201
|
-
get localAddress() {
|
|
202
|
-
if (!this._localAddress)
|
|
203
|
-
throw new Error("Socket is not connected");
|
|
204
|
-
return this._localAddress.address;
|
|
205
|
-
}
|
|
206
|
-
get localPort() {
|
|
207
|
-
if (!this._localAddress)
|
|
208
|
-
throw new Error("Socket is not connected");
|
|
209
|
-
return this._localAddress.port;
|
|
210
|
-
}
|
|
211
|
-
get localFamily() {
|
|
212
|
-
if (!this._localAddress)
|
|
213
|
-
throw new Error("Socket is not connected");
|
|
214
|
-
return this._localAddress.family;
|
|
215
|
-
}
|
|
216
|
-
readyState;
|
|
217
|
-
get remoteAddress() {
|
|
218
|
-
if (!this._remoteAddress)
|
|
219
|
-
throw new Error("Socket is not connected");
|
|
220
|
-
return this._remoteAddress.address;
|
|
221
|
-
}
|
|
222
|
-
get remotePort() {
|
|
223
|
-
if (!this._remoteAddress)
|
|
224
|
-
throw new Error("Socket is not connected");
|
|
225
|
-
return this._remoteAddress.port;
|
|
226
|
-
}
|
|
227
|
-
get remoteFamily() {
|
|
228
|
-
if (!this._remoteAddress)
|
|
229
|
-
throw new Error("Socket is not connected");
|
|
230
|
-
return this._remoteAddress.family;
|
|
231
|
-
}
|
|
232
|
-
timeout;
|
|
233
|
-
}
|
|
234
|
-
class u extends p {
|
|
235
|
-
_localAddress;
|
|
236
|
-
_webVPNTcpSocketListenerPromise;
|
|
237
|
-
constructor(e, t) {
|
|
238
|
-
super(e), t && this.on("connection", t), e?.connection && this.__webvpn_tcp_socket_listener_init__(e.connection);
|
|
239
|
-
}
|
|
240
|
-
__webvpn_tcp_socket_listener_init__(e) {
|
|
241
|
-
return this._webVPNTcpSocketListenerPromise = e.then((t) => (this._localAddress = {
|
|
242
|
-
address: t.localAddress,
|
|
243
|
-
family: t.localFamily,
|
|
244
|
-
port: t.localPort
|
|
245
|
-
}, t)).catch((t) => {
|
|
246
|
-
this.emit("error", t);
|
|
247
|
-
}), this._webVPNTcpSocketListenerPromise.then((t) => {
|
|
248
|
-
!t || this.emit("listening");
|
|
249
|
-
}), this._webVPNTcpSocketListenerPromise;
|
|
250
|
-
}
|
|
251
|
-
listen(...e) {
|
|
252
|
-
const t = b(...e), o = this.__webvpn_tcp_socket_listener_init__(
|
|
253
|
-
a.then(
|
|
254
|
-
(s) => s.WEBVPN_TCP_SOCKET_LISTENER({
|
|
255
|
-
localAddress: t.host,
|
|
256
|
-
localPort: t.port,
|
|
257
|
-
onConnection: (n) => {
|
|
258
|
-
const i = new d({ connection: Promise.resolve(n) });
|
|
259
|
-
this.emit("connection", i);
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
)
|
|
263
|
-
);
|
|
264
|
-
return t.callback && o.then((s) => {
|
|
265
|
-
!s || t.callback();
|
|
266
|
-
}), this;
|
|
267
|
-
}
|
|
268
|
-
close(e) {
|
|
269
|
-
return this._webVPNTcpSocketListenerPromise ? (this._webVPNTcpSocketListenerPromise.then((t) => {
|
|
270
|
-
!t || (t.close(), this.emit("close"), this._localAddress = void 0, e && e());
|
|
271
|
-
}), this) : this;
|
|
272
|
-
}
|
|
273
|
-
address() {
|
|
274
|
-
return this._localAddress ?? null;
|
|
275
|
-
}
|
|
276
|
-
getConnections(e) {
|
|
277
|
-
throw new Error("Method not implemented.");
|
|
278
|
-
}
|
|
279
|
-
ref() {
|
|
280
|
-
throw new Error("Method not implemented.");
|
|
281
|
-
}
|
|
282
|
-
unref() {
|
|
283
|
-
throw new Error("Method not implemented.");
|
|
284
|
-
}
|
|
285
|
-
maxConnections;
|
|
286
|
-
connections;
|
|
287
|
-
listening;
|
|
288
|
-
async [Symbol.asyncDispose]() {
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
const y = (r, e) => new d().connect(r, e), k = (r, e) => new d().connect(r, e), A = (r, e) => {
|
|
292
|
-
const t = new u(r);
|
|
293
|
-
return e && t.on("connection", e), t;
|
|
294
|
-
}, f = {
|
|
295
|
-
Socket: d,
|
|
296
|
-
Server: u,
|
|
297
|
-
connect: y,
|
|
298
|
-
createConnection: k,
|
|
299
|
-
createServer: A,
|
|
300
|
-
isIP: S,
|
|
301
|
-
isIPv4: h,
|
|
302
|
-
isIPv6: m
|
|
303
|
-
}, B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
304
|
-
__proto__: null,
|
|
305
|
-
Socket: d,
|
|
306
|
-
Server: u,
|
|
307
|
-
connect: y,
|
|
308
|
-
createConnection: k,
|
|
309
|
-
createServer: A,
|
|
310
|
-
isIP: S,
|
|
311
|
-
isIPv4: h,
|
|
312
|
-
isIPv6: m,
|
|
313
|
-
_default: f,
|
|
314
|
-
default: f
|
|
315
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
316
|
-
class E extends p {
|
|
317
|
-
_type;
|
|
318
|
-
_localAddress;
|
|
319
|
-
_remoteAddress;
|
|
320
|
-
_webVPNUdpSocketPromise;
|
|
321
|
-
constructor(e) {
|
|
322
|
-
if (super(e), !e)
|
|
323
|
-
throw new Error("Missing options");
|
|
324
|
-
this._type = e.type;
|
|
325
|
-
}
|
|
326
|
-
addMembership(e, t) {
|
|
327
|
-
}
|
|
328
|
-
address() {
|
|
329
|
-
if (!this._localAddress)
|
|
330
|
-
throw new Error("EBADF");
|
|
331
|
-
return this._localAddress;
|
|
332
|
-
}
|
|
333
|
-
bind(...e) {
|
|
334
|
-
const t = R(...e);
|
|
335
|
-
return this._webVPNUdpSocketPromise = a.then(
|
|
336
|
-
(o) => o.WEBVPN_UDP_SOCKET({
|
|
337
|
-
type: this._type,
|
|
338
|
-
address: t.address,
|
|
339
|
-
port: t.port
|
|
340
|
-
})
|
|
341
|
-
).then((o) => {
|
|
342
|
-
const s = o.dataReadableStream.getReader(), n = async () => {
|
|
343
|
-
const { value: i, done: N } = await s.read();
|
|
344
|
-
N || (this.emit("message", {
|
|
345
|
-
data: i.data,
|
|
346
|
-
rinfo: {
|
|
347
|
-
address: i.address,
|
|
348
|
-
family: i.family,
|
|
349
|
-
port: i.port,
|
|
350
|
-
size: i.size
|
|
351
|
-
}
|
|
352
|
-
}), n());
|
|
353
|
-
};
|
|
354
|
-
return n(), this._localAddress = {
|
|
355
|
-
address: o.localAddress,
|
|
356
|
-
family: o.localFamily,
|
|
357
|
-
port: o.localPort
|
|
358
|
-
}, o;
|
|
359
|
-
}).catch((o) => {
|
|
360
|
-
this.emit("error", o);
|
|
361
|
-
}), this._webVPNUdpSocketPromise.then((o) => {
|
|
362
|
-
!o || this.emit("listening");
|
|
363
|
-
}), t.callback && this._webVPNUdpSocketPromise.then((o) => {
|
|
364
|
-
!o || t.callback();
|
|
365
|
-
}), this;
|
|
366
|
-
}
|
|
367
|
-
close(e) {
|
|
368
|
-
if (!this._webVPNUdpSocketPromise)
|
|
369
|
-
throw new Error("Socket not bound");
|
|
370
|
-
return this._webVPNUdpSocketPromise.then(async (t) => {
|
|
371
|
-
if (!t)
|
|
372
|
-
throw new Error("Socket not bound");
|
|
373
|
-
await t.close(), e && e(), this.emit("close");
|
|
374
|
-
}), this;
|
|
375
|
-
}
|
|
376
|
-
connect(...e) {
|
|
377
|
-
if (!this._webVPNUdpSocketPromise)
|
|
378
|
-
throw new Error("Socket not bound");
|
|
379
|
-
this._webVPNUdpSocketPromise.then(async (t) => {
|
|
380
|
-
if (!t)
|
|
381
|
-
throw new Error("Socket not bound");
|
|
382
|
-
const o = e[0], s = typeof e[1] == "string" ? e[1] : "localhost", n = typeof e.at(-1) == "function" ? e.at(-1) : void 0;
|
|
383
|
-
await t.connect({ remotePort: o, remoteAddress: s }), n && n();
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
disconnect() {
|
|
387
|
-
if (!this._webVPNUdpSocketPromise)
|
|
388
|
-
throw new Error("Socket not bound");
|
|
389
|
-
this._webVPNUdpSocketPromise.then(async (e) => {
|
|
390
|
-
if (!e)
|
|
391
|
-
throw new Error("Socket not bound");
|
|
392
|
-
await e.connect({ remotePort: 0, remoteAddress: this._type === "udp4" ? "0.0.0.0" : "::" });
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
dropMembership(e, t) {
|
|
396
|
-
}
|
|
397
|
-
getRecvBufferSize() {
|
|
398
|
-
return 0;
|
|
399
|
-
}
|
|
400
|
-
getSendBufferSize() {
|
|
401
|
-
return 0;
|
|
402
|
-
}
|
|
403
|
-
getSendQueueSize() {
|
|
404
|
-
return 0;
|
|
405
|
-
}
|
|
406
|
-
getSendQueueCount() {
|
|
407
|
-
return 0;
|
|
408
|
-
}
|
|
409
|
-
ref() {
|
|
410
|
-
return this;
|
|
411
|
-
}
|
|
412
|
-
remoteAddress() {
|
|
413
|
-
if (!this._remoteAddress)
|
|
414
|
-
throw new Error("ERR_SOCKET_DGRAM_NOT_CONNECTED");
|
|
415
|
-
return {
|
|
416
|
-
address: this._remoteAddress.address,
|
|
417
|
-
family: this._remoteAddress.family,
|
|
418
|
-
port: this._remoteAddress.port
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
send(...e) {
|
|
422
|
-
this._webVPNUdpSocketPromise || this.bind();
|
|
423
|
-
const t = x(...e);
|
|
424
|
-
if (!this._webVPNUdpSocketPromise)
|
|
425
|
-
throw new Error("Socket not bound");
|
|
426
|
-
this._webVPNUdpSocketPromise.then((o) => {
|
|
427
|
-
if (!o)
|
|
428
|
-
throw new Error("Socket not bound");
|
|
429
|
-
const s = typeof t.message == "string" ? I.encode(t.message) : t.message;
|
|
430
|
-
o.send({
|
|
431
|
-
...t,
|
|
432
|
-
message: s.buffer
|
|
433
|
-
});
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
setBroadcast(e) {
|
|
437
|
-
}
|
|
438
|
-
setMulticastInterface(e) {
|
|
439
|
-
}
|
|
440
|
-
setMulticastLoopback(e) {
|
|
441
|
-
return !0;
|
|
442
|
-
}
|
|
443
|
-
setMulticastTTL(e) {
|
|
444
|
-
return e;
|
|
445
|
-
}
|
|
446
|
-
setRecvBufferSize(e) {
|
|
447
|
-
}
|
|
448
|
-
setSendBufferSize(e) {
|
|
449
|
-
}
|
|
450
|
-
setTTL(e) {
|
|
451
|
-
return e;
|
|
452
|
-
}
|
|
453
|
-
unref() {
|
|
454
|
-
return this;
|
|
455
|
-
}
|
|
456
|
-
addSourceSpecificMembership(e, t, o) {
|
|
457
|
-
}
|
|
458
|
-
dropSourceSpecificMembership(e, t, o) {
|
|
459
|
-
}
|
|
460
|
-
async [Symbol.asyncDispose]() {
|
|
461
|
-
await new Promise((e) => {
|
|
462
|
-
this.close(e);
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
const D = (r, e) => {
|
|
467
|
-
const t = new E(
|
|
468
|
-
typeof r == "string" ? { type: r } : r
|
|
469
|
-
);
|
|
470
|
-
return e && t.on("message", e), t;
|
|
471
|
-
}, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
472
|
-
__proto__: null,
|
|
473
|
-
Socket: E,
|
|
474
|
-
createSocket: D
|
|
475
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
476
|
-
export {
|
|
477
|
-
K as dgram,
|
|
478
|
-
B as net,
|
|
479
|
-
W as serverProxyFetch
|
|
480
|
-
};
|
package/build/proxy.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type NativeFetch = typeof globalThis.fetch;
|
|
2
|
-
export type ProxyFetchRequestInit = Omit<RequestInit, "body" | "headers" | "signal"> & {
|
|
3
|
-
body: Exclude<RequestInit['body'], FormData | URLSearchParams>;
|
|
4
|
-
headers: Exclude<RequestInit['headers'], Headers>;
|
|
5
|
-
};
|
|
6
|
-
export type FetchInitOptions = {
|
|
7
|
-
proxyCache?: string | undefined;
|
|
8
|
-
proxyDelay?: string | undefined;
|
|
9
|
-
proxyRuntime?: boolean | undefined;
|
|
10
|
-
noProxy?: boolean | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type ProxyFetchRequestInfo = string | Omit<Request, "arrayBuffer" | "text" | "headers" | "signal" | "clone" | "blob" | "formData" | "json">;
|
|
13
|
-
export declare const serverProxyFetch: (_input: Parameters<NativeFetch>[0], _init?: Parameters<NativeFetch>[1]) => Promise<Response>;
|
package/build/test.d.ts
DELETED
|
File without changes
|
/package/{build/webextension/declarativeNetRequest.d.ts → api/webvpn/packets/metadata.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/{build → lib}/dom.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|