xtunnel 1.0.1 → 1.0.6

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.
@@ -2,8 +2,8 @@
2
2
  "setting": {
3
3
  "localHttpPort": "1087",
4
4
  "localSockPort": "1080",
5
- "subscribeLink": "https://d.cloudso.club/link/lOvg7ZP1J7iGHAvl?sub=3&extend=1",
6
- "selectedServer": "🇭🇰 香港 | 07 | T1",
5
+ "subscribeLink": "",
6
+ "selectedServer": "",
7
7
  "selectedMode": "PAC"
8
8
  },
9
9
  "routingPac": {
@@ -114,24 +114,8 @@
114
114
  ],
115
115
  "dns": {},
116
116
  "routing": {
117
- "domainStrategy": "IPOnDemand",
118
- "rules": [
119
- {
120
- "type": "field",
121
- "outboundTag": "direct",
122
- "domain": [
123
- "geosite:cn"
124
- ]
125
- },
126
- {
127
- "type": "field",
128
- "outboundTag": "direct",
129
- "ip": [
130
- "geoip:cn",
131
- "geoip:private"
132
- ]
133
- }
134
- ]
117
+ "domainStrategy": "AsIs",
118
+ "rules": []
135
119
  },
136
120
  "transport": {}
137
121
  }
package/core/config.json CHANGED
@@ -1 +1,90 @@
1
- {"log":{"error":"","loglevel":"warning","access":""},"inbounds":[{"listen":"127.0.0.1","protocol":"socks","settings":{"udp":false,"auth":"noauth"},"port":"1080"},{"listen":"127.0.0.1","protocol":"http","settings":{"timeout":360,"port":"1087"},"port":"1087"}],"outbounds":[{"mux":{"enabled":false,"concurrency":8},"protocol":"vmess","streamSettings":{"wsSettings":{"path":"/v2ray","headers":{"host":""}},"tlsSettings":{"allowInsecure":true},"security":"none","network":"ws"},"tag":"proxy","settings":{"vnext":[{"address":"u3.amazonfeed.net","users":[{"id":"d289df49-72eb-3b11-b83f-928b0a0f0dfc","alterId":2,"level":0,"security":"aes-128-gcm"}],"port":11101}]}},{"tag":"direct","protocol":"freedom","settings":{"domainStrategy":"UseIP","redirect":"","userLevel":0}},{"tag":"block","protocol":"blackhole","settings":{"response":{"type":"none"}}}],"dns":{},"routing":{"domainStrategy":"AsIs","rules":[]},"transport":{}}
1
+ {
2
+ "log": {
3
+ "error": "",
4
+ "loglevel": "warning",
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": "1080"
16
+ },
17
+ {
18
+ "listen": "127.0.0.1",
19
+ "protocol": "http",
20
+ "settings": {
21
+ "timeout": 360,
22
+ "port": "1087"
23
+ },
24
+ "port": "1087"
25
+ }
26
+ ],
27
+ "outbounds": [
28
+ {
29
+ "mux": {
30
+ "enabled": false,
31
+ "concurrency": 8
32
+ },
33
+ "protocol": "vmess",
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
+ "tag": "proxy",
48
+ "settings": {
49
+ "vnext": [
50
+ {
51
+ "address": "u3.amazonfeed.net",
52
+ "users": [
53
+ {
54
+ "id": "d289df49-72eb-3b11-b83f-928b0a0f0dfc",
55
+ "alterId": 2,
56
+ "level": 0,
57
+ "security": "aes-128-gcm"
58
+ }
59
+ ],
60
+ "port": 11101
61
+ }
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ "tag": "direct",
67
+ "protocol": "freedom",
68
+ "settings": {
69
+ "domainStrategy": "UseIP",
70
+ "redirect": "",
71
+ "userLevel": 0
72
+ }
73
+ },
74
+ {
75
+ "tag": "block",
76
+ "protocol": "blackhole",
77
+ "settings": {
78
+ "response": {
79
+ "type": "none"
80
+ }
81
+ }
82
+ }
83
+ ],
84
+ "dns": {},
85
+ "routing": {
86
+ "domainStrategy": "AsIs",
87
+ "rules": []
88
+ },
89
+ "transport": {}
90
+ }
package/index.js CHANGED
@@ -1,23 +1,22 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const program = require('commander')
2
4
  const axios = require('axios')
3
- const config = require('config')
4
5
  const path = require('path')
5
6
  const fs = require('fs')
6
7
  const child_process = require('child_process')
7
8
 
9
+ console.log(path.join(__dirname, './config/default.json'))
10
+ const config = JSON.parse(fs.readFileSync(path.join(__dirname, './config/default.json')))
11
+
8
12
  let rayProcess = null
9
13
 
10
14
  process.on('SIGINT', () => stop())
11
15
 
12
- program
13
- .version('1.0.0')
14
- .description('Tunnel CLI')
15
- program
16
- .command('* <url>')
17
- .action(url => url && init(url))
16
+ program.version('1.0.0').description('Tunnel CLI')
17
+ program.command('* <url>').action(url => url && init(url))
18
18
  program.parse(process.argv)
19
19
 
20
-
21
20
  async function init(url) {
22
21
  try {
23
22
  let res = await axios.get(url)
@@ -39,10 +38,10 @@ async function init(url) {
39
38
  function switchServer(server) {
40
39
  // 切换服务器
41
40
  config.tpl.inbounds[1].settings.port = config.setting.localHttpPort
42
- config.tpl.routing = config.routingGlobal
43
41
  config.tpl.outbounds[0].settings.vnext[0].address = server.add
44
42
  config.tpl.outbounds[0].settings.vnext[0].port = server.port
45
43
  config.tpl.outbounds[0].settings.vnext[0].users[0].id = server.id
44
+ console.log(path.join(__dirname, './core/config.json'))
46
45
  fs.writeFile(path.join(__dirname, './core/config.json'), JSON.stringify(config.tpl), err => !err && start())
47
46
  }
48
47
 
@@ -50,6 +49,7 @@ function start() {
50
49
  // 关闭上个进程
51
50
  rayProcess && rayProcess.kill('SIGINT')
52
51
  // 设置系统代理
52
+ console.log(config.setting.localHttpPort)
53
53
  setSystemProxy(config.setting.localHttpPort)
54
54
  // 根据操作系统平台-启动新进程
55
55
  rayProcess = child_process.exec(path.join(__dirname, './core/xray-linux-x64'), (error, stdout, stderr) => error && stop() && console.error('启动失败,请检查权限/端口占用'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtunnel",
3
- "version": "1.0.1",
3
+ "version": "1.0.6",
4
4
  "description": "xtunnel",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -11,7 +11,6 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "axios": "^0.24.0",
14
- "commander": "^8.3.0",
15
- "config": "^3.3.6"
14
+ "commander": "^8.3.0"
16
15
  }
17
16
  }
package/core/geoip.dat DELETED
Binary file