refactor(ping): remove srcAddress parameter from ping functions to simplify configuration
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m39s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m39s
This commit is contained in:
@@ -281,7 +281,6 @@ async function applyMikrotikConfig(req, res) {
|
||||
* - serverId: ID/имя сервера из servers.json (обязательно)
|
||||
* - gatewayIp?: IP шлюза (remote IP туннеля или прямой gateway)
|
||||
* - interfaceName?: имя интерфейса RouterOS (если знаем его заранее)
|
||||
* - srcAddress?: исходный IP (например, local IP туннеля)
|
||||
* - target?: адрес для ping (по умолчанию www.gstatic.com)
|
||||
* - count?: количество пакетов (по умолчанию 5)
|
||||
*/
|
||||
@@ -291,7 +290,6 @@ async function pingViaInterface(req, res) {
|
||||
serverId,
|
||||
gatewayIp,
|
||||
interfaceName,
|
||||
srcAddress,
|
||||
target = 'www.gstatic.com',
|
||||
count = 5,
|
||||
} = req.body || {};
|
||||
@@ -315,9 +313,8 @@ async function pingViaInterface(req, res) {
|
||||
|
||||
// Пытаемся найти интерфейс по gatewayIp и serverId, если interfaceName не передан
|
||||
let ifaceName = interfaceName || null;
|
||||
let srcAddr = srcAddress || null;
|
||||
|
||||
if (!ifaceName && !srcAddr && gatewayIp) {
|
||||
if (!ifaceName && gatewayIp) {
|
||||
const config = await loadNetworkConfig();
|
||||
const tunnelIfaces = Array.isArray(config.tunnelInterfaces) ? config.tunnelInterfaces : [];
|
||||
|
||||
@@ -332,7 +329,6 @@ async function pingViaInterface(req, res) {
|
||||
|
||||
if (iface) {
|
||||
ifaceName = iface.name || null;
|
||||
srcAddr = iface.localIp || srcAddr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +336,6 @@ async function pingViaInterface(req, res) {
|
||||
body.address = target;
|
||||
body.count = Number(count) > 0 ? Number(count) : 5;
|
||||
if (ifaceName) body.interface = ifaceName;
|
||||
if (srcAddr) body['src-address'] = srcAddr;
|
||||
|
||||
const pingRes = await client.command('tool/ping', body);
|
||||
const raw = pingRes?.data;
|
||||
|
||||
Reference in New Issue
Block a user