Profile
Back to NewsBack
GitHub Trending 4 min
Reader Mode
soypat/lneto: Low-level networking. HTTP/TCP/IP/Ethernet/RMII/MDIO/UDP/NTP/DHCP/DNS blabla. Runs on a couple kB of RAM

soypat/lneto: Low-level networking. HTTP/TCP/IP/Ethernet/RMII/MDIO/UDP/NTP/DHCP/DNS blabla. Runs on a couple kB of RAM

7 hours ago

lneto

go.dev reference</a> codecov</a> Go</a> sourcegraph</a>

Low-level networking operations.

lneto is pronounced "L-net-oh", a.k.a. "El Neto"; a.k.a. "Don Networkio"; a.k.a "Neto, connector of worlds".

Features

lneto provides the following features:
  • Zero Operating System required. Zero. All protocols (including TCP, excepting NTP) are time-independent.
- Explicit HAL needed. Lneto performs no time.Sleep nor time.Now calls unless configured by user. - Zero scheduling required. No goroutines/channels use in Lneto. Can be run in event loop.
  • Heapless packet processing
-
httpraw is likely the most performant HTTP/1.1 processing package in the Go ecosystem. Based on fasthttp but simpler and more thoughtful memory use. - httφ - Heapless HTTP router and zero-copy response writing with Go's standard library API.
  • Lean memory footprint
- HTTP header struct is 80 bytes with no runtime usage nor heap usage other than buffer - Entire Ethernet+IPv4+UDP+DHCP+DNS+NTP stack in ~2kB RAM.
  • Empty go.mod file. No dependencies except for basic standard library packages such as bytes, errors, io.
- net only imported for net.ErrClosed. - Can produce very small binaries. Ideal for embedded systems.
  • Extremely simple networking stack construction. Can be used to teach basics of networking
- Only one networking interface fulfilled by all implementations. See abstractions.
  • Stack can be fuzz tested efficiently, see benchmarks below:
- go test ./x/xnet/ -run FuzzStackAsyncHTTP -fuzz=. fuzzes Ethernet/IP/TCP/HTTP stack with 170k HTTP exchanges per second on 12 core machine: fuzz: elapsed: 4m9s, execs: 42649941 (169428/sec), new interesting: 5 (total: 52)
  • TLS: Heapless and memory constrained for use on microcontrollers. Not externally audited, use only if you understand the risks!

Docs and reference

Examples, API reference, protocol support matrix, benchmarks can be found in docs

Users

lneto is currently being used primarily by embedded developers and those who need a lighter alternative to gVisor in terms of memory usage and binary size.

Lneto in the media

Packages

  • lneto: Low-level Networking Operations, or "El Neto", the networking package. Zero copy network frame marshalling and unmarshalling.
- lneto/validation.go: Packet validation utilities
  • lneto/internet: Userspace IP/TCP networking stack. This is where the magic happens. Integrates many of the listed packages.
- lneto/internet/pcap: Packet capture and field breakdown utilities. Wireshark in the making.
  • lneto/http/httpraw: Heapless HTTP header processing and validation. Does no implement header normalization.
  • lneto/tcp: TCP implementation and low level logic.
  • lneto/ipv4/linklocal4: RFC 3927 IPv4 link-local (APIPA) address autoconfiguration. Heapless claim-and-defend state machine for self-assigned 169.254.x.x addresses when no DHCP server is available.
  • lneto/dhcpv4: DHCP version 4 protocol implementation and low level logic.
  • lneto/dns: DNS protocol implementation and low level logic.
  • lneto/ntp: NTP implementation and low level logic. Includes NTP time primitives manipulation and conversion to Go native types.
  • lneto/internal: Lightweight and flexible ring buffer implementation and debugging primitives.
  • lneto/x: Experimental packages.
- lneto/x/xnet: net package like abstractions of stack implementations for ease of reuse. Still in testing phase and likely subject to breaking API change. - lneto/x/nts: Network Time Security (RFC 8915). NTS-KE key exchange over TLS 1.3 and AEAD-authenticated NTP client/server. Ships no cryptography itself; the caller supplies the mandated AEAD_AES_SIV_CMAC_256 cipher.AEAD implementation.

LLM Policy / AI Policy

LLMs are a tool. As such they should be used carefully. The policy for this project is covered in Oxide's RFD576.

Examples of LLM contribution in lneto:

  • https://github.com/soypat/lneto/pull/19 and https://github.com/soypat/lneto/pull/18: Egon told me he was using an LLM to find bugs in lneto before submitting these PRs.
  • https://github.com/soypat/lneto/commit/6b06cb1237071a0c22f86821db5aaa6135996e98: Writing tests to capture functionality in lneto that has been tested and works.
  • https://github.com/soypat/lneto/commit/7042a653a6e46999314c2e36dd5c868bcbc68908: adding mutex locking on tcp.Conn

Chat with me