@fkn/lib 0.2.1 → 0.3.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/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 +18 -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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UdpSocketOption } from './packets/udp';
|
|
2
|
+
export type { UdpSocketOption } from './packets/udp';
|
|
3
|
+
export { UDP_OPTION_BROADCAST, UDP_OPTION_TTL, UDP_OPTION_MULTICAST_TTL_V4, UDP_OPTION_MULTICAST_LOOP_V4, UDP_OPTION_MULTICAST_LOOP_V6, UDP_OPTION_ADD_MEMBERSHIP_V4, UDP_OPTION_DROP_MEMBERSHIP_V4, UDP_OPTION_ADD_MEMBERSHIP_V6, UDP_OPTION_DROP_MEMBERSHIP_V6, UDP_OPTION_SEND_BUFFER_SIZE, UDP_OPTION_RECV_BUFFER_SIZE, } from './packets/udp';
|
|
4
|
+
export declare const webVpnUdpSocket: ({ type, port, address }: {
|
|
5
|
+
type: "udp4" | "udp6";
|
|
6
|
+
port: number;
|
|
7
|
+
address: string;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
localAddress: string;
|
|
10
|
+
localFamily: "IPv4" | "IPv6";
|
|
11
|
+
localPort: number;
|
|
12
|
+
dataReadableStream: ReadableStream<{
|
|
13
|
+
data: ArrayBuffer;
|
|
14
|
+
size: number;
|
|
15
|
+
family: "IPv4" | "IPv6";
|
|
16
|
+
address: string;
|
|
17
|
+
port: number;
|
|
18
|
+
}>;
|
|
19
|
+
connect: ({ remoteAddress: _remoteAddress, remotePort }: {
|
|
20
|
+
remoteAddress: string;
|
|
21
|
+
remotePort: number;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
send: ({ message, address: _remoteAddress, port: remotePort }: {
|
|
24
|
+
message: ArrayBuffer;
|
|
25
|
+
address?: string;
|
|
26
|
+
port?: number;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
close: () => Promise<void>;
|
|
29
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AddressLookupResult } from '../dns';
|
|
2
|
+
import { Address4, Address6 } from 'ip-address';
|
|
3
|
+
export declare const textEncoder: TextEncoder;
|
|
4
|
+
export declare const textDecoder: TextDecoder;
|
|
5
|
+
export declare class DNSError extends Error {
|
|
6
|
+
code: string;
|
|
7
|
+
errno: number;
|
|
8
|
+
syscall: string;
|
|
9
|
+
hostname: string;
|
|
10
|
+
constructor(hostname: string);
|
|
11
|
+
}
|
|
12
|
+
export declare const addressLookupToAddress: (addressLookup: AddressLookupResult) => Promise<{
|
|
13
|
+
address: Address4 | Address6;
|
|
14
|
+
addressType: 0 | 1;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const readableStreamCloner: <T>(readableStream: ReadableStream<T>) => () => ReadableStream<T>;
|
|
17
|
+
export declare const streamWriterToWritableStreamCloner: <T>(writer: WritableStreamDefaultWriter<T>, options?: {
|
|
18
|
+
neverClose?: boolean;
|
|
19
|
+
}) => () => WritableStream<T>;
|
|
20
|
+
export declare const createPacketFilterTransformStream: <T>(filter: (packet: T) => boolean) => TransformStream<T, T>;
|
|
21
|
+
export declare const makeExternalPromise: <T>(resolve?: (arg: T) => void, reject?: (err: Error) => void) => {
|
|
22
|
+
promise: Promise<T>;
|
|
23
|
+
resolve: (arg: T) => void;
|
|
24
|
+
reject: (err: Error) => void;
|
|
25
|
+
};
|
|
26
|
+
export declare const makeIdCounter: (max?: number) => () => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ServerMetadataPacket } from './packets/metadata';
|
|
2
|
+
import { Address4, Address6 } from 'ip-address';
|
|
3
|
+
export interface WebTransportOptions {
|
|
4
|
+
address: string;
|
|
5
|
+
serverCertificateHashes: {
|
|
6
|
+
algorithm: string;
|
|
7
|
+
value: number[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
type BidirectionalStreams = {
|
|
11
|
+
readable: ReadableStream<Uint8Array>;
|
|
12
|
+
writable: WritableStream<Uint8Array>;
|
|
13
|
+
};
|
|
14
|
+
export declare const configureWebVpn: (opts: {
|
|
15
|
+
origin?: string;
|
|
16
|
+
certHashes?: WebTransportOptions["serverCertificateHashes"];
|
|
17
|
+
}) => void;
|
|
18
|
+
declare const makeWebVPNWebTransport: () => Promise<{
|
|
19
|
+
webtransport: WebTransport;
|
|
20
|
+
getNewPacketId: () => number;
|
|
21
|
+
getTcpDataReadableStreamForSocketId: (socketId: number, options?: {
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}) => Promise<BidirectionalStreams>;
|
|
24
|
+
getUdpDataReadableStreamForSocketId: (socketId: number) => ReadableStream<{
|
|
25
|
+
readonly _type: "ServerUdpDataPacket";
|
|
26
|
+
readonly offset: number;
|
|
27
|
+
readonly socketId: number;
|
|
28
|
+
readonly remoteAddressType: 0 | 1 | 2;
|
|
29
|
+
readonly remoteAddress: Address4 | Address6 | undefined;
|
|
30
|
+
readonly remotePort: number | undefined;
|
|
31
|
+
readonly dataLength: number;
|
|
32
|
+
readonly data: ArrayBuffer;
|
|
33
|
+
}>;
|
|
34
|
+
getPacketForId: (packetId: number) => Promise<ServerMetadataPacket>;
|
|
35
|
+
getMetadataReadableStreamForSocketId: (socketId: number) => ReadableStream<ServerMetadataPacket>;
|
|
36
|
+
getMetadataReadableStreamForLocalAddress: (address: Address4 | Address6) => ReadableStream<ServerMetadataPacket>;
|
|
37
|
+
getMetadataWritableStream: () => WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
38
|
+
getDatagramWritableStream: () => WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
39
|
+
}>;
|
|
40
|
+
export type WebVPNWebTransport = Awaited<ReturnType<typeof makeWebVPNWebTransport>>;
|
|
41
|
+
export declare const getWebVpnWebTransport: () => Promise<{
|
|
42
|
+
webtransport: WebTransport;
|
|
43
|
+
getNewPacketId: () => number;
|
|
44
|
+
getTcpDataReadableStreamForSocketId: (socketId: number, options?: {
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}) => Promise<BidirectionalStreams>;
|
|
47
|
+
getUdpDataReadableStreamForSocketId: (socketId: number) => ReadableStream<{
|
|
48
|
+
readonly _type: "ServerUdpDataPacket";
|
|
49
|
+
readonly offset: number;
|
|
50
|
+
readonly socketId: number;
|
|
51
|
+
readonly remoteAddressType: 0 | 1 | 2;
|
|
52
|
+
readonly remoteAddress: Address4 | Address6 | undefined;
|
|
53
|
+
readonly remotePort: number | undefined;
|
|
54
|
+
readonly dataLength: number;
|
|
55
|
+
readonly data: ArrayBuffer;
|
|
56
|
+
}>;
|
|
57
|
+
getPacketForId: (packetId: number) => Promise<ServerMetadataPacket>;
|
|
58
|
+
getMetadataReadableStreamForSocketId: (socketId: number) => ReadableStream<ServerMetadataPacket>;
|
|
59
|
+
getMetadataReadableStreamForLocalAddress: (address: Address4 | Address6) => ReadableStream<ServerMetadataPacket>;
|
|
60
|
+
getMetadataWritableStream: () => WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
61
|
+
getDatagramWritableStream: () => WritableStream<Uint8Array<ArrayBufferLike>>;
|
|
62
|
+
}>;
|
|
63
|
+
export {};
|