@qpjoy/electron-tunnel 0.1.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 +53 -0
- package/dist/admin/AdminServer.d.ts +10 -0
- package/dist/admin/AdminServer.js +362 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +92 -0
- package/dist/config/renderRuntimeConfig.d.ts +3 -0
- package/dist/config/renderRuntimeConfig.js +151 -0
- package/dist/createElectronTunnel.d.ts +21 -0
- package/dist/createElectronTunnel.js +49 -0
- package/dist/db/TunnelDatabase.d.ts +23 -0
- package/dist/db/TunnelDatabase.js +296 -0
- package/dist/db/schema.d.ts +1 -0
- package/dist/db/schema.js +70 -0
- package/dist/defaults.d.ts +18 -0
- package/dist/defaults.js +68 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/dist/ipc/registerTunnelIpc.d.ts +7 -0
- package/dist/ipc/registerTunnelIpc.js +70 -0
- package/dist/mihomo/MihomoApi.d.ts +11 -0
- package/dist/mihomo/MihomoApi.js +56 -0
- package/dist/mihomo/MihomoManager.d.ts +75 -0
- package/dist/mihomo/MihomoManager.js +635 -0
- package/dist/security.d.ts +3 -0
- package/dist/security.js +24 -0
- package/dist/system/electronProxy.d.ts +4 -0
- package/dist/system/electronProxy.js +30 -0
- package/dist/types.d.ts +98 -0
- package/dist/types.js +2 -0
- package/package.json +52 -0
- package/resources/engine/darwin-arm64/mihomo.gz +0 -0
- package/resources/engine/darwin-x64/mihomo.gz +0 -0
- package/resources/engine/linux-arm64/mihomo.gz +0 -0
- package/resources/engine/linux-x64/mihomo.gz +0 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export type RuntimeMode = 'system-tun' | 'app-global' | 'app-rule';
|
|
2
|
+
export type DomainRuleKind = 'allow' | 'block';
|
|
3
|
+
export interface TunnelPorts {
|
|
4
|
+
admin: number;
|
|
5
|
+
controller: number;
|
|
6
|
+
mixed: number;
|
|
7
|
+
dns: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RuntimeSettings {
|
|
10
|
+
id: number;
|
|
11
|
+
mode: RuntimeMode;
|
|
12
|
+
ports: TunnelPorts;
|
|
13
|
+
adminUser: string;
|
|
14
|
+
adminPasswordHash: string;
|
|
15
|
+
controllerSecret: string;
|
|
16
|
+
corePath: string | null;
|
|
17
|
+
tunInstalled: boolean;
|
|
18
|
+
activeSubscriptionId: number | null;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SubscriptionInput {
|
|
22
|
+
name: string;
|
|
23
|
+
url: string;
|
|
24
|
+
username?: string;
|
|
25
|
+
password?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SubscriptionRecord extends Required<SubscriptionInput> {
|
|
28
|
+
id: number;
|
|
29
|
+
localPath: string | null;
|
|
30
|
+
content: string | null;
|
|
31
|
+
active: boolean;
|
|
32
|
+
lastUpdatedAt: string | null;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DomainRule {
|
|
37
|
+
id: number;
|
|
38
|
+
kind: DomainRuleKind;
|
|
39
|
+
domain: string;
|
|
40
|
+
source: string;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface EventRecord {
|
|
45
|
+
id: number;
|
|
46
|
+
level: 'info' | 'warn' | 'error';
|
|
47
|
+
message: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
}
|
|
50
|
+
export interface TunnelStatus {
|
|
51
|
+
running: boolean;
|
|
52
|
+
pid: number | null;
|
|
53
|
+
mode: RuntimeMode;
|
|
54
|
+
tunInstalled: boolean;
|
|
55
|
+
ports: TunnelPorts;
|
|
56
|
+
activeSubscription: SubscriptionRecord | null;
|
|
57
|
+
corePath: string | null;
|
|
58
|
+
adminUrl: string;
|
|
59
|
+
controllerUrl: string;
|
|
60
|
+
}
|
|
61
|
+
export interface TrafficSummary {
|
|
62
|
+
available: boolean;
|
|
63
|
+
connections: number;
|
|
64
|
+
uploadTotal: number;
|
|
65
|
+
downloadTotal: number;
|
|
66
|
+
}
|
|
67
|
+
export interface TunnelSnapshot {
|
|
68
|
+
status: TunnelStatus;
|
|
69
|
+
subscriptions: SubscriptionRecord[];
|
|
70
|
+
rules: DomainRule[];
|
|
71
|
+
events: EventRecord[];
|
|
72
|
+
traffic: TrafficSummary;
|
|
73
|
+
}
|
|
74
|
+
export interface TunnelManagerOptions {
|
|
75
|
+
appName?: string;
|
|
76
|
+
userDataPath: string;
|
|
77
|
+
bundledEngineDir?: string;
|
|
78
|
+
/** @deprecated Use bundledEngineDir. */
|
|
79
|
+
bundledCoreDir?: string;
|
|
80
|
+
adminPort?: number;
|
|
81
|
+
controllerPort?: number;
|
|
82
|
+
mixedPort?: number;
|
|
83
|
+
dnsPort?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface RenderRuntimeConfigInput {
|
|
86
|
+
baseYaml: string;
|
|
87
|
+
settings: RuntimeSettings;
|
|
88
|
+
rules: DomainRule[];
|
|
89
|
+
}
|
|
90
|
+
export interface RenderedRuntimeConfig {
|
|
91
|
+
yaml: string;
|
|
92
|
+
proxyPolicyName: string;
|
|
93
|
+
}
|
|
94
|
+
export interface MihomoApiResponse<T = unknown> {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
status: number;
|
|
97
|
+
data: T | null;
|
|
98
|
+
}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qpjoy/electron-tunnel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Reusable QPJoy tunnel runtime and CLI for Electron apps on macOS and Linux.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"qpjoy-tunnel": "dist/cli.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"resources/engine"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"prepack": "pnpm build",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"electron",
|
|
35
|
+
"tunnel",
|
|
36
|
+
"proxy",
|
|
37
|
+
"tun",
|
|
38
|
+
"qpjoy"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"better-sqlite3": "^11.8.1",
|
|
42
|
+
"yaml": "^2.7.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"electron": ">=28"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
49
|
+
"@types/node": "^22.10.7",
|
|
50
|
+
"electron": "^34.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|