xtunnel 1.5.0 → 1.5.4

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.
@@ -5,118 +5,5 @@
5
5
  "subscribeLink": "",
6
6
  "selectedServer": "",
7
7
  "selectedMode": "GLOBAL"
8
- },
9
- "routingPac": {
10
- "domainStrategy": "IPOnDemand",
11
- "rules": [
12
- {
13
- "type": "field",
14
- "outboundTag": "direct",
15
- "domain": [
16
- "geosite:cn"
17
- ]
18
- },
19
- {
20
- "type": "field",
21
- "outboundTag": "direct",
22
- "ip": [
23
- "geoip:cn",
24
- "geoip:private"
25
- ]
26
- }
27
- ]
28
- },
29
- "routingGlobal": {
30
- "domainStrategy": "AsIs",
31
- "rules": []
32
- },
33
- "tpl": {
34
- "log": {
35
- "error": "",
36
- "loglevel": "error",
37
- "access": ""
38
- },
39
- "inbounds": [
40
- {
41
- "listen": "127.0.0.1",
42
- "protocol": "socks",
43
- "settings": {
44
- "udp": false,
45
- "auth": "noauth"
46
- },
47
- "port": "10800"
48
- },
49
- {
50
- "listen": "127.0.0.1",
51
- "protocol": "http",
52
- "settings": {
53
- "timeout": 360
54
- },
55
- "port": "10870"
56
- }
57
- ],
58
- "outbounds": [
59
- {
60
- "mux": {
61
- "enabled": false,
62
- "concurrency": 8
63
- },
64
- "protocol": "vmess",
65
- "streamSettings": {
66
- "wsSettings": {
67
- "path": "/v2ray",
68
- "headers": {
69
- "host": ""
70
- }
71
- },
72
- "tlsSettings": {
73
- "allowInsecure": true
74
- },
75
- "security": "none",
76
- "network": "ws"
77
- },
78
- "tag": "proxy",
79
- "settings": {
80
- "vnext": [
81
- {
82
- "address": "u4.amazonfeed.net",
83
- "users": [
84
- {
85
- "id": "d289df49-72eb-3b11-b83f-928b0a0f0dfc",
86
- "alterId": 2,
87
- "level": 0,
88
- "security": "aes-128-gcm"
89
- }
90
- ],
91
- "port": 3106
92
- }
93
- ]
94
- }
95
- },
96
- {
97
- "tag": "direct",
98
- "protocol": "freedom",
99
- "settings": {
100
- "domainStrategy": "UseIP",
101
- "redirect": "",
102
- "userLevel": 0
103
- }
104
- },
105
- {
106
- "tag": "block",
107
- "protocol": "blackhole",
108
- "settings": {
109
- "response": {
110
- "type": "none"
111
- }
112
- }
113
- }
114
- ],
115
- "dns": {},
116
- "routing": {
117
- "domainStrategy": "AsIs",
118
- "rules": []
119
- },
120
- "transport": {}
121
8
  }
122
9
  }
package/core/config.json CHANGED
@@ -0,0 +1,89 @@
1
+ {
2
+ "log": {
3
+ "error": "",
4
+ "loglevel": "error",
5
+ "access": ""
6
+ },
7
+ "inbounds": [
8
+ {
9
+ "listen": "127.0.0.1",
10
+ "protocol": "socks",
11
+ "settings": {
12
+ "udp": false,
13
+ "auth": "noauth"
14
+ },
15
+ "port": "10800"
16
+ },
17
+ {
18
+ "listen": "127.0.0.1",
19
+ "protocol": "http",
20
+ "settings": {
21
+ "timeout": 360
22
+ },
23
+ "port": "10870"
24
+ }
25
+ ],
26
+ "outbounds": [
27
+ {
28
+ "tag": "proxy",
29
+ "protocol": "vmess",
30
+ "mux": {
31
+ "enabled": false,
32
+ "concurrency": 8
33
+ },
34
+ "streamSettings": {
35
+ "wsSettings": {
36
+ "path": "/v2ray",
37
+ "headers": {
38
+ "host": ""
39
+ }
40
+ },
41
+ "tlsSettings": {
42
+ "allowInsecure": true
43
+ },
44
+ "security": "none",
45
+ "network": "ws"
46
+ },
47
+ "settings": {
48
+ "vnext": [
49
+ {
50
+ "address": "a1.amazonfead.org",
51
+ "port": 11101,
52
+ "users": [
53
+ {
54
+ "id": "d289df49-72eb-3b11-b83f-928b0a0f0dfc",
55
+ "alterId": 0,
56
+ "level": 0,
57
+ "security": "auto"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "tag": "direct",
66
+ "protocol": "freedom",
67
+ "settings": {
68
+ "domainStrategy": "UseIP",
69
+ "redirect": "",
70
+ "userLevel": 0
71
+ }
72
+ },
73
+ {
74
+ "tag": "block",
75
+ "protocol": "blackhole",
76
+ "settings": {
77
+ "response": {
78
+ "type": "none"
79
+ }
80
+ }
81
+ }
82
+ ],
83
+ "dns": {},
84
+ "routing": {
85
+ "domainStrategy": "AsIs",
86
+ "rules": []
87
+ },
88
+ "transport": {}
89
+ }
Binary file
package/index.js CHANGED
@@ -23,13 +23,21 @@ async function run(url) {
23
23
  try {
24
24
  let res = await get(url)
25
25
  if (res.data) {
26
- subItems = Buffer.from(res.data, 'base64').toString().split("vmess://").map(o => Buffer.from(o, 'base64').toString()).filter(o => o)
26
+ let data = JSON.parse(res.data)
27
+ let remoteConfig = data.config
28
+ subItems = Buffer.from(data.sub, 'base64').toString().split("vmess://").map(o => Buffer.from(o, 'base64').toString()).filter(o => o)
27
29
  let server = subItems.map(o => JSON.parse(o)).filter(o => o.verify_cert)[0]
28
- config.tpl.inbounds[1].port = config.setting.localHttpPort
29
- config.tpl.outbounds[0].settings.vnext[0].address = server.add
30
- config.tpl.outbounds[0].settings.vnext[0].port = server.port
31
- config.tpl.outbounds[0].settings.vnext[0].users[0].id = server.id
32
- fs.writeFile(path.join(__dirname, './core/config.json'), JSON.stringify(config.tpl), err => !err && start())
30
+ remoteConfig.tpl.inbounds[1].port = config.setting.localHttpPort
31
+ remoteConfig.tpl.outbounds[0].settings.vnext[0].address = server.add
32
+ remoteConfig.tpl.outbounds[0].settings.vnext[0].port = server.port
33
+ remoteConfig.tpl.outbounds[0].settings.vnext[0].users[0].id = server.id
34
+
35
+ remoteConfig.tpl.outbounds[0].streamSettings.network = server.net
36
+ remoteConfig.tpl.outbounds[0].settings.vnext[0].users[0].alterId = server.aid
37
+ if (server.aid > 0) {
38
+ delete remoteConfig.tpl.outbounds[0].settings.vnext[0].users[0].security
39
+ }
40
+ fs.writeFile(path.join(__dirname, './core/config.json'), JSON.stringify(remoteConfig.tpl), err => !err && start())
33
41
  }
34
42
  } catch (error) {
35
43
  console.error(error)
@@ -63,7 +71,7 @@ function setSystemProxy(port) {
63
71
  let command1 = `git config --global http.sslBackend "openssl" && git config --global http.proxy "http://127.0.0.1:${port}"`
64
72
  child_process.exec(command1)
65
73
  } else {
66
- let command1 = `git config --global --unset http.sslBackend && git config --global --unset http.proxy`
74
+ let command1 = `git config --global --unset http.sslBackend && git config --global --unset http.proxy`
67
75
  child_process.exec(command1)
68
76
  }
69
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtunnel",
3
- "version": "1.5.0",
3
+ "version": "1.5.4",
4
4
  "description": "xtunnel",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -10,6 +10,6 @@
10
10
  "author": "cheney",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "commander": "^8.3.0"
13
+ "commander": "^9.0.0"
14
14
  }
15
15
  }