@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 → lib}/api.d.ts
RENAMED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export type { Resolvers } from '../api';
|
|
1
2
|
export declare const apiPromise: Promise<{
|
|
2
|
-
readonly
|
|
3
|
+
readonly dnsLookup: <T extends boolean = false>(hostname: string, options?: {
|
|
4
|
+
all?: T;
|
|
5
|
+
family: 0 | 4 | 6;
|
|
6
|
+
}) => Promise<T extends true ? import('../api/dns').AddressLookupResult[] : import('../api/dns').AddressLookupResult | undefined>;
|
|
7
|
+
readonly webVpnTcpSocket: ({ remoteAddress: _remoteAddress, remotePort }: {
|
|
3
8
|
remoteAddress: string;
|
|
4
9
|
remotePort: number;
|
|
5
10
|
}) => Promise<{
|
|
@@ -9,24 +14,25 @@ export declare const apiPromise: Promise<{
|
|
|
9
14
|
remoteAddress: string;
|
|
10
15
|
remoteFamily: "IPv4" | "IPv6";
|
|
11
16
|
remotePort: number;
|
|
12
|
-
dataReadableStream: ReadableStream<Uint8Array<
|
|
13
|
-
dataWritableStream: WritableStream<Uint8Array<
|
|
17
|
+
dataReadableStream: ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
18
|
+
dataWritableStream: WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
14
19
|
end: () => Promise<void>;
|
|
15
20
|
destroy: () => Promise<void>;
|
|
16
21
|
destroySoon: () => Promise<void>;
|
|
17
22
|
resetAndDestroy: () => Promise<void>;
|
|
23
|
+
setOption: (option: import('../api/webvpn/tcp').TcpSocketOption) => Promise<void>;
|
|
18
24
|
}>;
|
|
19
|
-
readonly
|
|
25
|
+
readonly webVpnTcpSocketListener: ({ localAddress: _localAddress, localPort, onConnection }: {
|
|
20
26
|
localAddress: string;
|
|
21
27
|
localPort: number;
|
|
22
|
-
onConnection: (connection: import('
|
|
28
|
+
onConnection: (connection: import('../api/webvpn/tcp').TcpSocketResult) => void;
|
|
23
29
|
}) => Promise<{
|
|
24
30
|
localAddress: string;
|
|
25
31
|
localFamily: "IPv4" | "IPv6";
|
|
26
32
|
localPort: number;
|
|
27
33
|
close: () => Promise<void>;
|
|
28
34
|
}>;
|
|
29
|
-
readonly
|
|
35
|
+
readonly webVpnUdpSocket: ({ type, port, address }: {
|
|
30
36
|
type: "udp4" | "udp6";
|
|
31
37
|
port: number;
|
|
32
38
|
address: string;
|
|
@@ -51,22 +57,9 @@ export declare const apiPromise: Promise<{
|
|
|
51
57
|
port?: number;
|
|
52
58
|
}) => Promise<void>;
|
|
53
59
|
close: () => Promise<void>;
|
|
60
|
+
setOption: (option: import('../api/webvpn/udp').UdpSocketOption) => Promise<void>;
|
|
54
61
|
}>;
|
|
55
|
-
readonly
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, callback: (err: Error | undefined, addresses: import('@mfkn/web/src/api/dns').AddressLookupResult | import('@mfkn/web/src/api/dns').AddressLookupResult[] | undefined) => void) => Promise<void>;
|
|
59
|
-
readonly SERVER_PROXY_FETCH: ({ input, init }: {
|
|
60
|
-
input: import('@mfkn/web/src/api/proxy/server-proxy-fetch').ProxyFetchRequestInfo;
|
|
61
|
-
init?: import('@mfkn/web/src/api/proxy/server-proxy-fetch').ProxyFetchRequestInit;
|
|
62
|
-
}) => Promise<{
|
|
63
|
-
headers: any;
|
|
64
|
-
body: ReadableStream<Uint8Array<ArrayBufferLike>> | null;
|
|
65
|
-
type: ResponseType;
|
|
66
|
-
url: string;
|
|
67
|
-
ok: boolean;
|
|
68
|
-
redirected: boolean;
|
|
69
|
-
status: number;
|
|
70
|
-
statusText: string;
|
|
71
|
-
}>;
|
|
62
|
+
readonly proxyFetch: (input: string | URL | Request, init?: (RequestInit | undefined) & {
|
|
63
|
+
render?: boolean;
|
|
64
|
+
}) => Promise<Response>;
|
|
72
65
|
}>;
|
package/lib/proxy.d.ts
ADDED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BindOptions, Socket as DgramSocket, RemoteInfo, SocketOptions, SocketType } from 'dgram';
|
|
2
2
|
import { AddressInfo } from 'net';
|
|
3
|
-
import {
|
|
3
|
+
import { Resolvers } from '../api';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
+
import { UdpSocketOption } from '../../api/webvpn/udp';
|
|
5
6
|
interface EventEmitterOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Enables automatic capturing of promise rejection.
|
|
@@ -20,10 +21,16 @@ export declare class Socket extends EventEmitter implements DgramSocket {
|
|
|
20
21
|
family: string;
|
|
21
22
|
port: number;
|
|
22
23
|
};
|
|
23
|
-
_webVPNUdpSocketPromise?: Promise<Awaited<ReturnType<
|
|
24
|
+
_webVPNUdpSocketPromise?: Promise<Awaited<ReturnType<Resolvers['webVpnUdpSocket']>> | undefined>;
|
|
24
25
|
constructor(options: SocketOptions & EventEmitterOptions & {
|
|
25
|
-
connection?: ReturnType<
|
|
26
|
+
connection?: ReturnType<Resolvers['webVpnUdpSocket']>;
|
|
26
27
|
});
|
|
28
|
+
_lastRecvBufferSize: number;
|
|
29
|
+
_lastSendBufferSize: number;
|
|
30
|
+
_lastTtl: number;
|
|
31
|
+
_lastMulticastTtl: number;
|
|
32
|
+
_lastMulticastLoopback: boolean;
|
|
33
|
+
_setUdpOption(option: UdpSocketOption): void;
|
|
27
34
|
addMembership(multicastAddress: string, multicastInterface?: string | undefined): void;
|
|
28
35
|
address(): AddressInfo;
|
|
29
36
|
bind(port?: number | undefined, address?: string | undefined, callback?: (() => void) | undefined): this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Socket as NetSocket, SocketConnectOpts, SocketConstructorOpts, Server as TCPServer, ServerOpts, ListenOptions, AddressInfo } from 'net';
|
|
2
|
-
import {
|
|
2
|
+
import { Resolvers } from '../api';
|
|
3
3
|
import { DuplexOptions, Stream } from 'stream';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { isIP, isIPv4, isIPv6 } from './utils';
|
|
@@ -14,26 +14,27 @@ export declare class Socket extends Stream.Duplex implements NetSocket {
|
|
|
14
14
|
family: string;
|
|
15
15
|
port: number;
|
|
16
16
|
};
|
|
17
|
-
_webVPNTcpSocketPromise?: Promise<(Awaited<ReturnType<
|
|
17
|
+
_webVPNTcpSocketPromise?: Promise<(Awaited<ReturnType<Resolvers['webVpnTcpSocket']>> & {
|
|
18
18
|
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
19
19
|
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
20
20
|
}) | undefined>;
|
|
21
21
|
constructor(options?: SocketConstructorOpts & DuplexOptions & {
|
|
22
|
-
connection?: ReturnType<
|
|
22
|
+
connection?: ReturnType<Resolvers['webVpnTcpSocket']>;
|
|
23
23
|
});
|
|
24
|
-
__webvpn_tcp_socket_init__(connection: ReturnType<
|
|
24
|
+
__webvpn_tcp_socket_init__(connection: ReturnType<Resolvers['webVpnTcpSocket']>): Promise<({
|
|
25
25
|
localAddress: string;
|
|
26
26
|
localFamily: "IPv4" | "IPv6";
|
|
27
27
|
localPort: number;
|
|
28
28
|
remoteAddress: string;
|
|
29
29
|
remoteFamily: "IPv4" | "IPv6";
|
|
30
30
|
remotePort: number;
|
|
31
|
-
dataReadableStream: ReadableStream<Uint8Array<
|
|
32
|
-
dataWritableStream: WritableStream<Uint8Array<
|
|
31
|
+
dataReadableStream: ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
32
|
+
dataWritableStream: WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
33
33
|
end: () => Promise<void>;
|
|
34
34
|
destroy: () => Promise<void>;
|
|
35
35
|
destroySoon: () => Promise<void>;
|
|
36
36
|
resetAndDestroy: () => Promise<void>;
|
|
37
|
+
setOption: (option: import('../../api/webvpn/tcp').TcpSocketOption) => Promise<void>;
|
|
37
38
|
} & {
|
|
38
39
|
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
39
40
|
writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
@@ -52,9 +53,15 @@ export declare class Socket extends Stream.Duplex implements NetSocket {
|
|
|
52
53
|
_destroy(error?: Error | null | undefined): this;
|
|
53
54
|
destroySoon(): void;
|
|
54
55
|
resetAndDestroy(): this;
|
|
56
|
+
_timeoutMs?: number;
|
|
57
|
+
_timeoutTimer?: ReturnType<typeof setTimeout>;
|
|
58
|
+
_restartTimeoutTimer(): void;
|
|
55
59
|
setTimeout(timeout: number, callback?: (() => void) | undefined): this;
|
|
56
60
|
setNoDelay(noDelay?: boolean | undefined): this;
|
|
57
61
|
setKeepAlive(enable?: boolean | undefined, initialDelay?: number | undefined): this;
|
|
62
|
+
setSendBufferSize(size: number): this;
|
|
63
|
+
setRecvBufferSize(size: number): this;
|
|
64
|
+
_setTcpOption(option: import('../../api/webvpn/tcp').TcpSocketOption): void;
|
|
58
65
|
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
59
66
|
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
|
|
60
67
|
address(): AddressInfo | {};
|
|
@@ -69,7 +76,7 @@ export declare class Socket extends Stream.Duplex implements NetSocket {
|
|
|
69
76
|
get localAddress(): string;
|
|
70
77
|
get localPort(): number;
|
|
71
78
|
get localFamily(): string;
|
|
72
|
-
readyState:
|
|
79
|
+
readyState: 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
|
|
73
80
|
get remoteAddress(): string;
|
|
74
81
|
get remotePort(): number;
|
|
75
82
|
get remoteFamily(): string;
|
|
@@ -87,11 +94,11 @@ export declare class Server extends EventEmitter implements TCPServer {
|
|
|
87
94
|
family: string;
|
|
88
95
|
port: number;
|
|
89
96
|
};
|
|
90
|
-
_webVPNTcpSocketListenerPromise?: Promise<Awaited<ReturnType<
|
|
97
|
+
_webVPNTcpSocketListenerPromise?: Promise<Awaited<ReturnType<Resolvers['webVpnTcpSocketListener']>> | undefined>;
|
|
91
98
|
constructor(options?: ServerOpts & EventEmitterOptions & {
|
|
92
|
-
connection?: ReturnType<
|
|
99
|
+
connection?: ReturnType<Resolvers['webVpnTcpSocketListener']>;
|
|
93
100
|
}, connectionListener?: (socket: Socket) => void);
|
|
94
|
-
__webvpn_tcp_socket_listener_init__(connection: ReturnType<
|
|
101
|
+
__webvpn_tcp_socket_listener_init__(connection: ReturnType<Resolvers['webVpnTcpSocketListener']>): Promise<{
|
|
95
102
|
localAddress: string;
|
|
96
103
|
localFamily: "IPv4" | "IPv6";
|
|
97
104
|
localPort: number;
|
|
@@ -109,7 +116,7 @@ export declare class Server extends EventEmitter implements TCPServer {
|
|
|
109
116
|
listen(port?: unknown, hostname?: unknown, backlog?: unknown, listeningListener?: unknown): this;
|
|
110
117
|
close(callback?: ((err?: Error | undefined) => void) | undefined): this;
|
|
111
118
|
address(): string | AddressInfo | null;
|
|
112
|
-
getConnections(cb: (error: Error | null, count: number) => void):
|
|
119
|
+
getConnections(cb: (error: Error | null, count: number) => void): this;
|
|
113
120
|
ref(): this;
|
|
114
121
|
unref(): this;
|
|
115
122
|
maxConnections: number;
|