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

Function testServerAvailability

speedtest/speedtest.ts:870–886  ·  view source on GitHub ↗

* 简化的服务器可用性检测 - 仅检查服务器是否在列表中

(serverId: number)

Source from the content-addressed store, hash-verified

868
869 if (!serverExists) {
870 return { available: false, error: "服务器不在可用列表中" };
871 }
872
873 // 服务器在列表中就认为可用
874 return { available: true };
875 } catch (error: any) {
876 console.error(`Server ${serverId} availability test failed:`, error);
877 return { available: false, error: error.message || "测试失败" };
878 }
879}
880
881/**
882 * 快速ping测试多个服务器
883 */
884async function quickPingServers(servers: ServerInfo[], maxServers: number = 5): Promise<ServerInfo[]> {
885 const testPromises = servers.slice(0, maxServers).map(async (server) => {
886 try {
887 const result = await testServerAvailability(server.id);
888 return {
889 ...server,

Callers 2

quickPingServersFunction · 0.85
speedtestFunction · 0.85

Calls 2

getAllServersFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected