code changes
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-05-26 19:01:34 +03:00
parent 89a55a1898
commit 73784275d6
2 changed files with 29 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
###########################################################################
###########################################################################
##################just an example, need set real ips#######################
###########################################################################
###########################################################################
server:
port: 4000
targets:
hosts:
- url: http://127.0.0.1:7088
name: proxy-city
- url: http://127.0.0.1:7089
name: proxy-optima
endpoints:
- /testmontools/curl
- /testmontools/traceroute
- /testmontools/ping
timeout: 120000
+8 -4
View File
@@ -12,7 +12,7 @@ const configPath = path.join(__dirname, "config.yml");
const config = yaml.load(fs.readFileSync(configPath, "utf8")); const config = yaml.load(fs.readFileSync(configPath, "utf8"));
const PORT = config.server?.port || 4000; const PORT = config.server?.port || 4000;
const HOSTS = config.targets?.hosts || ["http://127.0.0.1:7088"]; const HOSTS = config.targets?.hosts || ["http://127.0.0.1:7088", name: "my-server"];
const ENDPOINTS = config.targets?.endpoints || []; const ENDPOINTS = config.targets?.endpoints || [];
const TIMEOUT = config.targets?.timeout || 120_000; const TIMEOUT = config.targets?.timeout || 120_000;
@@ -52,7 +52,7 @@ app.post("/api/parallel-fetch", async (req, res) => {
socket.emit("batch:start", { url, total: tasks.length }); socket.emit("batch:start", { url, total: tasks.length });
const promises = tasks.map(({ host, endpoint }) => { const promises = tasks.map(({ host, endpoint }) => {
const fullUrl = host + endpoint; const fullUrl = host.url + endpoint;
const start = Date.now(); const start = Date.now();
return axios({ return axios({
@@ -66,7 +66,9 @@ app.post("/api/parallel-fetch", async (req, res) => {
const elapsed = Date.now() - start; const elapsed = Date.now() - start;
console.log(`[OK] ${host} ${endpoint} (${elapsed}ms)`); console.log(`[OK] ${host} ${endpoint} (${elapsed}ms)`);
socket.emit("tool:response", { socket.emit("tool:response", {
host, endpoint, host: host.url,
serverName: host.name,
endpoint,
ok: true, ok: true,
status: response.status, status: response.status,
data: response.data, data: response.data,
@@ -77,7 +79,9 @@ app.post("/api/parallel-fetch", async (req, res) => {
const elapsed = Date.now() - start; const elapsed = Date.now() - start;
console.log(`[ERROR] ${host} ${endpoint} (${elapsed}ms) — ${err.message}`); console.log(`[ERROR] ${host} ${endpoint} (${elapsed}ms) — ${err.message}`);
socket.emit("tool:error", { socket.emit("tool:error", {
host, endpoint, host: host.url,
serverName: host.name,
endpoint,
ok: false, ok: false,
error: err.message, error: err.message,
code: err.code || null, code: err.code || null,