asyx 0.5.9 → 0.6.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/README.md +71 -9
- package/SECURITY.md +5 -3
- package/package.json +13 -23
- package/src/commands/name.js +23 -0
- package/src/commands/reject-messages.js +54 -0
- package/src/commands/setup.js +98 -102
- package/src/commands/tunnel.js +279 -2425
- package/src/lib/naming.js +81 -0
- package/src/main.js +9 -1
- package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.d.ts +260 -0
- package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.js +1088 -0
- package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.d.ts +79 -0
- package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.js +138 -0
- package/vendor/tunnel-core/dist/control-plane/session.d.ts +50 -0
- package/vendor/tunnel-core/dist/control-plane/session.js +115 -0
- package/vendor/tunnel-core/dist/errors.d.ts +49 -0
- package/vendor/tunnel-core/dist/errors.js +53 -0
- package/vendor/tunnel-core/dist/flows/http.d.ts +50 -0
- package/vendor/tunnel-core/dist/flows/http.js +585 -0
- package/vendor/tunnel-core/dist/flows/tcp.d.ts +60 -0
- package/vendor/tunnel-core/dist/flows/tcp.js +546 -0
- package/vendor/tunnel-core/dist/flows/udp.d.ts +41 -0
- package/vendor/tunnel-core/dist/flows/udp.js +376 -0
- package/vendor/tunnel-core/dist/lib/adapt-logger.d.ts +2 -0
- package/vendor/tunnel-core/dist/lib/adapt-logger.js +6 -0
- package/vendor/tunnel-core/dist/lib/fingerprint.d.ts +13 -0
- package/vendor/tunnel-core/dist/lib/fingerprint.js +95 -0
- package/vendor/tunnel-core/dist/lib/jwt-verifier.d.ts +27 -0
- package/vendor/tunnel-core/dist/lib/jwt-verifier.js +230 -0
- package/vendor/tunnel-core/dist/lib/logger.d.ts +9 -0
- package/vendor/tunnel-core/dist/lib/logger.js +58 -0
- package/vendor/tunnel-core/dist/lib/refresh-helpers.d.ts +16 -0
- package/vendor/tunnel-core/dist/lib/refresh-helpers.js +66 -0
- package/vendor/tunnel-core/dist/lifecycle.d.ts +24 -0
- package/vendor/tunnel-core/dist/lifecycle.js +29 -0
- package/vendor/tunnel-core/dist/mqtt/awaiter-map.d.ts +56 -0
- package/vendor/tunnel-core/dist/mqtt/awaiter-map.js +227 -0
- package/vendor/tunnel-core/dist/mqtt/events/handlers.d.ts +58 -0
- package/vendor/tunnel-core/dist/mqtt/events/handlers.js +250 -0
- package/vendor/tunnel-core/dist/mqtt/events/index.d.ts +1 -0
- package/vendor/tunnel-core/dist/mqtt/events/index.js +191 -0
- package/vendor/tunnel-core/dist/mqtt/events/schemas.d.ts +498 -0
- package/vendor/tunnel-core/dist/mqtt/events/schemas.js +51 -0
- package/vendor/tunnel-core/dist/mqtt/ingress.d.ts +63 -0
- package/vendor/tunnel-core/dist/mqtt/ingress.js +170 -0
- package/vendor/tunnel-core/dist/state/assignment.d.ts +122 -0
- package/vendor/tunnel-core/dist/state/assignment.js +322 -0
- package/vendor/tunnel-core/dist/state/instance-registry.d.ts +88 -0
- package/{src → vendor/tunnel-core/dist}/state/instance-registry.js +38 -53
- package/vendor/tunnel-core/dist/tcp-v1/framing.d.ts +43 -0
- package/vendor/tunnel-core/dist/tcp-v1/framing.js +157 -0
- package/vendor/tunnel-core/dist/tunnel/http-tunnel.d.ts +137 -0
- package/vendor/tunnel-core/dist/tunnel/http-tunnel.js +1591 -0
- package/vendor/tunnel-core/dist/tunnel/httpws-constants.d.ts +13 -0
- package/{src → vendor/tunnel-core/dist}/tunnel/httpws-constants.js +5 -7
- package/vendor/tunnel-core/dist/tunnel/reconnect.d.ts +76 -0
- package/vendor/tunnel-core/dist/tunnel/reconnect.js +183 -0
- package/vendor/tunnel-core/dist/tunnel/request-sink.d.ts +40 -0
- package/vendor/tunnel-core/dist/tunnel/request-sink.js +39 -0
- package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.d.ts +89 -0
- package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.js +838 -0
- package/vendor/tunnel-core/dist/tunnel/udp-tunnel.d.ts +90 -0
- package/vendor/tunnel-core/dist/tunnel/udp-tunnel.js +737 -0
- package/vendor/tunnel-core/dist/tunnel/ws-control.d.ts +22 -0
- package/vendor/tunnel-core/dist/tunnel/ws-control.js +124 -0
- package/vendor/tunnel-core/dist/types.d.ts +24 -0
- package/vendor/tunnel-core/dist/types.js +2 -0
- package/vendor/tunnel-core/dist/udp-v1/framing.d.ts +41 -0
- package/vendor/tunnel-core/dist/udp-v1/framing.js +158 -0
- package/vendor/tunnel-core/package.json +34 -0
- package/src/control-plane/MqttControlPlaneClient.js +0 -1196
- package/src/control-plane/MqttControlPlaneTransport.js +0 -150
- package/src/lib/fingerprint.js +0 -115
- package/src/lib/jwt-verifier.js +0 -260
- package/src/lib/logger.js +0 -62
- package/src/mqtt/awaiter-map.js +0 -247
- package/src/mqtt/events/handlers.js +0 -300
- package/src/mqtt/events/index.js +0 -222
- package/src/mqtt/events/schemas.js +0 -58
- package/src/mqtt/ingress.js +0 -182
- package/src/state/assignment.js +0 -333
- package/src/tcp-v1/framing.js +0 -203
- package/src/tunnel/http-tunnel.js +0 -1738
- package/src/tunnel/reconnect.js +0 -182
- package/src/tunnel/tcp-tunnel.js +0 -944
- package/src/tunnel/udp-tunnel.js +0 -813
- package/src/tunnel/ws-control.js +0 -135
- package/src/udp-v1/framing.js +0 -203
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export class UdpTunnel {
|
|
2
|
+
/** @returns {{ family: 'udp4' | 'udp6', address: string } | null} */
|
|
3
|
+
static selectDial(targetHost: any): {
|
|
4
|
+
family: "udp4" | "udp6";
|
|
5
|
+
address: string;
|
|
6
|
+
} | null;
|
|
7
|
+
constructor({ relayUrl, jwt, deviceId, requestId, localPort, targetHost, targetPort, leaseId, relayId, log, coordinatorCore, coordinatorIngress, isControlPlaneConnected, waitForControlPlane, getLastMqttError, getForceReconnect, controlPlaneTimeoutMs, getJwt, reassign, exit, }: {
|
|
8
|
+
relayUrl: any;
|
|
9
|
+
jwt: any;
|
|
10
|
+
deviceId: any;
|
|
11
|
+
requestId: any;
|
|
12
|
+
localPort?: any;
|
|
13
|
+
targetHost: any;
|
|
14
|
+
targetPort: any;
|
|
15
|
+
leaseId: any;
|
|
16
|
+
relayId: any;
|
|
17
|
+
log: any;
|
|
18
|
+
coordinatorCore: any;
|
|
19
|
+
coordinatorIngress: any;
|
|
20
|
+
isControlPlaneConnected?: () => boolean;
|
|
21
|
+
waitForControlPlane?: () => Promise<void>;
|
|
22
|
+
getLastMqttError?: () => any;
|
|
23
|
+
getForceReconnect?: () => any;
|
|
24
|
+
controlPlaneTimeoutMs?: number;
|
|
25
|
+
getJwt?: any;
|
|
26
|
+
reassign?: any;
|
|
27
|
+
exit?: (code: number) => void;
|
|
28
|
+
});
|
|
29
|
+
relayUrl: any;
|
|
30
|
+
jwt: any;
|
|
31
|
+
getJwt: any;
|
|
32
|
+
reassign: any;
|
|
33
|
+
exit: (code: number) => void;
|
|
34
|
+
deviceId: any;
|
|
35
|
+
requestId: any;
|
|
36
|
+
targetHost: any;
|
|
37
|
+
targetPort: any;
|
|
38
|
+
/** @type {'udp4' | 'udp6' | null} */
|
|
39
|
+
dialFamily: "udp4" | "udp6" | null;
|
|
40
|
+
dialAddress: string;
|
|
41
|
+
leaseId: any;
|
|
42
|
+
relayId: any;
|
|
43
|
+
log: any;
|
|
44
|
+
ws: WebSocket;
|
|
45
|
+
coordinatorCore: any;
|
|
46
|
+
coordinatorIngress: any;
|
|
47
|
+
isControlPlaneConnected: () => boolean;
|
|
48
|
+
waitForControlPlane: () => Promise<void>;
|
|
49
|
+
getLastMqttError: () => any;
|
|
50
|
+
getForceReconnect: () => any;
|
|
51
|
+
controlPlaneTimeoutMs: number;
|
|
52
|
+
flowMap: Map<any, any>;
|
|
53
|
+
socketToFlowId: WeakMap<object, any>;
|
|
54
|
+
frameBuffer: Buffer<ArrayBuffer>;
|
|
55
|
+
protocolViolation: boolean;
|
|
56
|
+
idleTimeoutMs: number;
|
|
57
|
+
pingIntervalMs: number;
|
|
58
|
+
pingTimer: NodeJS.Timeout;
|
|
59
|
+
lastPongMs: number;
|
|
60
|
+
flowIdleTimeoutMs: number;
|
|
61
|
+
flowCleanupTimer: NodeJS.Timeout;
|
|
62
|
+
closing: boolean;
|
|
63
|
+
everOpened: boolean;
|
|
64
|
+
lastInboundMs: number;
|
|
65
|
+
reconnectEnabled: boolean;
|
|
66
|
+
reconnector: Reconnector;
|
|
67
|
+
open(): Promise<void>;
|
|
68
|
+
_attemptConnect(): Promise<any>;
|
|
69
|
+
verifiedJwt: any;
|
|
70
|
+
_setupWebSocketConnection(wsUrl: any, resolve: any, reject: any): void;
|
|
71
|
+
_onDropped(code: any, reasonStr: any): void;
|
|
72
|
+
handleBinaryFrame(data: any): void;
|
|
73
|
+
routeFrame(frame: any): void;
|
|
74
|
+
handleProtocolViolation(error: any): void;
|
|
75
|
+
handleUdpDatagram(frame: any): void;
|
|
76
|
+
sendDatagramToApp(socket: any, flowId: any, payload: any): void;
|
|
77
|
+
handleUdpClose(frame: any): void;
|
|
78
|
+
handlePing(frame: any): void;
|
|
79
|
+
handlePong(frame: any): void;
|
|
80
|
+
handleLocalDatagram(msg: any, rinfo: any, flowId: any): void;
|
|
81
|
+
startPingKeepalive(): void;
|
|
82
|
+
stopPingKeepalive(): void;
|
|
83
|
+
sendPing(): void;
|
|
84
|
+
startFlowCleanup(): void;
|
|
85
|
+
stopFlowCleanup(): void;
|
|
86
|
+
closeAllFlowSockets(): void;
|
|
87
|
+
close(): void;
|
|
88
|
+
}
|
|
89
|
+
import WebSocket from 'ws';
|
|
90
|
+
import { Reconnector } from './reconnect.js';
|