(ip)
| 4805 | function runPing() { return _ndRunText('ping-target', 'ping-results', '/api/net/ping', 'Pinging', 'runPing'); } |
| 4806 | function runTraceroute() { return _ndRunText('trace-target', 'trace-results', '/api/net/traceroute', 'Tracing', 'runTraceroute'); } |
| 4807 | function runWhois() { return _ndRunText('whois-target', 'whois-results', '/api/net/whois', 'Looking up', 'runWhois'); } |
| 4808 | |
| 4809 | // Fill the MTR start-point dropdown with this host's local IPv4 addresses. |
| 4810 | async function populateMtrSources() { |
| 4811 | const sel = document.getElementById('mtr-source'); |
| 4812 | if (!sel || sel.dataset._loaded) return; |
| 4813 | try { |
| 4814 | const data = await fetchAPI('/api/net/interfaces'); |
| 4815 | if (!data || !data.success) return; |
| 4816 | const seen = new Set(); |
| 4817 | (data.interfaces || []).forEach(i => { |
| 4818 | (i.ipv4 || []).forEach(cidr => { |
| 4819 | const ip = String(cidr).split('/')[0]; |
| 4820 | if (!ip || seen.has(ip)) return; |
| 4821 | seen.add(ip); |
| 4822 | const opt = document.createElement('option'); |
| 4823 | opt.value = ip; |
| 4824 | opt.textContent = i.name + ' — ' + ip; |
| 4825 | sel.appendChild(opt); |
| 4826 | }); |
| 4827 | }); |
| 4828 | sel.dataset._loaded = '1'; |
| 4829 | } catch (e) { /* leave just the auto option */ } |
nothing calls this directly
no test coverage detected