proxy-kaze 1.0.1 → 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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/pro.js +17 -37
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "proxy-kaze",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "pro.js",
5
5
  "bin": {
6
- "sockproxy": "./pro.js"
7
- }
6
+ "pk": "pro.js"
7
+ },
8
+ "preferGlobal": true
8
9
  }
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,48 +31,34 @@ 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 ----------
34
+
41
35
  function installTermux() {
42
36
  console.log("Detected Termux...");
43
-
44
37
  if (!hasCmd('bore') || !hasCmd('gost')) {
45
- execSync(
46
- "pkg update -y && pkg install nodejs-lts bore gost -y",
47
- { stdio: 'inherit' }
48
- );
38
+ execSync("pkg update -y && pkg install bore gost -y", { stdio: 'inherit' });
49
39
  }
50
40
  }
51
41
 
52
42
  function installLinux() {
53
- console.log("Installing dependencies (Linux)...");
43
+ console.log("Installing Linux deps...");
54
44
 
55
- // ensure curl exists
56
45
  if (!hasCmd('curl')) {
57
- const pkg = detectPkgManager();
58
- if (!pkg) {
59
- console.log("No supported package manager found for curl.");
60
- process.exit(1);
61
- }
62
-
63
- if (pkg === 'apt') execSync('sudo apt update && sudo apt install -y curl', { stdio: 'inherit' });
64
- if (pkg === 'pacman') execSync('sudo pacman -Sy curl', { stdio: 'inherit' });
65
- if (pkg === 'dnf') execSync('sudo dnf install -y curl', { stdio: 'inherit' });
46
+ execSync("sudo apt update && sudo apt install -y curl", { stdio: 'inherit' });
66
47
  }
67
48
 
68
- // install bore
69
49
  if (!hasCmd('bore')) {
70
- console.log("Installing bore...");
71
50
  execSync(`
72
- curl -L https://github.com/ekzhang/bore/releases/latest/download/bore-linux-amd64 -o bore &&
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 &&
73
53
  chmod +x bore &&
74
54
  sudo mv bore /usr/local/bin/
75
55
  `, { stdio: 'inherit' });
76
56
  }
77
57
 
78
- // install gost
79
58
  if (!hasCmd('gost')) {
80
- console.log("Installing gost...");
81
59
  execSync(`
82
- curl -L https://github.com/go-gost/gost/releases/latest/download/gost-linux-amd64 -o gost &&
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 &&
83
62
  chmod +x gost &&
84
63
  sudo mv gost /usr/local/bin/
85
64
  `, { stdio: 'inherit' });
@@ -90,12 +69,17 @@ function installWindows() {
90
69
  console.log("Detected Windows...");
91
70
 
92
71
  if (!hasCmd('winget')) {
93
- console.log("Winget not found. Install App Installer from Microsoft Store.");
72
+ console.log("Install winget first.");
94
73
  process.exit(1);
95
74
  }
96
75
 
97
- if (!hasCmd('bore')) execSync('winget install --id sharkdp.bore -e', { stdio: 'inherit' });
98
- if (!hasCmd('gost')) execSync('winget install --id gost.gost -e', { stdio: 'inherit' });
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
+ }
99
83
  }
100
84
 
101
85
  // ---------- dependency setup ----------
@@ -107,15 +91,12 @@ function installDeps() {
107
91
  try {
108
92
  if (IS_TERMUX || PLATFORM === 'android') {
109
93
  installTermux();
110
-
111
94
  } else if (PLATFORM === 'linux') {
112
95
  installLinux();
113
-
114
96
  } else if (PLATFORM === 'win32') {
115
97
  installWindows();
116
-
117
98
  } else {
118
- console.log("Unsupported OS.");
99
+ console.log("Unsupported OS");
119
100
  process.exit(1);
120
101
  }
121
102
 
@@ -146,7 +127,6 @@ function start() {
146
127
  if (PLATFORM === 'win32') {
147
128
  spawn('cmd', ['/c', gostCmd], { stdio: 'inherit' });
148
129
  spawn('cmd', ['/c', boreCmd], { stdio: 'inherit' });
149
-
150
130
  } else {
151
131
  spawn('sh', ['-c', gostCmd], { stdio: 'inherit' });
152
132
  spawn('sh', ['-c', boreCmd], { stdio: 'inherit' });