* httphi: RouterConfig refactor to enable DefaultRouterConfig
* RequestHeader not case sensitive anymore
* httphi: use DefaultRouterConfig in examples
* httphi: remove gated stage complexity
Misusing Stage methods by calling them once header has been written is totally harmless as far as I can tell. We simplify the codebase on this occasion by removing the headerWritten check for all stage methods
* httphi: improve APIs
* httphi: remove status
* add Exchange.WriteBodyString
* Mux.MaxPathValues and other improvements
* Mux PathValue improvemnt and fixes
* MuxSlice more method muxing improvements
* diagram out interesting approach to form parsing for clanker
* refactor RequestParseForm and achieve greatness in API design
* explicit naming of headerCapacityKV value in kvBuffer.Reset
* fix Mux bug not matching paths correctly; httpraw HTTP V1 naming applied
* rename many examples,use httphi in examples,remove useless maxAwaitingConn field
* add ipv4.String
* add ipv4 UnspecifiedAddr and BroadcastAddr
* add ethernet.String
* add http/httphi
* begin adding httphi tests
* claude found neat bugs
* add low level Handle function and more tests
* more tests, run go generate
* add Hijacker-like functionality
* improve locking and acquisition of Exchanges in reconfiguring
* several bugfixes, add internal.IntLen, round up http-linux example with new router API
* small nit
* add benchmarks
* add query handling
* remove ForEach pattern, allocates in TinyGo
* massive documentation push and code reordering in files
* Router.Handle returns error after being torn down
* run go fix
* rework Mux interface to receive a string request path
* add MethodFrom
* minor doc nit
* fail on incomplete staging
* add raw buffer access
* add streaming API distinct from Exchange
* begin adding multipart form logic
* finish rounding up multipart form parsing
* remove status type
* first Multipart approach
* begin adding readMultiPart
* add Exchange.ReadMultiparts reimagining of clanker slop
* ai insists with backoffs
* simplify clanker slop
* apply go fix
* add a pattern argument to Mux
* explicit header key/value alloc and add ExchangeConfig
* fix tests after excplicit header alloc change
* fix examples
* run go fix
* expose rawsock as experimental package (will use for external benchmarks)
* remove backoff from form parsing
* @MDr164 suggestions get potential fixes
* apply go fix
* add examples
* add README.md
* fix rawsock tinygo implementation
* apply @MDr164 various fixes
* update documentation on ContentLength methods and fix bug in Form reset on empty body
* fix tests
* add fuzz tests
* run go fix
* io.ErrNoProgress on parsing form spin
* run go fix
* remove backoff assumption from Router
* httphi.Handle rejects unsupported protocols
* go format router.go
* add kvbuffer
* rewrite Cookie with KVBuffer
* mid refactor of KVBuffer into Header
* work on KVBuffer exhausted semantics
* add Go's ServeMux Request.PathValue access semantics to Exchange, Mux and MuxSlice
* add PathValue example
* document all the things; improve req Query semantics; add Form.EnableBufferGrowth
* unexport kvBuffer
* add Exchange.PathValueAppend
* use stdlib in example instead of rawsock
* remove rawsock from http example
* add darwin arch rawsock
* fix example
* rename Router.TeardownGoroutines to Shutdown matching http.Server.Shutdown
* rename types and identifiers
* @MDr164 Content-Type and Transfer-Encoding bug catches
Provide a concrete packet-loss recovery algorithm for the LossRecovery
interface added in #168: the RFC 6298 round-trip-time estimator and single
retransmission timer.
RTO is a pure, reactive state machine. It derives RTT estimates and
retransmission decisions solely from the segments observed through the
LossRecovery hooks and the monotonic time handed in at each boundary, so it
holds no clock and allocates nothing (issue #140). It tracks a shadow of the
send sequence space (snd.UNA/snd.NXT) purely from observed segments, which is
how it manages the timer without reaching into the ControlBlock and how it
distinguishes retransmissions for Karn's algorithm.
Covered:
- §2.2/§2.3 SRTT/RTTVAR/RTO smoothing (integer-shift form)
- §3 Karn's algorithm: one sample in flight, never sample a retransmit
- §5.1-§5.3 timer arm/restart/stop as data is sent and acknowledged
- §5.4-§5.6 timeout response: exponential backoff + go-back-N retransmit
- §5.7 backoff collapse on a valid RTT sample
- RTO clamped to [rtoMin, rtoMax]
RTT introspection (SmoothedRTT, CurrentRTO, Running) lives on the concrete type,
not the interface, per the LossRecovery design. Install with new(RTO) on
ConnConfig.LossRecovery; the connection calls Reset on open so the zero value is
ready to use.
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* feat(tcp): add out-of-order segment reassembly
Add an opt-in, bounded out-of-order reassembly buffer so a single lost
segment can be recovered by retransmitting the gap while later segments
are held and delivered once the gap fills.
The receiver also subtracts buffered out-of-order bytes from the
advertised receive window and avoids challenge-ACK aborts for in-window
future data. Reassembly is disabled by default.
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* implement review feedback around rx buffer reuse
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
---------
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* feat(dhcpv6): handle IA_NA/IA_PD requests and config options
Adds the DHCPv6 client request exchange with IA_NA/IA_PD handling,
reconfigure-renew (RFC 8415), DNS server and domain search options
(RFC 3646) and NTP server suboptions (RFC 5908).
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* fix(dhcpv6): bound server-supplied option counts to prevent OOM
A DHCPv6 server may place arbitrarily many DNS servers, search domains,
NTP entries and delegated prefixes in a single message (RFC 8415). The
client appended every entry into growable slices with no upper bound, so
a malicious or misconfigured server could drive unbounded allocation.
Add a configurable Limits to RequestConfig (with safe defaults) capping
each repeated option. The backing arrays are sized to their caps once in
BeginRequest and reused across resets, so parsing a server message now
performs no allocation and stored entries stay bounded.
Add tests asserting the caps are enforced against a flooded Reply and that
option parsing is allocation-free after BeginRequest.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
---------
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* begin working on netdev solution
* need to roll back some assumptions in next commit
* dual poll/async mode for netdev.Runner
* add wake on rx semantics
* remove TODO
* more reworking of Runner
* work on applying @MDr164 suggestions and a couple extra revamps
* add newline to end of test file
It was previously just commenting the file name instead of the content,
this change attempts to fix it using json instead of the raw file
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
This adds a small in-repo tool and updates the ci.yml file in order
to make benchmark and most importantly allocation results visible in a
PR. It also drops the 3rdparty action we had commented out.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* use ltesto as package to contain scheduler/goroutine testing logic
* add sched usage to another test
* testCloseTransmitsPending rewrite
* replace deadline with context
* feature: ipv4 broadcast support
* stackip4 method receiver varname
* Incorporate strict test timing for TestStackGoTCPDialRetriesPendingControl (#135)
* rewrite tinygo failing test to be more real-time
* use channels to scheduler stack
* fix flakiness by increasing timeout and move implementation to top of file
* fix(dhcp): use chaddr as lookup key and patch Ethernet dst on Offer/Ack
- Client lookup in Demux() now keys on chaddr when no OptClientIdentifier
is present. It previously used ciaddr which is 0.0.0.0 during initial lease
acquisition, causing MsgRequest to fail to match any client (RFC 2131 §4.3.1)
- In Encapsulate(), overwrite Ethernet dst with client.hwaddr when packet is
embedded in an IP frame (offsetToIP >= 14), per RFC 2131 §4.1. It previously
sent to gwmac which clients without an ARP entry could not receive
Signed-off-by: deadprogram <ron@hybridgroup.com>
* fix: accept 255.255.255.255 aka bradcast dst in demux4
This fixes a problem with accept 255.255.255.255 dst in demux4 which previously dropped when stack had a static IP.
Signed-off-by: deadprogram <ron@hybridgroup.com>
---------
Signed-off-by: deadprogram <ron@hybridgroup.com>
Co-authored-by: Patricio Whittingslow <graded.sp@gmail.com>
* rewrite tinygo failing test to be more real-time
* use channels to scheduler stack
* fix flakiness by increasing timeout and move implementation to top of file
* feat: add xcurl port and debug flag
Update the docs and add new flags to xcurl to aid debugging under an OS
like Linux.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* drop debugtcp flag from xcurl again
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
---------
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* fix for #50
* fix remaining test
* revert changes and instead approach problem on full-duplex case
* fix merge messup
* fix @MDr164 note and upgrade documentation while at it
* gate full buffer exit on rx shutdown since no risk of full buffer error
* add log line to note issue is hit
* document CloseRead relationship with Close
* persist issue 57 fix in test
* have go fix output error on CI
* apply go fix required fix
* test no || for go fix command
* test no || for go fix command complete, it is needed
* forgot to fix
* good code today
* add netdev.Runner
* round off APIs more
* better interface method documentation
* improve DHCP netstack API
* add pico w netdev example
* remove temp file
* keep thinking about this. this is hard :/
* fix ci
* small fixer
* working dhcp
* fix rebase API mismatches
* begin adding espradio example
* keep working on espradio, icmp not working
* fix icmp by fixing dhcp
Implement NTS (RFC 8915) with KERecord zero-copy frame, PerformKE
(TLS 1.3 + ExportKeyingMaterial), DeriveKeys, and Client state
machine implementing lneto.StackNode. Client handles cookie pool
management, auth body codec with nonce/ciphertext, and two-exchange
NTP flow with UniqueID verification and AEAD authentication.
Add NTS Server wrapping ntp.Server with AEAD verification/sealing,
and HandleKE for server-side NTS Key Exchange over TLS 1.3.
Use internal.LogAttrs for non-allocating structured logging
throughout the NTS client, matching existing conventions.
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
- http/httpraw: cap header slice growth to pre-allocated capacity, fix
benchmark to reuse Header across iterations (0 allocs/op)
- internal/ring: replace TODO panic comments with invariant explanations
- tcp/conn: document truncated-frame offset check
- tcp/handler: replace TODO with net.ErrClosed on RST-closed connection
- internet/stack-udpport: filter incoming packets by remote IP address
when configured via SetStackNode; skip filter for IPv4 multicast
destinations (class D) so mDNS and similar protocols work correctly
Generated with LLM assistance.
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
* update README table and begin planning udp.PacketConn
* first attempt at packetconn implementation
* add udp.PacketConn to StackAsync and implement SocketNetip iface
* add tests for PacketConn