MCPcopy
hub / github.com/fosrl/pangolin / fetchServerIp

Function fetchServerIp

server/lib/serverIpService.ts:12–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10];
11
12export async function fetchServerIp() {
13 for (const url of services) {
14 try {
15 const response = await axios.get(url, { timeout: 5000 });
16 serverIp = response.data.trim();
17 logger.debug("Detected public IP: " + serverIp);
18 return;
19 } catch (err: any) {
20 console.warn(
21 `Failed to fetch server IP from ${url}: ${err.message || err.code}`
22 );
23 }
24 }
25
26 console.error("All attempts to fetch server IP failed.");
27}
28
29export function getServerIp() {
30 return serverIp;

Callers 1

startServersFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected