proxy-kaze 1.0.0 → 1.0.2
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/package.json +5 -4
- package/pro.js +29 -41
package/package.json
CHANGED
package/pro.js
CHANGED
|
@@ -19,13 +19,6 @@ function hasCmd(cmd) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function detectPkgManager() {
|
|
23
|
-
if (hasCmd('apt')) return 'apt';
|
|
24
|
-
if (hasCmd('pacman')) return 'pacman';
|
|
25
|
-
if (hasCmd('dnf')) return 'dnf';
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
22
|
function genAuth(min, max) {
|
|
30
23
|
const len = Math.floor(Math.random() * (max - min + 1) + min);
|
|
31
24
|
return crypto.randomBytes(len).toString('hex').slice(0, len);
|
|
@@ -38,38 +31,37 @@ const B_PORT = Math.floor(Math.random() * 40000 + 20000);
|
|
|
38
31
|
const FULL_PROXY = `socks5://${USER}:${PASS}@bore.pub:${B_PORT}`;
|
|
39
32
|
|
|
40
33
|
// ---------- installers ----------
|
|
41
|
-
function installTermux() {
|
|
42
|
-
console.log("Detected Termux environment...");
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
35
|
+
function installTermux() {
|
|
36
|
+
console.log("Detected Termux...");
|
|
37
|
+
if (!hasCmd('bore') || !hasCmd('gost')) {
|
|
38
|
+
execSync("pkg update -y && pkg install bore gost -y", { stdio: 'inherit' });
|
|
49
39
|
}
|
|
50
40
|
}
|
|
51
41
|
|
|
52
|
-
function installLinux(
|
|
53
|
-
console.log(
|
|
42
|
+
function installLinux() {
|
|
43
|
+
console.log("Installing Linux deps...");
|
|
54
44
|
|
|
55
45
|
if (!hasCmd('curl')) {
|
|
56
|
-
|
|
57
|
-
if (pkg === 'pacman') execSync('sudo pacman -Sy curl', { stdio: 'inherit' });
|
|
58
|
-
if (pkg === 'dnf') execSync('sudo dnf install -y curl', { stdio: 'inherit' });
|
|
46
|
+
execSync("sudo apt update && sudo apt install -y curl", { stdio: 'inherit' });
|
|
59
47
|
}
|
|
60
48
|
|
|
61
49
|
if (!hasCmd('bore')) {
|
|
62
|
-
execSync(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
execSync(`
|
|
51
|
+
curl -L https://github.com/ekzhang/bore/releases/download/v0.6.0/bore-v0.6.0-x86_64-unknown-linux-musl.tar.gz -o bore.tar.gz &&
|
|
52
|
+
tar -xzf bore.tar.gz &&
|
|
53
|
+
chmod +x bore &&
|
|
54
|
+
sudo mv bore /usr/local/bin/
|
|
55
|
+
`, { stdio: 'inherit' });
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
if (!hasCmd('gost')) {
|
|
69
|
-
execSync(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
execSync(`
|
|
60
|
+
curl -L https://github.com/go-gost/gost/releases/download/v3.2.6/gost_3.2.6_linux_amd64.tar.gz -o gost.tar.gz &&
|
|
61
|
+
tar -xzf gost.tar.gz &&
|
|
62
|
+
chmod +x gost &&
|
|
63
|
+
sudo mv gost /usr/local/bin/
|
|
64
|
+
`, { stdio: 'inherit' });
|
|
73
65
|
}
|
|
74
66
|
}
|
|
75
67
|
|
|
@@ -77,12 +69,17 @@ function installWindows() {
|
|
|
77
69
|
console.log("Detected Windows...");
|
|
78
70
|
|
|
79
71
|
if (!hasCmd('winget')) {
|
|
80
|
-
console.log("
|
|
72
|
+
console.log("Install winget first.");
|
|
81
73
|
process.exit(1);
|
|
82
74
|
}
|
|
83
75
|
|
|
84
|
-
if (!hasCmd('bore'))
|
|
85
|
-
|
|
76
|
+
if (!hasCmd('bore')) {
|
|
77
|
+
execSync(`powershell -Command "Invoke-WebRequest -Uri https://github.com/ekzhang/bore/releases/download/v0.6.0/bore-v0.6.0-x86_64-pc-windows-msvc.zip -OutFile bore.zip; Expand-Archive bore.zip -DestinationPath C:\\bore"`, { stdio: 'inherit' });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!hasCmd('gost')) {
|
|
81
|
+
execSync(`powershell -Command "Invoke-WebRequest -Uri https://github.com/go-gost/gost/releases/download/v3.2.6/gost_3.2.6_windows_amd64.zip -OutFile gost.zip; Expand-Archive gost.zip -DestinationPath C:\\gost"`, { stdio: 'inherit' });
|
|
82
|
+
}
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
// ---------- dependency setup ----------
|
|
@@ -94,20 +91,12 @@ function installDeps() {
|
|
|
94
91
|
try {
|
|
95
92
|
if (IS_TERMUX || PLATFORM === 'android') {
|
|
96
93
|
installTermux();
|
|
97
|
-
|
|
98
94
|
} else if (PLATFORM === 'linux') {
|
|
99
|
-
|
|
100
|
-
if (!pkg) {
|
|
101
|
-
console.log("No supported package manager found.");
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
installLinux(pkg);
|
|
105
|
-
|
|
95
|
+
installLinux();
|
|
106
96
|
} else if (PLATFORM === 'win32') {
|
|
107
97
|
installWindows();
|
|
108
|
-
|
|
109
98
|
} else {
|
|
110
|
-
console.log("Unsupported OS
|
|
99
|
+
console.log("Unsupported OS");
|
|
111
100
|
process.exit(1);
|
|
112
101
|
}
|
|
113
102
|
|
|
@@ -138,7 +127,6 @@ function start() {
|
|
|
138
127
|
if (PLATFORM === 'win32') {
|
|
139
128
|
spawn('cmd', ['/c', gostCmd], { stdio: 'inherit' });
|
|
140
129
|
spawn('cmd', ['/c', boreCmd], { stdio: 'inherit' });
|
|
141
|
-
|
|
142
130
|
} else {
|
|
143
131
|
spawn('sh', ['-c', gostCmd], { stdio: 'inherit' });
|
|
144
132
|
spawn('sh', ['-c', boreCmd], { stdio: 'inherit' });
|