@fkn/lib 0.5.5 → 0.6.1
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 -1
- package/account.d.ts +9 -11
- package/account.js +2 -2
- package/api-BYUraih6.d.ts +524 -0
- package/{api-CDb2pv7C.cjs → api-DD5v1qP9.cjs} +1 -1
- package/{background-DvQm1JHR.js → background-BVBbBOmL.js} +41 -68
- package/background-B_VgpARk.cjs +1 -0
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.d.ts +2 -541
- package/cloud/dgram.js +1 -3
- package/cloud/dns.cjs +1 -1
- package/cloud/dns.d.ts +3 -12
- package/cloud/dns.js +0 -1
- package/cloud/fs/promises.cjs +1 -1
- package/cloud/fs/promises.d.ts +7 -43
- package/cloud/fs/promises.js +0 -3
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +3 -75
- package/cloud/fs.js +3 -4
- package/cloud/http.cjs +1 -1
- package/cloud/http.d.ts +2 -767
- package/cloud/http.js +0 -3
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +2 -606
- package/cloud/net.js +2 -3
- package/cloud-5o7yJHeX.cjs +1 -0
- package/cloud-BFyf2uC7.js +112 -0
- package/cloud-gklfa4ZN.d.ts +41 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +7 -1053
- package/cloud.js +8 -12
- package/{connect-button-poDZVmq2.cjs → connect-button-BBEjXzB3.cjs} +1 -1
- package/connect-button-D8KXSL6s.d.ts +4 -0
- package/desktop.cjs +1 -1
- package/desktop.d.ts +37 -34
- package/desktop.js +1 -1
- package/dgram-CE43gJq9.cjs +1 -0
- package/{dgram-c_Xk7ckJ.js → dgram-wtjARbt0.js} +3 -3
- package/dgram.cjs +1 -1
- package/dgram.d.ts +83 -533
- package/dgram.js +1 -3
- package/dns.cjs +1 -1
- package/dns.d.ts +9 -9
- package/dns.js +2 -2
- package/extension-3pxUYwrA.d.ts +16 -0
- package/extension-CPj10qwa.js +67 -0
- package/extension-D-NUXxzF.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -859
- package/extension.js +3 -5
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +8 -63
- package/fs/promises.js +1 -4
- package/fs-BfmfMBiw.cjs +1 -0
- package/{fs-BQs-x3_j.js → fs-D6nNf1mR.js} +4 -4
- package/fs-K7ROdxDx.d.ts +41 -0
- package/fs.cjs +1 -1
- package/fs.d.ts +81 -131
- package/fs.js +1 -4
- package/http.cjs +2 -2
- package/http.d.ts +152 -733
- package/http.js +7 -7
- package/index-BJztAQIP.d.ts +721 -0
- package/index-C6ZoDJg8.d.ts +31 -0
- package/index.cjs +1 -1
- package/index.d.ts +25 -2313
- package/index.js +23 -26
- package/lookup-BtwWaCZJ.d.ts +7 -0
- package/net-BDW1AVX1.d.ts +140 -0
- package/net-CpuAhaQC.cjs +1 -0
- package/{net-Bl6_W3bd.js → net-DKMWPXb_.js} +3 -3
- package/net.cjs +1 -1
- package/net.d.ts +2 -606
- package/net.js +2 -3
- package/{node-fs-DQn1TGJz.cjs → node-fs-C0eKnboT.cjs} +1 -1
- package/{node-fs-CdKPXPtW.js → node-fs-Dbf93qP7.js} +1 -1
- package/opfs/promises.cjs +1 -1
- package/opfs/promises.d.ts +8 -63
- package/opfs/promises.js +0 -1
- package/{opfs-BfcYLPGb.js → opfs-7_GmzQ93.js} +1 -1
- package/opfs-uClkgnb5.cjs +1 -0
- package/opfs.cjs +1 -1
- package/opfs.d.ts +80 -130
- package/opfs.js +3 -3
- package/package.json +6 -1
- package/packages-D36R2vBv.d.ts +108 -0
- package/packages.cjs +1 -0
- package/packages.d.ts +2 -0
- package/packages.js +150 -0
- package/{locator-9s7jNIA2.js → proxy-C8SG1Beo.js} +542 -344
- package/proxy-bPaU3-Cz.cjs +53 -0
- package/react.cjs +1 -1
- package/react.d.ts +11 -9
- package/react.js +1 -1
- package/{chunk-CPXzm0be.js → rolldown-runtime-DF993M8W.js} +1 -1
- package/rolldown-runtime-Doa5O59j.cjs +1 -0
- package/storage-OkwsFLN1.cjs +1 -0
- package/{storage-BcJfnkm3.js → storage-TmeyhZGt.js} +2 -2
- package/{utils-BsNRWMfl.cjs → utils-CoimMjf9.cjs} +1 -1
- package/background-CbU8TkWo.cjs +0 -1
- package/chunk-B6C_zzib.cjs +0 -1
- package/cloud-CWg9zCWm.cjs +0 -1
- package/cloud-eLyGYzbA.js +0 -33
- package/dgram-B3WC4VdJ.cjs +0 -1
- package/extension-BLkZiaAP.js +0 -253
- package/extension-DAiRg5ny.cjs +0 -1
- package/fs-DI1maxcZ.cjs +0 -1
- package/locator-CHfEe3Jv.cjs +0 -53
- package/net-C5kWnI4C.cjs +0 -1
- package/opfs-Dsi4FkJU.cjs +0 -1
- package/proxy-A9UvWUaF.cjs +0 -1
- package/proxy-wiZN4eTR.js +0 -14
- package/storage-C2-_-bTO.cjs +0 -1
- /package/{api-ByfayMm1.js → api--bnCFd4w.js} +0 -0
- /package/{connect-button-B_63ldmg.js → connect-button-Ds9KpXHe.js} +0 -0
- /package/{utils-CNydj3OT.js → utils-DPtyxGQu.js} +0 -0
package/index.js
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { relay as W } from "osra";
|
|
19
|
-
//#region src/lib/relay.ts
|
|
20
|
-
var G = "https://fkn.app", K = (e, t) => {
|
|
1
|
+
import { A as e, B as t, C as n, E as r, F as i, H as a, I as o, L as s, M as c, O as l, P as u, R as d, S as f, T as p, V as m, a as h, c as g, d as _, i as v, j as y, k as b, l as x, o as S, r as C, s as w, u as T, w as E, x as D, z as O } from "./proxy-C8SG1Beo.js";
|
|
2
|
+
import { r as k, t as A } from "./api--bnCFd4w.js";
|
|
3
|
+
import { i as j, n as M } from "./cloud-BFyf2uC7.js";
|
|
4
|
+
import { t as N } from "./dns.js";
|
|
5
|
+
import { s as P } from "./net-DKMWPXb_.js";
|
|
6
|
+
import { i as F } from "./dgram-wtjARbt0.js";
|
|
7
|
+
import { t as I } from "./http.js";
|
|
8
|
+
import { i as L, n as R, r as z, t as B } from "./extension-CPj10qwa.js";
|
|
9
|
+
import { t as V } from "./desktop.js";
|
|
10
|
+
import { c as H } from "./fs-D6nNf1mR.js";
|
|
11
|
+
import { t as U } from "./opfs.js";
|
|
12
|
+
import { t as W } from "./packages.js";
|
|
13
|
+
import { t as G } from "./account.js";
|
|
14
|
+
import { t as K } from "./connect-button-Ds9KpXHe.js";
|
|
15
|
+
import { relay as q } from "osra";
|
|
16
|
+
//#region src/lib/frame.ts
|
|
17
|
+
var J = (e) => z() || e.syncCookies !== !1 ? h(e) : j(e), Y = "https://fkn.app", X = (e, t) => {
|
|
21
18
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
22
|
-
if (!
|
|
23
|
-
|
|
19
|
+
if (!k?.contentWindow) throw Error("FKN @fkn/lib: relayWorker called before the FKN iframe was injected");
|
|
20
|
+
q({
|
|
24
21
|
receive: window,
|
|
25
|
-
emit:
|
|
22
|
+
emit: k.contentWindow
|
|
26
23
|
}, e, {
|
|
27
24
|
key: "fkn-api",
|
|
28
|
-
originA: t?.originA ??
|
|
25
|
+
originA: t?.originA ?? Y,
|
|
29
26
|
originB: t?.originB ?? "*",
|
|
30
27
|
unregisterSignal: t?.unregisterSignal
|
|
31
28
|
});
|
|
32
|
-
},
|
|
29
|
+
}, Z = async () => typeof window > "u" ? !1 : (await A).connect.prompt(location.origin).catch(() => !1);
|
|
33
30
|
//#endregion
|
|
34
|
-
export {
|
|
31
|
+
export { v as ATTACH_FRAME_EVENT_KEY, G as account, x as assertAttachableFrameUrl, r as assertFetchableUrl, T as assertLockdownApplicable, J as attachFrame, S as attachFramePermission, d as box, M as cloud, Z as connect, K as connectButtonUrl, E as cookies, w as createFrame, O as createVideoElementHandle, V as desktop, F as dgram, N as dns, B as extension, R as fetch, l as fetchCredentialedPermission, b as fetchLocalPermission, e as fetchPermission, H as fs, g as gotoPermission, s as handleRevivableModules, I as http, y as isBlockedFetchUrl, _ as isBlockedFrameUrl, u as isExtensionExposed, c as isLocalNetworkUrl, t as isType, D as modifyRequestHeadersPermission, P as net, U as opfs, W as packages, C as permissions, L as promptInstall, p as readCookiePermission, X as relayWorker, f as removeRequestHeaderRule, m as revive, i as setMissingExtensionHandler, n as setRequestHeaderRule, a as type, o as waitForExtensionExposure };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { i as TcpSocketOption, r as LocalTcpSocket, t as Resolvers } from "./api-BYUraih6.js";
|
|
2
|
+
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
3
|
+
import { DuplexOptions, Stream } from "stream";
|
|
4
|
+
import { EventEmitter } from "events";
|
|
5
|
+
import { BindOptions } from "dgram";
|
|
6
|
+
|
|
7
|
+
//#region src/lib/webvpn/utils.d.ts
|
|
8
|
+
declare const isIPv4: (input: string) => boolean;
|
|
9
|
+
declare const isIPv6: (input: string) => boolean;
|
|
10
|
+
declare const isIP: (input: string) => 0 | 4 | 6;
|
|
11
|
+
declare namespace net_d_exports {
|
|
12
|
+
export { Server$1 as Server, Socket$2 as Socket, _default, connect, createConnection, createServer, _default as default, isIP, isIPv4, isIPv6 };
|
|
13
|
+
}
|
|
14
|
+
type WebVpnTcpSocket = Resolvers['cloud']['webvpn']['tcpSocket'];
|
|
15
|
+
type WebVpnTcpSocketListener = Resolvers['cloud']['webvpn']['tcpSocketListener'];
|
|
16
|
+
declare class Socket$2 extends Stream.Duplex implements Socket {
|
|
17
|
+
_localAddress?: {
|
|
18
|
+
address: string;
|
|
19
|
+
family: string;
|
|
20
|
+
port: number;
|
|
21
|
+
};
|
|
22
|
+
_remoteAddress?: {
|
|
23
|
+
address: string;
|
|
24
|
+
family: string;
|
|
25
|
+
port: number;
|
|
26
|
+
};
|
|
27
|
+
_webVPNTcpSocketPromise?: Promise<(Awaited<ReturnType<WebVpnTcpSocket>> & {
|
|
28
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
29
|
+
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
30
|
+
}) | undefined>;
|
|
31
|
+
constructor(options?: SocketConstructorOpts & DuplexOptions & {
|
|
32
|
+
connection?: ReturnType<WebVpnTcpSocket>;
|
|
33
|
+
});
|
|
34
|
+
__webvpn_tcp_socket_init__(connection: ReturnType<WebVpnTcpSocket>): Promise<(LocalTcpSocket & {
|
|
35
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
36
|
+
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
37
|
+
}) | undefined>;
|
|
38
|
+
/** STREAM IMPL */
|
|
39
|
+
_read(size: number): void;
|
|
40
|
+
_write(chunk: Uint8Array, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
|
41
|
+
/** SOCKET IMPL */
|
|
42
|
+
connect(options: SocketConnectOpts, connectionListener?: (() => void) | undefined): this;
|
|
43
|
+
connect(port: number, host: string, connectionListener?: (() => void) | undefined): this;
|
|
44
|
+
connect(port: number, connectionListener?: (() => void) | undefined): this;
|
|
45
|
+
connect(path: string, connectionListener?: (() => void) | undefined): this;
|
|
46
|
+
connect(port: unknown, host?: unknown, connectionListener?: unknown): this;
|
|
47
|
+
_end(chunk: any, cb?: () => void): this;
|
|
48
|
+
_end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
|
|
49
|
+
_destroy(error?: Error | null | undefined): this;
|
|
50
|
+
destroySoon(): void;
|
|
51
|
+
resetAndDestroy(): this;
|
|
52
|
+
_timeoutMs?: number;
|
|
53
|
+
_timeoutTimer?: ReturnType<typeof setTimeout>;
|
|
54
|
+
_restartTimeoutTimer(): void;
|
|
55
|
+
setTimeout(timeout: number, callback?: (() => void) | undefined): this;
|
|
56
|
+
setNoDelay(noDelay?: boolean | undefined): this;
|
|
57
|
+
setKeepAlive(enable?: boolean | undefined, initialDelay?: number | undefined): this;
|
|
58
|
+
setSendBufferSize(size: number): this;
|
|
59
|
+
setRecvBufferSize(size: number): this;
|
|
60
|
+
_typeOfService?: number;
|
|
61
|
+
getTypeOfService(): number;
|
|
62
|
+
setTypeOfService(tos: number): this;
|
|
63
|
+
_setTcpOption(option: TcpSocketOption): void;
|
|
64
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
65
|
+
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
|
|
66
|
+
address(): AddressInfo | {};
|
|
67
|
+
unref(): this;
|
|
68
|
+
ref(): this;
|
|
69
|
+
autoSelectFamilyAttemptedAddresses: string[];
|
|
70
|
+
bufferSize: number;
|
|
71
|
+
bytesRead: number;
|
|
72
|
+
bytesWritten: number;
|
|
73
|
+
connecting: boolean;
|
|
74
|
+
pending: boolean;
|
|
75
|
+
get localAddress(): string;
|
|
76
|
+
get localPort(): number;
|
|
77
|
+
get localFamily(): string;
|
|
78
|
+
readyState: 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
|
|
79
|
+
get remoteAddress(): string;
|
|
80
|
+
get remotePort(): number;
|
|
81
|
+
get remoteFamily(): string;
|
|
82
|
+
timeout?: number | undefined;
|
|
83
|
+
}
|
|
84
|
+
interface EventEmitterOptions {
|
|
85
|
+
/**
|
|
86
|
+
* Enables automatic capturing of promise rejection.
|
|
87
|
+
*/
|
|
88
|
+
captureRejections?: boolean | undefined;
|
|
89
|
+
}
|
|
90
|
+
declare class Server$1 extends EventEmitter implements Server {
|
|
91
|
+
_localAddress?: {
|
|
92
|
+
address: string;
|
|
93
|
+
family: string;
|
|
94
|
+
port: number;
|
|
95
|
+
};
|
|
96
|
+
_webVPNTcpSocketListenerPromise?: Promise<Awaited<ReturnType<WebVpnTcpSocketListener>> | undefined>;
|
|
97
|
+
constructor(options?: ServerOpts & EventEmitterOptions & {
|
|
98
|
+
connection?: ReturnType<WebVpnTcpSocketListener>;
|
|
99
|
+
}, connectionListener?: (socket: Socket$2) => void);
|
|
100
|
+
__webvpn_tcp_socket_listener_init__(connection: ReturnType<WebVpnTcpSocketListener>): Promise<{
|
|
101
|
+
localAddress: string;
|
|
102
|
+
localFamily: "IPv4" | "IPv6";
|
|
103
|
+
localPort: number;
|
|
104
|
+
close: () => Promise<void>;
|
|
105
|
+
} | undefined>;
|
|
106
|
+
listen(port?: number | undefined, hostname?: string | undefined, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
107
|
+
listen(port?: number | undefined, hostname?: string | undefined, listeningListener?: (() => void) | undefined): this;
|
|
108
|
+
listen(port?: number | undefined, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
109
|
+
listen(port?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
110
|
+
listen(path: string, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
111
|
+
listen(path: string, listeningListener?: (() => void) | undefined): this;
|
|
112
|
+
listen(options: ListenOptions, listeningListener?: (() => void) | undefined): this;
|
|
113
|
+
listen(handle: any, backlog?: number | undefined, listeningListener?: (() => void) | undefined): this;
|
|
114
|
+
listen(handle: any, listeningListener?: (() => void) | undefined): this;
|
|
115
|
+
listen(port?: unknown, hostname?: unknown, backlog?: unknown, listeningListener?: unknown): this;
|
|
116
|
+
close(callback?: ((err?: Error | undefined) => void) | undefined): this;
|
|
117
|
+
address(): string | AddressInfo | null;
|
|
118
|
+
getConnections(cb: (error: Error | null, count: number) => void): this;
|
|
119
|
+
ref(): this;
|
|
120
|
+
unref(): this;
|
|
121
|
+
maxConnections: number;
|
|
122
|
+
connections: number;
|
|
123
|
+
listening: boolean;
|
|
124
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
declare const connect: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
127
|
+
declare const createConnection: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
128
|
+
declare const createServer: (options?: ServerOpts | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
129
|
+
declare const _default: {
|
|
130
|
+
Socket: typeof Socket$2;
|
|
131
|
+
Server: typeof Server$1;
|
|
132
|
+
connect: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
133
|
+
createConnection: (options: SocketConnectOpts, connectionListener?: () => void) => Socket$2;
|
|
134
|
+
createServer: (options?: ServerOpts | ((socket: Socket$2) => void), connectionListener?: (socket: Socket$2) => void) => Server$1;
|
|
135
|
+
isIP: (input: string) => 0 | 4 | 6;
|
|
136
|
+
isIPv4: (input: string) => boolean;
|
|
137
|
+
isIPv6: (input: string) => boolean;
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { createConnection as a, isIP as c, connect as i, isIPv4 as l, Socket$2 as n, createServer as o, _default as r, net_d_exports as s, Server$1 as t, isIPv6 as u };
|
package/net-CpuAhaQC.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-Doa5O59j.cjs"),t=require("./api-DD5v1qP9.cjs"),n=require("./utils-CoimMjf9.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}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as e } from "./
|
|
2
|
-
import { t } from "./api
|
|
3
|
-
import { n, o as r, r as i, t as a } from "./utils-
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DF993M8W.js";
|
|
2
|
+
import { t } from "./api--bnCFd4w.js";
|
|
3
|
+
import { n, o as r, r as i, t as a } from "./utils-DPtyxGQu.js";
|
|
4
4
|
import { Stream as o } from "stream";
|
|
5
5
|
import { EventEmitter as s } from "events";
|
|
6
6
|
//#region src/lib/webvpn/net.ts
|
package/net.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}})
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./utils-CoimMjf9.cjs"),t=require("./net-CpuAhaQC.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;
|