MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / installBinary

Method installBinary

warp/warp.ts:252–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

250
251 let archName = "amd64";
252 if (arch === "aarch64" || arch === "arm64") archName = "arm64";
253 else if (arch === "x86_64") archName = "amd64";
254 else if (arch === "armv7l" || arch === "armhf") archName = "arm";
255 else if (arch === "i386" || arch === "i686") archName = "386";
256 else throw new Error(`不支持的架构: ${arch}`);
257
258 const version = "1.0.9";
259 const url = `https://github.com/pufferffish/wireproxy/releases/download/v${version}/wireproxy_linux_${archName}.tar.gz`;
260
261 const downloadCmd = `wget -T 30 -q -O /tmp/wireproxy.tar.gz ${url} || curl -L --connect-timeout 30 -s -o /tmp/wireproxy.tar.gz ${url}`;
262 const installCmd = `rm -f /tmp/wireproxy.tar.gz && ${downloadCmd} && tar xzf /tmp/wireproxy.tar.gz -C /tmp/ && mv /tmp/wireproxy ${WIREPROXY_BINARY} && chmod +x ${WIREPROXY_BINARY}`;
263
264 const result = await SystemExecutor.runSudo(installCmd);
265 if (!result.success) {
266 throw new Error(`安装失败: ${result.error}`);
267 }
268 }
269
270 static async setupAndStart(port?: number): Promise<string> {
271 try {
272 const targetPort = port || (await this.findAvailablePort());
273
274 if (targetPort < 1 || targetPort > 65535 || isNaN(targetPort)) {
275 return `❌ 无效端口: ${targetPort}`;
276 }

Callers 1

setupAndStartMethod · 0.95

Calls 2

runMethod · 0.80
runSudoMethod · 0.80

Tested by

no test coverage detected