feat(MikrotikTools): enhance traceroute output with reverse DNS support and improved IP handling
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 2m28s

This commit is contained in:
2026-02-12 16:14:06 +07:00
parent 1e28fa33f5
commit 635b791118
2 changed files with 33 additions and 18 deletions
+20 -16
View File
@@ -270,15 +270,17 @@ function MikrotikTools() {
</tr>
</thead>
<tbody>
{hops.map((h) => (
<tr key={h.hop || `${h.host}-${Math.random()}`}>
{hops.map((h) => {
const ip = h.ip || '';
const dns = h.dns || '';
const mainLabel = dns
? `${dns}${ip ? ` (${ip})` : ''}`
: (ip || h.host || '—');
return (
<tr key={h.hop || `${ip || h.host}-${Math.random()}`}>
<td>{h.hop}</td>
<td>
{h.host || '—'}
{h._label && (
<div className="text-muted small">{h._label}</div>
)}
</td>
<td>{mainLabel}</td>
<td>{h.avgMs != null ? h.avgMs.toFixed(1) : '—'}</td>
<td>
{h.bestMs != null ? h.bestMs.toFixed(1) : '—'} /{' '}
@@ -287,7 +289,7 @@ function MikrotikTools() {
<td>{h.loss != null ? `${h.loss}%` : '—'}</td>
<td>{h.status || '—'}</td>
</tr>
))}
);})}
</tbody>
</table>
</div>
@@ -344,11 +346,13 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
let worstLatencyHop = null;
hops.forEach((hop, index) => {
const host = hop.host || hop.address || '';
const ip = hop.ip || hop.host || hop.address || '';
const dns = hop.dns || null;
const hostDisplay = dns ? `${dns}${ip ? ` (${ip})` : ''}` : (ip || hop.host || '');
const avg = hop.avgMs;
const loss = hop.loss;
let descr = `Хоп ${hop.hop || index + 1}: ${host || 'неизвестный узел'}`;
let descr = `Хоп ${hop.hop || index + 1}: ${hostDisplay || 'неизвестный узел'}`;
const details = [];
if (avg != null) details.push(`среднее время ≈ ${avg.toFixed(1)} мс`);
@@ -357,15 +361,15 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
}
if (loss != null) details.push(`потеря пакетов ${loss}%`);
// Привязка к gateway
const gw = gateways.find((g) => g.ip && g.ip === host);
// Привязка к gateway (по IP)
const gw = gateways.find((g) => g.ip && g.ip === ip);
if (gw) {
const srvLabel = findServerLabel(gw.serverId);
details.push(`gateway "${gw.description || gw.ip}" на сервере ${srvLabel || gw.serverId}`);
}
// Привязка к туннельному интерфейсу
const iface = ifaces.find((i) => i.localIp === host || i.remoteIp === host);
// Привязка к туннельному интерфейсу (по IP)
const iface = ifaces.find((i) => i.localIp === ip || i.remoteIp === ip);
if (iface) {
const s1 = findServerLabel(iface.serverId);
const s2 = findServerLabel(iface.serverId2);
@@ -407,7 +411,7 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
if (firstTimeoutHop) {
lines.push(
`Начиная с хопа ${firstTimeoutHop.hop} (${firstTimeoutHop.host || 'неизвестный узел'}) наблюдаются таймауты — цель может быть недоступна или где-то по пути фильтруется ICMP.`
`Начиная с хопа ${firstTimeoutHop.hop} (${firstTimeoutHop.dns ? `${firstTimeoutHop.dns}${firstTimeoutHop.ip ? ` (${firstTimeoutHop.ip})` : ''}` : (firstTimeoutHop.ip || firstTimeoutHop.host || 'неизвестный узел')}) наблюдаются таймауты — цель может быть недоступна или где-то по пути фильтруется ICMP.`
);
} else {
lines.push('Таймаутов или явной потери пакетов по пути не обнаружено (по данным MikroTik).');