@fkn/lib 0.4.8 → 0.5.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/account.cjs +1 -0
- package/account.d.ts +17 -0
- package/account.js +28 -0
- package/api-ByfayMm1.js +67 -0
- package/api-CDb2pv7C.cjs +1 -0
- package/background-Dk_vaVP1.cjs +1 -0
- package/{background-CTsVv_a0.js → background-TtzKw6g0.js} +5 -4
- package/chunk-B6C_zzib.cjs +1 -0
- package/chunk-CPXzm0be.js +11 -0
- package/cloud/dgram.cjs +1 -0
- package/cloud/dgram.d.ts +537 -0
- package/cloud/dgram.js +4 -0
- package/cloud/dns.cjs +1 -0
- package/cloud/dns.d.ts +12 -0
- package/cloud/dns.js +3 -0
- package/cloud/fs/promises.cjs +1 -0
- package/cloud/fs/promises.d.ts +45 -0
- package/cloud/fs/promises.js +8 -0
- package/cloud/fs.cjs +1 -0
- package/cloud/fs.d.ts +75 -0
- package/cloud/fs.js +20 -0
- package/cloud/http.cjs +1 -0
- package/cloud/http.d.ts +767 -0
- package/cloud/http.js +5 -0
- package/cloud/net.cjs +1 -0
- package/cloud/net.d.ts +606 -0
- package/cloud/net.js +4 -0
- package/cloud-BVnscun4.js +33 -0
- package/cloud-DTL2B5pW.cjs +1 -0
- package/cloud.cjs +1 -0
- package/cloud.d.ts +1048 -0
- package/cloud.js +12 -0
- package/desktop.cjs +1 -0
- package/desktop.d.ts +49 -0
- package/desktop.js +51 -0
- package/dgram-5YUb70O2.js +326 -0
- package/dgram-Cdi6Y7zJ.cjs +1 -0
- package/dgram.cjs +1 -0
- package/dgram.d.ts +537 -0
- package/dgram.js +4 -0
- package/dns.cjs +1 -0
- package/dns.d.ts +12 -0
- package/dns.js +6 -0
- package/extension-9Uv_0HdS.cjs +1 -0
- package/extension-Dgz0UTy0.js +245 -0
- package/extension.cjs +1 -0
- package/extension.d.ts +853 -0
- package/extension.js +5 -0
- package/fs/promises.cjs +1 -0
- package/fs/promises.d.ts +46 -0
- package/fs/promises.js +8 -0
- package/fs-B7JumDCn.js +78 -0
- package/fs-DrwvwtqC.cjs +1 -0
- package/fs.cjs +1 -0
- package/fs.d.ts +84 -0
- package/fs.js +5 -0
- package/http.cjs +9 -0
- package/http.d.ts +767 -0
- package/http.js +541 -0
- package/index.cjs +1 -9
- package/index.d.ts +495 -268
- package/index.js +27 -1569
- package/locator-Cf7M3QKN.cjs +53 -0
- package/{locator-Q5m8i40Z.js → locator-DxAsGV_o.js} +331 -337
- package/net-Bl6_W3bd.js +275 -0
- package/net-C5kWnI4C.cjs +1 -0
- package/net.cjs +1 -0
- package/net.d.ts +606 -0
- package/net.js +4 -0
- package/node-fs-Bd_UUx1m.js +361 -0
- package/node-fs-lrlD_zqB.cjs +1 -0
- package/opfs/promises.cjs +1 -0
- package/opfs/promises.d.ts +46 -0
- package/opfs/promises.js +6 -0
- package/opfs-BfcYLPGb.js +55 -0
- package/opfs-Dsi4FkJU.cjs +1 -0
- package/opfs.cjs +1 -0
- package/opfs.d.ts +83 -0
- package/opfs.js +35 -0
- package/package.json +91 -1
- package/proxy-A9UvWUaF.cjs +1 -0
- package/proxy-wiZN4eTR.js +14 -0
- package/storage-BadvHtv0.cjs +1 -0
- package/storage-z0q3iena.js +13 -0
- package/utils-BsNRWMfl.cjs +1 -0
- package/utils-CNydj3OT.js +52 -0
- package/background-BqRFQggD.cjs +0 -1
- package/locator-Cjl21Nkt.cjs +0 -53
package/net-Bl6_W3bd.js
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { n as e } from "./chunk-CPXzm0be.js";
|
|
2
|
+
import { t } from "./api-ByfayMm1.js";
|
|
3
|
+
import { n, o as r, r as i, t as a } from "./utils-CNydj3OT.js";
|
|
4
|
+
import { Stream as o } from "stream";
|
|
5
|
+
import { EventEmitter as s } from "events";
|
|
6
|
+
//#region src/lib/webvpn/net.ts
|
|
7
|
+
var c = /* @__PURE__ */ e({
|
|
8
|
+
Server: () => u,
|
|
9
|
+
Socket: () => l,
|
|
10
|
+
_default: () => m,
|
|
11
|
+
connect: () => d,
|
|
12
|
+
createConnection: () => f,
|
|
13
|
+
createServer: () => p,
|
|
14
|
+
default: () => m,
|
|
15
|
+
isIP: () => a,
|
|
16
|
+
isIPv4: () => n,
|
|
17
|
+
isIPv6: () => i
|
|
18
|
+
}), l = class extends o.Duplex {
|
|
19
|
+
_localAddress;
|
|
20
|
+
_remoteAddress;
|
|
21
|
+
_webVPNTcpSocketPromise;
|
|
22
|
+
constructor(e) {
|
|
23
|
+
if (e?.fd !== void 0) throw Error("FKN WebVPN does not support file descriptors");
|
|
24
|
+
super(e), e?.connection && this.__webvpn_tcp_socket_init__(e.connection);
|
|
25
|
+
}
|
|
26
|
+
__webvpn_tcp_socket_init__(e) {
|
|
27
|
+
if (this._webVPNTcpSocketPromise = e.then((e) => {
|
|
28
|
+
let t = e.dataReadableStream.getReader(), n = e.dataWritableStream.getWriter();
|
|
29
|
+
return this._localAddress = {
|
|
30
|
+
address: e.localAddress,
|
|
31
|
+
family: e.localFamily,
|
|
32
|
+
port: e.localPort
|
|
33
|
+
}, this._remoteAddress = {
|
|
34
|
+
address: e.remoteAddress,
|
|
35
|
+
family: e.remoteFamily,
|
|
36
|
+
port: e.remotePort
|
|
37
|
+
}, {
|
|
38
|
+
...e,
|
|
39
|
+
reader: t,
|
|
40
|
+
writer: n
|
|
41
|
+
};
|
|
42
|
+
}).catch((e) => {
|
|
43
|
+
this.emit("error", e);
|
|
44
|
+
}), !this._webVPNTcpSocketPromise) throw Error("Socket not connected");
|
|
45
|
+
return this._webVPNTcpSocketPromise.then((e) => {
|
|
46
|
+
e && this.emit("connect");
|
|
47
|
+
}), this._webVPNTcpSocketPromise;
|
|
48
|
+
}
|
|
49
|
+
_read(e) {
|
|
50
|
+
if (!this._webVPNTcpSocketPromise) throw Error("Socket not connected");
|
|
51
|
+
this._webVPNTcpSocketPromise.then((e) => {
|
|
52
|
+
if (!e) {
|
|
53
|
+
this.push(null);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e.reader.read().then(({ value: e, done: t }) => {
|
|
57
|
+
if (t) {
|
|
58
|
+
this.push(null);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this._restartTimeoutTimer(), this.push(e);
|
|
62
|
+
}).catch((e) => {
|
|
63
|
+
this.destroy(e);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
_write(e, t, n) {
|
|
68
|
+
if (!this._webVPNTcpSocketPromise) {
|
|
69
|
+
n(/* @__PURE__ */ Error("Socket not connected"));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this._webVPNTcpSocketPromise.then(async (t) => {
|
|
73
|
+
if (!t) throw Error("Socket not connected");
|
|
74
|
+
await t.writer.ready, await t.writer.write(e), this._restartTimeoutTimer(), n();
|
|
75
|
+
}).catch(n);
|
|
76
|
+
}
|
|
77
|
+
connect(...e) {
|
|
78
|
+
let n = r(...e), i = this.__webvpn_tcp_socket_init__(t.then((e) => e.cloud.webvpn.tcpSocket({
|
|
79
|
+
remoteAddress: n.host ?? "localhost",
|
|
80
|
+
remotePort: n.port
|
|
81
|
+
})));
|
|
82
|
+
return n.callback && i.then((e) => {
|
|
83
|
+
e && n.callback.call(this);
|
|
84
|
+
}), this;
|
|
85
|
+
}
|
|
86
|
+
_end(...e) {
|
|
87
|
+
return this._webVPNTcpSocketPromise ? (e.length !== 0 && this.write(e[0], e[1], e[2]), this._webVPNTcpSocketPromise.then(async (e) => {
|
|
88
|
+
e && await e.end();
|
|
89
|
+
}), this) : this;
|
|
90
|
+
}
|
|
91
|
+
_destroy(e) {
|
|
92
|
+
return this._timeoutTimer && clearTimeout(this._timeoutTimer), this._webVPNTcpSocketPromise && this._webVPNTcpSocketPromise.then(async (e) => {
|
|
93
|
+
e && await e.destroy();
|
|
94
|
+
}), this;
|
|
95
|
+
}
|
|
96
|
+
destroySoon() {
|
|
97
|
+
this._webVPNTcpSocketPromise && this._webVPNTcpSocketPromise.then(async (e) => {
|
|
98
|
+
e && await e.destroySoon();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
resetAndDestroy() {
|
|
102
|
+
return this._webVPNTcpSocketPromise && this._webVPNTcpSocketPromise.then(async (e) => {
|
|
103
|
+
e && await e.resetAndDestroy();
|
|
104
|
+
}), this;
|
|
105
|
+
}
|
|
106
|
+
_timeoutMs;
|
|
107
|
+
_timeoutTimer;
|
|
108
|
+
_restartTimeoutTimer() {
|
|
109
|
+
this._timeoutTimer && clearTimeout(this._timeoutTimer), this._timeoutMs && (this._timeoutTimer = setTimeout(() => this.emit("timeout"), this._timeoutMs));
|
|
110
|
+
}
|
|
111
|
+
setTimeout(e, t) {
|
|
112
|
+
return t && this.on("timeout", t), this._timeoutMs = e, this._restartTimeoutTimer(), this;
|
|
113
|
+
}
|
|
114
|
+
setNoDelay(e) {
|
|
115
|
+
let t = e ?? !0;
|
|
116
|
+
return this._setTcpOption({
|
|
117
|
+
type: 0,
|
|
118
|
+
value: t
|
|
119
|
+
}), this;
|
|
120
|
+
}
|
|
121
|
+
setKeepAlive(e, t) {
|
|
122
|
+
let n = e ?? !1, r = t !== void 0 && t > 0 ? Math.max(1, Math.round(t / 1e3)) : 0;
|
|
123
|
+
return this._setTcpOption({
|
|
124
|
+
type: 2,
|
|
125
|
+
enabled: n,
|
|
126
|
+
initialDelaySeconds: r
|
|
127
|
+
}), this;
|
|
128
|
+
}
|
|
129
|
+
setSendBufferSize(e) {
|
|
130
|
+
return this._setTcpOption({
|
|
131
|
+
type: 3,
|
|
132
|
+
value: e
|
|
133
|
+
}), this;
|
|
134
|
+
}
|
|
135
|
+
setRecvBufferSize(e) {
|
|
136
|
+
return this._setTcpOption({
|
|
137
|
+
type: 4,
|
|
138
|
+
value: e
|
|
139
|
+
}), this;
|
|
140
|
+
}
|
|
141
|
+
_typeOfService;
|
|
142
|
+
getTypeOfService() {
|
|
143
|
+
return this._typeOfService ?? 0;
|
|
144
|
+
}
|
|
145
|
+
setTypeOfService(e) {
|
|
146
|
+
return this._typeOfService = e, this;
|
|
147
|
+
}
|
|
148
|
+
_setTcpOption(e) {
|
|
149
|
+
if (!this._webVPNTcpSocketPromise) {
|
|
150
|
+
this.emit("error", /* @__PURE__ */ Error("Cannot set socket option before connect"));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this._webVPNTcpSocketPromise.then(async (t) => {
|
|
154
|
+
if (t) try {
|
|
155
|
+
await t.setOption(e);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
this.emit("error", e);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
write(e, t, ...n) {
|
|
162
|
+
return super.write(e, t, ...n);
|
|
163
|
+
}
|
|
164
|
+
address() {
|
|
165
|
+
return this._localAddress ?? {};
|
|
166
|
+
}
|
|
167
|
+
unref() {
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
ref() {
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
autoSelectFamilyAttemptedAddresses;
|
|
174
|
+
bufferSize;
|
|
175
|
+
bytesRead;
|
|
176
|
+
bytesWritten;
|
|
177
|
+
connecting;
|
|
178
|
+
pending;
|
|
179
|
+
get localAddress() {
|
|
180
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
181
|
+
return this._localAddress.address;
|
|
182
|
+
}
|
|
183
|
+
get localPort() {
|
|
184
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
185
|
+
return this._localAddress.port;
|
|
186
|
+
}
|
|
187
|
+
get localFamily() {
|
|
188
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
189
|
+
return this._localAddress.family;
|
|
190
|
+
}
|
|
191
|
+
readyState;
|
|
192
|
+
get remoteAddress() {
|
|
193
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
194
|
+
return this._remoteAddress.address;
|
|
195
|
+
}
|
|
196
|
+
get remotePort() {
|
|
197
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
198
|
+
return this._remoteAddress.port;
|
|
199
|
+
}
|
|
200
|
+
get remoteFamily() {
|
|
201
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
202
|
+
return this._remoteAddress.family;
|
|
203
|
+
}
|
|
204
|
+
timeout;
|
|
205
|
+
}, u = class extends s {
|
|
206
|
+
_localAddress;
|
|
207
|
+
_webVPNTcpSocketListenerPromise;
|
|
208
|
+
constructor(e, t) {
|
|
209
|
+
super(e), t && this.on("connection", t), e?.connection && this.__webvpn_tcp_socket_listener_init__(e.connection);
|
|
210
|
+
}
|
|
211
|
+
__webvpn_tcp_socket_listener_init__(e) {
|
|
212
|
+
return this._webVPNTcpSocketListenerPromise = e.then((e) => (this._localAddress = {
|
|
213
|
+
address: e.localAddress,
|
|
214
|
+
family: e.localFamily,
|
|
215
|
+
port: e.localPort
|
|
216
|
+
}, e)).catch((e) => {
|
|
217
|
+
this.emit("error", e);
|
|
218
|
+
}), this._webVPNTcpSocketListenerPromise.then((e) => {
|
|
219
|
+
e && this.emit("listening");
|
|
220
|
+
}), this._webVPNTcpSocketListenerPromise;
|
|
221
|
+
}
|
|
222
|
+
listen(...e) {
|
|
223
|
+
let n = r(...e), i = (e) => {
|
|
224
|
+
let t = new l({ connection: Promise.resolve(e) });
|
|
225
|
+
this.emit("connection", t);
|
|
226
|
+
}, a = (e) => t.then((t) => t.cloud.webvpn.tcpSocketListener({
|
|
227
|
+
localAddress: e,
|
|
228
|
+
localPort: n.port,
|
|
229
|
+
onConnection: i
|
|
230
|
+
})), o = n.host ? a(n.host) : a("::").catch(() => a("0.0.0.0")), s = this.__webvpn_tcp_socket_listener_init__(o);
|
|
231
|
+
return n.callback && s.then((e) => {
|
|
232
|
+
e && n.callback.call(this);
|
|
233
|
+
}), this;
|
|
234
|
+
}
|
|
235
|
+
close(e) {
|
|
236
|
+
return this._webVPNTcpSocketListenerPromise && this._webVPNTcpSocketListenerPromise.then(async (t) => {
|
|
237
|
+
if (t) try {
|
|
238
|
+
await t.close(), this._localAddress = void 0, this.emit("close"), e && e();
|
|
239
|
+
} catch (t) {
|
|
240
|
+
this._localAddress = void 0, this.emit("close"), e && e(t);
|
|
241
|
+
}
|
|
242
|
+
}), this;
|
|
243
|
+
}
|
|
244
|
+
address() {
|
|
245
|
+
return this._localAddress ?? null;
|
|
246
|
+
}
|
|
247
|
+
getConnections(e) {
|
|
248
|
+
throw Error("Method not implemented.");
|
|
249
|
+
}
|
|
250
|
+
ref() {
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
unref() {
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
maxConnections;
|
|
257
|
+
connections;
|
|
258
|
+
listening;
|
|
259
|
+
async [Symbol.asyncDispose]() {}
|
|
260
|
+
}, d = (e, t) => new l().connect(e, t), f = (e, t) => new l().connect(e, t), p = (e, t) => {
|
|
261
|
+
typeof e == "function" && (t = e, e = void 0);
|
|
262
|
+
let n = new u(e);
|
|
263
|
+
return t && n.on("connection", t), n;
|
|
264
|
+
}, m = {
|
|
265
|
+
Socket: l,
|
|
266
|
+
Server: u,
|
|
267
|
+
connect: d,
|
|
268
|
+
createConnection: f,
|
|
269
|
+
createServer: p,
|
|
270
|
+
isIP: a,
|
|
271
|
+
isIPv4: n,
|
|
272
|
+
isIPv6: i
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
export { f as a, d as i, l as n, p as o, m as r, c as s, u as t };
|
package/net-C5kWnI4C.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-B6C_zzib.cjs`),t=require(`./api-CDb2pv7C.cjs`),n=require(`./utils-BsNRWMfl.cjs`);let r=require(`stream`),i=require(`events`);var a=e.n({Server:()=>s,Socket:()=>o,_default:()=>d,connect:()=>c,createConnection:()=>l,createServer:()=>u,default:()=>d,isIP:()=>n.t,isIPv4:()=>n.n,isIPv6:()=>n.r}),o=class extends r.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}__webvpn_tcp_socket_init__(e){if(this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{e&&this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n)}connect(...e){let r=n.o(...e),i=this.__webvpn_tcp_socket_init__(t.t.then(e=>e.cloud.webvpn.tcpSocket({remoteAddress:r.host??`localhost`,remotePort:r.port})));return r.callback&&i.then(e=>{e&&r.callback.call(this)}),this}_end(...e){return this._webVPNTcpSocketPromise?(e.length!==0&&this.write(e[0],e[1],e[2]),this._webVPNTcpSocketPromise.then(async e=>{e&&await e.end()}),this):this}_destroy(e){return this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroy()}),this}destroySoon(){this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroySoon()})}resetAndDestroy(){return this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.resetAndDestroy()}),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},s=class extends i.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}__webvpn_tcp_socket_listener_init__(e){return this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let r=n.o(...e),i=e=>{let t=new o({connection:Promise.resolve(e)});this.emit(`connection`,t)},a=e=>t.t.then(t=>t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:r.port,onConnection:i})),s=r.host?a(r.host):a(`::`).catch(()=>a(`0.0.0.0`)),c=this.__webvpn_tcp_socket_listener_init__(s);return r.callback&&c.then(e=>{e&&r.callback.call(this)}),this}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this.emit(`close`),e&&e()}catch(t){this._localAddress=void 0,this.emit(`close`),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},c=(e,t)=>new o().connect(e,t),l=(e,t)=>new o().connect(e,t),u=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new s(e);return t&&n.on(`connection`,t),n},d={Socket:o,Server:s,connect:c,createConnection:l,createServer:u,isIP:n.t,isIPv4:n.n,isIPv6:n.r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
package/net.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./api-CDb2pv7C.cjs`);const e=require(`./utils-BsNRWMfl.cjs`),t=require(`./net-C5kWnI4C.cjs`);exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.t,exports.isIPv4=e.n,exports.isIPv6=e.r;
|