mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-07 12:06:56 +03:00
♻️ refactor(podkop): remove redundant DNS/sing-box checks in fakeip status
This commit is contained in:
@@ -1134,27 +1134,6 @@ async function checkFakeIP() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const singboxStatusResult = await safeExec('/usr/bin/podkop', ['get_sing_box_status']);
|
|
||||||
const singboxStatus = JSON.parse(singboxStatusResult.stdout || '{"running":0,"dns_configured":0}');
|
|
||||||
|
|
||||||
if (!singboxStatus.running) {
|
|
||||||
return createStatus('not_working', 'sing-box not running', 'ERROR');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load UCI config to check dont_touch_dhcp
|
|
||||||
let dontTouchDhcp = false;
|
|
||||||
try {
|
|
||||||
const data = await uci.load('podkop');
|
|
||||||
dontTouchDhcp = uci.get('podkop', 'main', 'dont_touch_dhcp') === '1';
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error loading UCI config:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If dont_touch_dhcp is enabled, we don't check dns_configured
|
|
||||||
if (!dontTouchDhcp && !singboxStatus.dns_configured) {
|
|
||||||
return createStatus('not_working', 'DNS not configured', 'ERROR');
|
|
||||||
}
|
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT);
|
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT);
|
||||||
|
|
||||||
@@ -1193,20 +1172,6 @@ async function checkFakeIPCLI() {
|
|||||||
return createStatus('not_working', 'sing-box not running', 'ERROR');
|
return createStatus('not_working', 'sing-box not running', 'ERROR');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load UCI config to check dont_touch_dhcp
|
|
||||||
let dontTouchDhcp = false;
|
|
||||||
try {
|
|
||||||
const data = await uci.load('podkop');
|
|
||||||
dontTouchDhcp = uci.get('podkop', 'main', 'dont_touch_dhcp') === '1';
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error loading UCI config:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If dont_touch_dhcp is enabled, we don't check dns_configured
|
|
||||||
if (!dontTouchDhcp && !singboxStatus.dns_configured) {
|
|
||||||
return createStatus('not_working', 'DNS not configured', 'ERROR');
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await safeExec('nslookup', ['-timeout=2', 'fakeip.podkop.fyi', '127.0.0.42']);
|
const result = await safeExec('nslookup', ['-timeout=2', 'fakeip.podkop.fyi', '127.0.0.42']);
|
||||||
|
|
||||||
if (result.stdout && result.stdout.includes('198.18')) {
|
if (result.stdout && result.stdout.includes('198.18')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user