MCPcopy Index your code
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getAllServers

Function getAllServers

speedtest/speedtest.ts:792–807  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

790}
791
792async function getAllServers(): Promise<ServerInfo[]> {
793 try {
794 if (!fs.existsSync(SPEEDTEST_PATH)) {
795 await downloadCli();
796 }
797
798 const command = `"${SPEEDTEST_PATH}" -f json -L`;
799 const { stdout } = await execAsync(command, { timeout: 30000 });
800 const result = JSON.parse(stdout);
801
802 return result.servers || [];
803 } catch (error: any) {
804 console.error("Failed to get servers:", error);
805 return [];
806 }
807}
808
809/**
810 * 轻量级服务器ping测试

Callers 4

testServerAvailabilityFunction · 0.85
selectBestServerFunction · 0.85
speedtestFunction · 0.85

Calls 2

errorMethod · 0.80
downloadCliFunction · 0.70

Tested by

no test coverage detected