xtunnel 1.5.1 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- "tag": "proxy",
61
- "protocol": "vmess",
62
- "mux": {
63
- "enabled": false,
64
- "concurrency": 8
65
- },
66
- "streamSettings": {
67
- "wsSettings": {
68
- "path": "/v2ray",
69
- "headers": {
70
- "host": ""
71
- }
72
- },
73
- "tlsSettings": {
74
- "allowInsecure": true
75
- },
76
- "security": "none",
77
- "network": "ws"
78
- },
79
- "settings": {
80
- "vnext": [
81
- {
82
- "address": "u4.amazonfeed.net",
83
- "port": 3106,
84
- "users": [
85
- {
86
- "id": "d289df49-72eb-3b11-b83f-928b0a0f0dfc",
87
- "alterId": 0,
88
- "level": 0,
89
- "security": "auto"
90
- }
91
- ]
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/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.1",
3
+ "version": "1.5.3",
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
  }
Binary file