Public Access
Shell: ping, nslookup, port, traceroute, ifconfig and arp (#90)
Network troubleshooting from the device itself, in the Shell and over both consoles. ping, nslookup, port and traceroute each run on a task of their own and print as they go, to the console that asked; one at a time, and `cancel` stops it. ifconfig and arp answer at once: the interfaces (Wi-Fi and the VPN), which is the default route, the DNS servers, the neighbours. nslookup asks a DNS server itself, so it can say which server answered and in how long, and ask another. A sized ping finds what a tunnel really carries. With a how-to, "When the network doesn't work", and the rest of the docs. tls, ntp and netstat from the issue's list are not in this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
|
||||
#include "platform/console.h"
|
||||
|
||||
namespace roro {
|
||||
|
||||
// The network troubleshooting commands (issue #90): ping, nslookup, port, traceroute, ifconfig,
|
||||
// arp. The first four take time, so each runs on a task of its own and prints its lines as they
|
||||
// come, to the console that asked; one at a time, and `cancel` stops it. The other two answer at
|
||||
// once. The packets and their meaning are lib/net/src/net_probe.h, which is host-tested.
|
||||
class NetTools {
|
||||
public:
|
||||
// True if `line` was one of its commands (answered, started, or refused with a reason).
|
||||
bool command(const std::string& line);
|
||||
bool busy() const { return busy_; }
|
||||
void cancel() { stop_ = true; }
|
||||
|
||||
private:
|
||||
struct Job;
|
||||
void start(Job* job);
|
||||
static void task(void* arg);
|
||||
|
||||
std::atomic<bool> busy_{false}, stop_{false};
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user