@bifrost-proxy/bifrost 0.0.43-beta → 0.0.45-beta

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/README.md CHANGED
@@ -51,7 +51,7 @@ npm i @bifrost-proxy/bifrost
51
51
  启动代理:
52
52
 
53
53
  ```bash
54
- bifrost start
54
+ bifrost start -d
55
55
  ```
56
56
 
57
57
  启动后访问管理端:
@@ -60,11 +60,6 @@ bifrost start
60
60
  http://127.0.0.1:9900/_bifrost/
61
61
  ```
62
62
 
63
- 启用 HTTPS 拦截:
64
-
65
- ```bash
66
- bifrost start --intercept
67
- ```
68
63
 
69
64
  ## 基本用法摘要
70
65
 
package/install.js CHANGED
@@ -8,17 +8,43 @@ const child_process = require("child_process");
8
8
  const packageJSON = require(path.join(__dirname, "package.json"));
9
9
 
10
10
  const PLATFORM_MAP = {
11
- "linux-x64": { pkg: "@bifrost-proxy/bifrost-linux-x64", binary: "bifrost" },
12
- "linux-arm64": { pkg: "@bifrost-proxy/bifrost-linux-arm64", binary: "bifrost" },
13
- "linux-arm": { pkg: "@bifrost-proxy/bifrost-linux-arm", binary: "bifrost" },
11
+ "linux-x64-glibc": { pkg: "@bifrost-proxy/bifrost-linux-x64", binary: "bifrost" },
12
+ "linux-x64-musl": { pkg: "@bifrost-proxy/bifrost-linux-x64-musl", binary: "bifrost" },
13
+ "linux-arm64-glibc": { pkg: "@bifrost-proxy/bifrost-linux-arm64", binary: "bifrost" },
14
+ "linux-arm64-musl": { pkg: "@bifrost-proxy/bifrost-linux-arm64-musl", binary: "bifrost" },
15
+ "linux-arm-glibc": { pkg: "@bifrost-proxy/bifrost-linux-arm", binary: "bifrost" },
14
16
  "darwin-x64": { pkg: "@bifrost-proxy/bifrost-darwin-x64", binary: "bifrost" },
15
17
  "darwin-arm64": { pkg: "@bifrost-proxy/bifrost-darwin-arm64", binary: "bifrost" },
16
18
  "win32-x64": { pkg: "@bifrost-proxy/bifrost-win32-x64", binary: "bifrost.exe" },
17
19
  "win32-arm64": { pkg: "@bifrost-proxy/bifrost-win32-arm64", binary: "bifrost.exe" },
18
20
  };
19
21
 
22
+ function detectLibc() {
23
+ if (process.platform !== "linux") return null;
24
+ try {
25
+ const lddOutput = child_process.execSync("ldd --version 2>&1 || true", {
26
+ stdio: ["pipe", "pipe", "pipe"],
27
+ encoding: "utf8",
28
+ });
29
+ if (/musl/i.test(lddOutput)) return "musl";
30
+ if (/GLIBC|GNU libc/i.test(lddOutput)) return "glibc";
31
+ } catch {}
32
+ try {
33
+ if (fs.existsSync("/lib/ld-musl-x86_64.so.1") ||
34
+ fs.existsSync("/lib/ld-musl-aarch64.so.1") ||
35
+ fs.existsSync("/lib/ld-musl-armhf.so.1")) {
36
+ return "musl";
37
+ }
38
+ } catch {}
39
+ return "glibc";
40
+ }
41
+
20
42
  function getPlatformInfo() {
21
- const key = `${process.platform}-${os.arch()}`;
43
+ let key = `${process.platform}-${os.arch()}`;
44
+ if (process.platform === "linux") {
45
+ const libc = detectLibc();
46
+ key = `${key}-${libc}`;
47
+ }
22
48
  const info = PLATFORM_MAP[key];
23
49
  if (!info) {
24
50
  throw new Error(
package/lib/index.js CHANGED
@@ -1,19 +1,46 @@
1
1
  const { platform, arch } = process;
2
2
  const path = require("path");
3
3
  const fs = require("fs");
4
+ const child_process = require("child_process");
4
5
 
5
6
  const PLATFORM_MAP = {
6
- "linux-x64": "@bifrost-proxy/bifrost-linux-x64",
7
- "linux-arm64": "@bifrost-proxy/bifrost-linux-arm64",
8
- "linux-arm": "@bifrost-proxy/bifrost-linux-arm",
7
+ "linux-x64-glibc": "@bifrost-proxy/bifrost-linux-x64",
8
+ "linux-x64-musl": "@bifrost-proxy/bifrost-linux-x64-musl",
9
+ "linux-arm64-glibc": "@bifrost-proxy/bifrost-linux-arm64",
10
+ "linux-arm64-musl": "@bifrost-proxy/bifrost-linux-arm64-musl",
11
+ "linux-arm-glibc": "@bifrost-proxy/bifrost-linux-arm",
9
12
  "darwin-x64": "@bifrost-proxy/bifrost-darwin-x64",
10
13
  "darwin-arm64": "@bifrost-proxy/bifrost-darwin-arm64",
11
14
  "win32-x64": "@bifrost-proxy/bifrost-win32-x64",
12
15
  "win32-arm64": "@bifrost-proxy/bifrost-win32-arm64",
13
16
  };
14
17
 
18
+ function detectLibc() {
19
+ if (platform !== "linux") return null;
20
+ try {
21
+ const lddOutput = child_process.execSync("ldd --version 2>&1 || true", {
22
+ stdio: ["pipe", "pipe", "pipe"],
23
+ encoding: "utf8",
24
+ });
25
+ if (/musl/i.test(lddOutput)) return "musl";
26
+ if (/GLIBC|GNU libc/i.test(lddOutput)) return "glibc";
27
+ } catch {}
28
+ try {
29
+ if (fs.existsSync("/lib/ld-musl-x86_64.so.1") ||
30
+ fs.existsSync("/lib/ld-musl-aarch64.so.1") ||
31
+ fs.existsSync("/lib/ld-musl-armhf.so.1")) {
32
+ return "musl";
33
+ }
34
+ } catch {}
35
+ return "glibc";
36
+ }
37
+
15
38
  function getBinaryPath() {
16
- const key = `${platform}-${arch}`;
39
+ let key = `${platform}-${arch}`;
40
+ if (platform === "linux") {
41
+ const libc = detectLibc();
42
+ key = `${key}-${libc}`;
43
+ }
17
44
  const packageName = PLATFORM_MAP[key];
18
45
 
19
46
  if (!packageName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrost-proxy/bifrost",
3
- "version": "0.0.43-beta",
3
+ "version": "0.0.45-beta",
4
4
  "description": "High-performance HTTP/HTTPS/SOCKS5 proxy server written in Rust",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,12 +32,14 @@
32
32
  "README.md"
33
33
  ],
34
34
  "optionalDependencies": {
35
- "@bifrost-proxy/bifrost-linux-x64": "0.0.43-beta",
36
- "@bifrost-proxy/bifrost-linux-arm64": "0.0.43-beta",
37
- "@bifrost-proxy/bifrost-linux-arm": "0.0.43-beta",
38
- "@bifrost-proxy/bifrost-darwin-x64": "0.0.43-beta",
39
- "@bifrost-proxy/bifrost-darwin-arm64": "0.0.43-beta",
40
- "@bifrost-proxy/bifrost-win32-x64": "0.0.43-beta",
41
- "@bifrost-proxy/bifrost-win32-arm64": "0.0.43-beta"
35
+ "@bifrost-proxy/bifrost-linux-x64": "0.0.45-beta",
36
+ "@bifrost-proxy/bifrost-linux-arm64": "0.0.45-beta",
37
+ "@bifrost-proxy/bifrost-linux-arm": "0.0.45-beta",
38
+ "@bifrost-proxy/bifrost-linux-x64-musl": "0.0.45-beta",
39
+ "@bifrost-proxy/bifrost-linux-arm64-musl": "0.0.45-beta",
40
+ "@bifrost-proxy/bifrost-darwin-x64": "0.0.45-beta",
41
+ "@bifrost-proxy/bifrost-darwin-arm64": "0.0.45-beta",
42
+ "@bifrost-proxy/bifrost-win32-x64": "0.0.45-beta",
43
+ "@bifrost-proxy/bifrost-win32-arm64": "0.0.45-beta"
42
44
  }
43
45
  }