@bifrost-proxy/bifrost 0.0.41-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/bin/bifrost +22 -0
- package/lib/index.js +38 -0
- package/package.json +38 -0
package/bin/bifrost
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const { getBinaryPath } = require("../lib/index.js");
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
const binaryPath = getBinaryPath();
|
|
8
|
+
execFileSync(binaryPath, process.argv.slice(2), {
|
|
9
|
+
stdio: "inherit",
|
|
10
|
+
env: process.env,
|
|
11
|
+
});
|
|
12
|
+
} catch (error) {
|
|
13
|
+
if (typeof error.status === "number") {
|
|
14
|
+
process.exit(error.status);
|
|
15
|
+
}
|
|
16
|
+
if (error.signal) {
|
|
17
|
+
process.kill(process.pid, error.signal);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.error(error.message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const { platform, arch } = process;
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const PLATFORM_MAP = {
|
|
5
|
+
"linux-x64": "@bifrost-proxy/bifrost-linux-x64",
|
|
6
|
+
"linux-arm64": "@bifrost-proxy/bifrost-linux-arm64",
|
|
7
|
+
"linux-arm": "@bifrost-proxy/bifrost-linux-arm",
|
|
8
|
+
"darwin-x64": "@bifrost-proxy/bifrost-darwin-x64",
|
|
9
|
+
"darwin-arm64": "@bifrost-proxy/bifrost-darwin-arm64",
|
|
10
|
+
"win32-x64": "@bifrost-proxy/bifrost-win32-x64",
|
|
11
|
+
"win32-arm64": "@bifrost-proxy/bifrost-win32-arm64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function getBinaryPath() {
|
|
15
|
+
const key = `${platform}-${arch}`;
|
|
16
|
+
const packageName = PLATFORM_MAP[key];
|
|
17
|
+
|
|
18
|
+
if (!packageName) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Unsupported platform: ${platform}-${arch}. ` +
|
|
21
|
+
`Supported platforms: ${Object.keys(PLATFORM_MAP).join(", ")}`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const binaryName = platform === "win32" ? "bifrost.exe" : "bifrost";
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const packageDir = path.dirname(require.resolve(`${packageName}/package.json`));
|
|
29
|
+
return path.join(packageDir, "bin", binaryName);
|
|
30
|
+
} catch {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`The platform-specific package ${packageName} is not installed. ` +
|
|
33
|
+
`Please reinstall @bifrost-proxy/bifrost to fix this.`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.getBinaryPath = getBinaryPath;
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bifrost-proxy/bifrost",
|
|
3
|
+
"version": "0.0.41-beta",
|
|
4
|
+
"description": "High-performance HTTP/HTTPS/SOCKS5 proxy server written in Rust",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/bifrost-proxy/bifrost"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/bifrost-proxy/bifrost",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"proxy",
|
|
13
|
+
"http",
|
|
14
|
+
"https",
|
|
15
|
+
"socks5",
|
|
16
|
+
"bifrost",
|
|
17
|
+
"mitm",
|
|
18
|
+
"network",
|
|
19
|
+
"debugging"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"bifrost": "bin/bifrost"
|
|
23
|
+
},
|
|
24
|
+
"main": "lib/index.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"bin/bifrost",
|
|
27
|
+
"lib/index.js"
|
|
28
|
+
],
|
|
29
|
+
"optionalDependencies": {
|
|
30
|
+
"@bifrost-proxy/bifrost-linux-x64": "0.0.41-beta",
|
|
31
|
+
"@bifrost-proxy/bifrost-linux-arm64": "0.0.41-beta",
|
|
32
|
+
"@bifrost-proxy/bifrost-linux-arm": "0.0.41-beta",
|
|
33
|
+
"@bifrost-proxy/bifrost-darwin-x64": "0.0.41-beta",
|
|
34
|
+
"@bifrost-proxy/bifrost-darwin-arm64": "0.0.41-beta",
|
|
35
|
+
"@bifrost-proxy/bifrost-win32-x64": "0.0.41-beta",
|
|
36
|
+
"@bifrost-proxy/bifrost-win32-arm64": "0.0.41-beta"
|
|
37
|
+
}
|
|
38
|
+
}
|