va-tracker-middleware/src/testApiVpnConnection.js

64 lines
1.7 KiB
JavaScript

// testVpnApi.js
import axios from "axios";
const apiUrl = "http://165.140.240.203:3000/api";
const apiKey = "hellovpn123";
const possiblePaths = [
"/", "/v1", "/servers", "/status", "/vpn", "/health", "/ping",
"/nodes", "/list", "/connect", "/config", "/create", "/createConfig",
"/check", "/organizations", "/users"
];
async function testPaths() {
for (const path of possiblePaths) {
try {
const res = await axios.get(`${apiUrl}${path}`, {
headers: { "x-api-key": apiKey },
timeout: 3000
});
console.log(`✅ ${path} → ${res.status} ${res.statusText}`);
console.log("Response:", res.data);
} catch (err) {
if (err.response) {
console.log(`❌ ${path} → ${err.response.status}`);
} else {
console.log(`⚠️ ${path} → No response`);
}
}
}
}
testPaths();// testVpnApi.js
import axios from "axios";
const apiUrl = "http://165.140.240.203:3000/api";
const apiKey = "hellovpn123";
const possiblePaths = [
"/", "/v1", "/servers", "/status", "/vpn", "/health", "/ping",
"/nodes", "/list", "/connect", "/config", "/create", "/createConfig",
"/check", "/organizations", "/users"
];
async function testPaths() {
for (const path of possiblePaths) {
try {
const res = await axios.get(`${apiUrl}${path}`, {
headers: { "x-api-key": apiKey },
timeout: 3000
});
console.log(`✅ ${path} → ${res.status} ${res.statusText}`);
console.log("Response:", res.data);
} catch (err) {
if (err.response) {
console.log(`❌ ${path} → ${err.response.status}`);
} else {
console.log(`⚠️ ${path} → No response`);
}
}
}
}
testPaths();