xfuture 1.9.7 → 2.8.2

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -20,6 +20,9 @@ class xFuture {
20
20
  init(){
21
21
  this.driver = "";
22
22
  this.isTunMode = true;
23
+ this.shell_path = "";
24
+ this.helper_path = "";
25
+ this.driver = "";
23
26
  }
24
27
 
25
28
  SetPassword(password) {
@@ -29,7 +32,7 @@ class xFuture {
29
32
  SetTunModeEnable(enable){
30
33
  this.isTunMode = enable;
31
34
  parser.isTunMode = enable;
32
- ff.SetTunModeEnable(enable, this.workingDir);
35
+ ff.SetTunModeEnable(enable);
33
36
  }
34
37
 
35
38
  StartTunnel(url){
@@ -49,10 +52,6 @@ class xFuture {
49
52
  this.StopProxy();
50
53
  }
51
54
 
52
- SetVlessEncoding(version){
53
- ff.SetVlessEncoding(version);
54
- }
55
-
56
55
  StartProxy(){
57
56
  if (isMac || this.isTunMode) return true;
58
57
  var ret = true;
@@ -87,19 +86,23 @@ class xFuture {
87
86
  }
88
87
 
89
88
  SetGlobalMode(isGlobalMode){
90
- console.log("isGlobalMode:", isGlobalMode, " dir:", ipdir);
89
+ console.log("isGlobalMode:", isGlobalMode);
91
90
  parser.isGlobalMode = isGlobalMode;
92
- ff.SetGlobalMode(isGlobalMode, this.workingDir);
91
+ ff.SetGlobalMode(isGlobalMode);
93
92
  }
94
93
 
95
94
  // 1. Mac 请传 install_helper.sh 和 xfuture_helper 的绝对路径
96
95
  // 2. Windows 请传 "maodou" 固定字符串 和 sysproxy.exe 的绝对路径
96
+ // 3. workingDir 传所有 geoip 和资源的目录绝对路径
97
97
  InstallDriver(shell_path, helper_path, workingDir){
98
- this.driver = helper_path;
99
- this.workingDir = workingDir;
100
- parser.workingDir = workingDir;
101
- return ff.InstallDriver(shell_path, helper_path);
102
- }
98
+ this.driver = helper_path;
99
+ this.workingDir = workingDir;
100
+ this.shell_path = shell_path;
101
+ parser.workingDir = workingDir;
102
+ parser.driver = helper_path;
103
+ parser.shell_path = shell_path;
104
+ ff.InstallDriver(shell_path, helper_path, workingDir);
105
+ }
103
106
 
104
107
  GetCurrentStatus(){
105
108
  return ff.GetCurrentStatus();
File without changes
Binary file
File without changes
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xfuture",
3
- "version": "1.9.7",
3
+ "version": "2.8.2",
4
4
  "description": "electron vpn sdk",
5
5
  "main": "x.js",
6
6
  "scripts": {
@@ -21,13 +21,11 @@
21
21
  },
22
22
  "files": [
23
23
  "index.js",
24
- "index-for-win32-ia32.js",
25
24
  "parser.js",
26
25
  "package.json",
27
26
  "package/darwin/xFuture.node",
28
27
  "package/darwin/xfuture_helper",
29
28
  "package/darwin/install_helper.sh",
30
- "package/darwin/xAdapter.framework",
31
29
  "package/darwin/xsing-box-exec",
32
30
  "package/win32/sysproxy.exe",
33
31
  "package/win32/xFuture.node",
@@ -39,8 +37,7 @@
39
37
  "resources/geoip-cn.srs",
40
38
  "resources/geosite-cn.srs",
41
39
  "resources/geosite-geolocation-!cn.srs",
42
- "resources/mao-dou-xray-box-driver.exe",
43
- "resources/mao-dou-xray-vpn-driver.exe"
40
+ "resources/mao-dou-xray-box-driver.exe"
44
41
  ],
45
42
  "build": {
46
43
  "mac": {
@@ -12,7 +12,7 @@
12
12
  "address": "8.8.8.8",
13
13
  "address_strategy": "prefer_ipv4",
14
14
  "strategy": "prefer_ipv4",
15
- "detour": "proxy"
15
+ "detour": "direct"
16
16
  },
17
17
  {
18
18
  "tag": "dns_local",
@@ -1,142 +0,0 @@
1
- let os = require("os");
2
- const { spawn, spawnSync } = require('child_process')
3
- var isMac = false;
4
- const parser = require('./parser');
5
- const fs = require('fs');
6
- parser.isGlobalMode = false;
7
-
8
- class xFuture {
9
-
10
- init(){
11
- this.driver = "";
12
- this.isTunMode = true;
13
- }
14
-
15
- SetEventCallback(name, func){
16
-
17
- }
18
-
19
- GetSingBoxDuraion(){
20
- return 0;
21
- }
22
-
23
- GetXrayDuration(){
24
- return 0;
25
- }
26
-
27
- SetPassword(password) {
28
-
29
- }
30
-
31
- SetTunModeEnable(enable){
32
- this.isTunMode = enable;
33
- }
34
-
35
- StartTunnel(url){
36
- if(this.driver.length == 0) return false;
37
- this.currentURI = url;
38
- var json = parser.parse(url);
39
- var xray_json = JSON.stringify(json);
40
- console.log("address:", json.address);
41
- var ok = this.startTunnelPrivate(xray_json, url);
42
- if (ok) {
43
- ok = this.StartProxy();
44
- }
45
- return ok;
46
- }
47
-
48
- startTunnelPrivate(json, url){
49
-
50
- try {
51
- // 同步写入文件
52
- var filePath = this.workingDir + "\\configuration.json";
53
- fs.writeFileSync(filePath, json, 'utf8');
54
- console.log('File has been written successfully!');
55
- var driver = this.workingDir + "\\mao-dou-xray-vpn-driver.exe";
56
- spawn(driver, ["run", this.workingDir, filePath, url]);
57
- return true;
58
- } catch (err) {
59
- console.error('An error occurred while writing to the file:', err);
60
- return false;
61
- }
62
- }
63
-
64
- stopTunnelPrivate() {
65
- try {
66
- var driver = this.workingDir + "\\mao-dou-xray-vpn-driver.exe";
67
- spawnSync(driver, ["kill"]);
68
- console.log("Driver killed");
69
- }
70
- catch (error) {
71
- console.error('Error executing command:', error);
72
- }
73
-
74
- }
75
-
76
- StopTunnel(){
77
- this.stopTunnelPrivate();
78
- this.StopProxy();
79
- }
80
-
81
- SetVlessEncoding(version){
82
-
83
- }
84
-
85
- StartProxy(){
86
- var ret = true;
87
- try {
88
- let process = spawn(this.driver, ["global", "socks=127.0.0.1:40008"])
89
- process.on('close', (code) => {
90
- console.info('[sysproxy open]:', code)
91
- });
92
- } catch(err) {
93
- console.warn('[sysproxy open] failed:', err)
94
- this.stopTunnelPrivate();
95
- ret = false;
96
- }
97
- return ret;
98
- }
99
-
100
- // App 进程退出时调用该接口,否则会导致电脑出现断网情况
101
- StopProxy(){
102
- if (!isMac) {
103
- try {
104
- let process = spawn(this.driver, ["off"])
105
- process.on('close', function (code) {
106
- console.info('[sysproxy stop]:', code)
107
- });
108
- } catch(err) {
109
- console.warn('[sysproxy stop] failed:', err)
110
- }
111
- }
112
- }
113
-
114
- SetGlobalMode(isGlobalMode){
115
- console.log("isGlobalMode:", isGlobalMode);
116
- parser.isGlobalMode = isGlobalMode;
117
- }
118
-
119
- // 1. Mac 请传 install_helper.sh 和 xfuture_helper 的绝对路径
120
- // 2. Windows 请传 "maodou" 固定字符串 和 sysproxy.exe 的绝对路径
121
- InstallDriver(shell_path, helper_path, workingDir){
122
- this.driver = helper_path;
123
- this.workingDir = workingDir;
124
- parser.workingDir = workingDir;
125
- }
126
-
127
- GetCurrentStatus(){
128
- return 0;
129
- }
130
-
131
- GetCurrentURI(){
132
- return this.currentURI;
133
- }
134
-
135
- GetStatistics(){
136
- return {"downloadlink":0, "mdownloadlink":0, "muploadlink":0, "uploadlink":0};
137
- }
138
- }
139
-
140
- const xFutureInstance = new xFuture;
141
- xFutureInstance.init();
142
- module.exports = xFutureInstance;
@@ -1,19 +0,0 @@
1
- //
2
- // LVAdapter.h
3
- // xAdapter
4
- //
5
- // Created by badwin on 2024/5/18.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface LVAdapter : NSObject
13
- +(NSString *)StartVPN:(NSData *)configuration url:(NSString *)url;
14
- +(void)Stop;
15
- +(void)SetupEnv:(NSString *)env;
16
- +(NSDictionary *)GetStatistics;
17
- @end
18
-
19
- NS_ASSUME_NONNULL_END
@@ -1,19 +0,0 @@
1
- //
2
- // xAdapter.h
3
- // xAdapter
4
- //
5
- // Created by badwin on 2024/5/18.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- //! Project version number for xAdapter.
11
- FOUNDATION_EXPORT double xAdapterVersionNumber;
12
-
13
- //! Project version string for xAdapter.
14
- FOUNDATION_EXPORT const unsigned char xAdapterVersionString[];
15
-
16
- // In this header, you should import all the public headers of your framework using statements like #import <xAdapter/PublicHeader.h>
17
-
18
-
19
- #import <xAdapter/LVAdapter.h>
@@ -1,6 +0,0 @@
1
- framework module xAdapter {
2
- umbrella header "xAdapter.h"
3
-
4
- export *
5
- module * { export * }
6
- }
@@ -1,46 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>BuildMachineOSBuild</key>
6
- <string>22D49</string>
7
- <key>CFBundleDevelopmentRegion</key>
8
- <string>en</string>
9
- <key>CFBundleExecutable</key>
10
- <string>xAdapter</string>
11
- <key>CFBundleIdentifier</key>
12
- <string>com.pi.xAdapter</string>
13
- <key>CFBundleInfoDictionaryVersion</key>
14
- <string>6.0</string>
15
- <key>CFBundleName</key>
16
- <string>xAdapter</string>
17
- <key>CFBundlePackageType</key>
18
- <string>FMWK</string>
19
- <key>CFBundleShortVersionString</key>
20
- <string>1.0</string>
21
- <key>CFBundleSupportedPlatforms</key>
22
- <array>
23
- <string>MacOSX</string>
24
- </array>
25
- <key>CFBundleVersion</key>
26
- <string>1</string>
27
- <key>DTCompiler</key>
28
- <string>com.apple.compilers.llvm.clang.1_0</string>
29
- <key>DTPlatformBuild</key>
30
- <string></string>
31
- <key>DTPlatformName</key>
32
- <string>macosx</string>
33
- <key>DTPlatformVersion</key>
34
- <string>13.3</string>
35
- <key>DTSDKBuild</key>
36
- <string>22E245</string>
37
- <key>DTSDKName</key>
38
- <string>macosx13.3</string>
39
- <key>DTXcode</key>
40
- <string>1430</string>
41
- <key>DTXcodeBuild</key>
42
- <string>14E222b</string>
43
- <key>LSMinimumSystemVersion</key>
44
- <string>11.0</string>
45
- </dict>
46
- </plist>
@@ -1,149 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>files</key>
6
- <dict>
7
- <key>Resources/Info.plist</key>
8
- <data>
9
- SJb6cxhPMYUgJyQiTwSEa7V8q7Y=
10
- </data>
11
- </dict>
12
- <key>files2</key>
13
- <dict>
14
- <key>Headers/LVAdapter.h</key>
15
- <dict>
16
- <key>hash2</key>
17
- <data>
18
- p+8qklny/YuLe4Yt2ziTTIO2kCrEhU9YCkePcRRAJjo=
19
- </data>
20
- </dict>
21
- <key>Headers/xAdapter.h</key>
22
- <dict>
23
- <key>hash2</key>
24
- <data>
25
- J9L94Z2aPJ5+zjtDTGR1t9y0aQ+74GqYs9UbaGvHTcg=
26
- </data>
27
- </dict>
28
- <key>Modules/module.modulemap</key>
29
- <dict>
30
- <key>hash2</key>
31
- <data>
32
- 7CZfjk6Kmn3++DDXlKWE57uE+bFu/BQimO+PP3TwI60=
33
- </data>
34
- </dict>
35
- <key>Resources/Info.plist</key>
36
- <dict>
37
- <key>hash2</key>
38
- <data>
39
- lHFbOi0DCRsaFVGvkaoISwVNrPZbC8nkjGThhr+aYps=
40
- </data>
41
- </dict>
42
- </dict>
43
- <key>rules</key>
44
- <dict>
45
- <key>^Resources/</key>
46
- <true/>
47
- <key>^Resources/.*\.lproj/</key>
48
- <dict>
49
- <key>optional</key>
50
- <true/>
51
- <key>weight</key>
52
- <real>1000</real>
53
- </dict>
54
- <key>^Resources/.*\.lproj/locversion.plist$</key>
55
- <dict>
56
- <key>omit</key>
57
- <true/>
58
- <key>weight</key>
59
- <real>1100</real>
60
- </dict>
61
- <key>^Resources/Base\.lproj/</key>
62
- <dict>
63
- <key>weight</key>
64
- <real>1010</real>
65
- </dict>
66
- <key>^version.plist$</key>
67
- <true/>
68
- </dict>
69
- <key>rules2</key>
70
- <dict>
71
- <key>.*\.dSYM($|/)</key>
72
- <dict>
73
- <key>weight</key>
74
- <real>11</real>
75
- </dict>
76
- <key>^(.*/)?\.DS_Store$</key>
77
- <dict>
78
- <key>omit</key>
79
- <true/>
80
- <key>weight</key>
81
- <real>2000</real>
82
- </dict>
83
- <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
84
- <dict>
85
- <key>nested</key>
86
- <true/>
87
- <key>weight</key>
88
- <real>10</real>
89
- </dict>
90
- <key>^.*</key>
91
- <true/>
92
- <key>^Info\.plist$</key>
93
- <dict>
94
- <key>omit</key>
95
- <true/>
96
- <key>weight</key>
97
- <real>20</real>
98
- </dict>
99
- <key>^PkgInfo$</key>
100
- <dict>
101
- <key>omit</key>
102
- <true/>
103
- <key>weight</key>
104
- <real>20</real>
105
- </dict>
106
- <key>^Resources/</key>
107
- <dict>
108
- <key>weight</key>
109
- <real>20</real>
110
- </dict>
111
- <key>^Resources/.*\.lproj/</key>
112
- <dict>
113
- <key>optional</key>
114
- <true/>
115
- <key>weight</key>
116
- <real>1000</real>
117
- </dict>
118
- <key>^Resources/.*\.lproj/locversion.plist$</key>
119
- <dict>
120
- <key>omit</key>
121
- <true/>
122
- <key>weight</key>
123
- <real>1100</real>
124
- </dict>
125
- <key>^Resources/Base\.lproj/</key>
126
- <dict>
127
- <key>weight</key>
128
- <real>1010</real>
129
- </dict>
130
- <key>^[^/]+$</key>
131
- <dict>
132
- <key>nested</key>
133
- <true/>
134
- <key>weight</key>
135
- <real>10</real>
136
- </dict>
137
- <key>^embedded\.provisionprofile$</key>
138
- <dict>
139
- <key>weight</key>
140
- <real>20</real>
141
- </dict>
142
- <key>^version\.plist$</key>
143
- <dict>
144
- <key>weight</key>
145
- <real>20</real>
146
- </dict>
147
- </dict>
148
- </dict>
149
- </plist>