lmnet

lmnet is a statically-linked Linux network diagnostics CLI and LMScript host combining iputils ping and tracepath, iperf3, rtnetlink, procfs, DNS, and TCP scanning. It provides both direct JSON command-line introspection and strongly-typed _lmcode_ scripting via the net context and standard REST and CLI interfaces.

Quick reference

npm install -g @lmctl-ai/lmctl@latest
lmnet --version
lmnet --lmcode-schema
lmnet --lmcode-signatures
Interface or flagSignature or syntaxPurpose
CLI host bytecodelmnet [--dry-run] --lmcode prog.dslbExecute or dry-validate compiled LMScript bytecode against the embedded lmnet schema.
CLI schema and signatureslmnet --lmcode-schema [--json] | --lmcode-signaturesPrint human-readable schema summary, raw host schema JSON, or canonical signatures.
CLI ping, tracepath, iperf3lmnet ping HOST | lmnet tracepath HOST | lmnet iperf3 [opts]Run the embedded upstream iputils ping, iputils tracepath, or iperf 3.22 throughput engines.
CLI DNS and route querieslmnet dns HOST | lmnet dig NAME [TYPE] [@srv] | lmnet ifaddrs|link|route|rule|neighEmit structured JSON for DNS resolution, RFC 1035 queries, interfaces, 64-bit link stats, routes, rules, and ARP/NDP neighbors.
CLI sockets and counterslmnet sockets [tcp|udp|unix] [--listen] [--summary] | lmnet countersDump /proc/net socket tables with process attribution, ss-style summaries, or flat kernel protocol counters as JSON.
CLI trace, scan, and pipelmnet trace HOST [ttl] | lmnet scan HOST [--ports SPEC] | lmnet pipe HOST PORTRun UDP/ICMP traceroute, parallel TCP connect port scans, or binary-safe TCP stdio streaming bridges.
context net: Net (kernel)net.interfaces() | net.links() | net.routes() | net.rules() | net.neighbors()Inspect Linux interfaces, rtnetlink link statistics, routing tables, policy rules, and ARP/NDP neighbors in LMScript.
Net (DNS, sockets, TCP)net.dns_lookup() | net.dns_query() | net.sockets() | net.scan() | net.tcp_connect()Query DNS resolvers, inspect socket tables and protocol counters, scan TCP ports, or exchange raw TCP stream bytes.
Standard REST and CLIRestGet..RestOptions, RestHandler, CliCommand, CliOptionExpose _lmcode_ functions as HTTP routes (:param) or stateless CLI flags and subcommands via rest_serve and rest_cli.
p = _lmcode_ cli="lmnet" install="github:lmctl-ai/lmnet@latest";
let links = net.links();
assert(links.len() > 0);
let addrs = net.dns_lookup("localhost");
assert(addrs.len() > 0);

@"--dev"
fn opt_dev(x: RestExchange) -> void implements CliOption {
  x.set("dev", x.query("dev"));
}

@"link-check"
fn cmd_link(x: RestExchange) -> void implements CliCommand {
  let target = x.get("dev");
  for (i in range(0, links.len())) {
    if (links.at(i).name() == target) {
      x.send(target + ":up=" + str(links.at(i).up()));
    }
  }
}

rest_config("session", "global");
assert_eq(rest_cli(str_split("--dev=lo link-check", " ")), "lo:up=true");
end _lmcode_
res = run_lmcode(p);
require(res.ok, json_stringify(res));

Documentation pages

Source repository and releases