lmnet guide

Overview

lmnet consolidates classic Linux networking utilities and structured kernel introspection into one statically-linked executable with zero external runtime dependencies. It embeds the upstream iputils ping and tracepath tools, the iperf 3.22 throughput engine, direct rtnetlink and /proc/net parsers, a custom RFC 1035 DNS resolver, a parallel TCP connect scanner, a streaming TCP stdio bridge, and the lmcode-cpp bytecode virtual machine with the 226-signature lmcode_std_v3 standard library.

Kernel introspection: rtnetlink and procfs

Rather than shelling out to iproute2 or net-tools binaries that may be absent in minimal containers, lmnet talks directly to the Linux kernel and formats results as deterministic JSON or typed DSL objects:

Active probing: DNS, traceroute, port scanning, and TCP pipes

For active network diagnostics and testing, lmnet includes four purpose-built engines alongside its vendored iputils and iperf3 subcommands:

Standard lmcode_std_v3 REST and CLI interfaces

lmnet embeds the full 226-signature lmcode_std_v3 catalog (cpp/stdlib/rest.hpp). Any _lmcode_ script can expose Linux network diagnostics as HTTP routes or stateless CLI commands:

p = _lmcode_ cli="lmnet" install="github:lmctl-ai/lmnet@latest";
@"--proto"
fn opt_proto(x: RestExchange) -> void implements CliOption {
  x.set("proto", x.query("proto"));
}

@"socket-count"
fn cmd_sockets(x: RestExchange) -> void implements CliCommand {
  let proto = x.get("proto");
  let sum = net.socket_summary(proto);
  x.send(proto + ":listening=" + str(sum.listening()));
}

@"/probe/:host/:port"
fn get_probe(x: RestExchange) -> void implements RestGet {
  let ok = net.check(x.param("host"), int(x.param("port")));
  x.json("{\"host\":\"" + x.param("host") + "\",\"open\":" + str(ok) + "}");
}

rest_config("session", "global");
assert_eq(rest_cli(str_split("--proto=tcp socket-count", " ")), "tcp:listening=" + str(net.socket_summary("tcp").listening()));
end _lmcode_