Commit Graph

367 Commits

Author SHA1 Message Date
Patricio Whittingslow ebfd80c80c ai insists with backoffs 2026-07-26 21:29:02 -03:00
Patricio Whittingslow 0b6a71efa8 add Exchange.ReadMultiparts reimagining of clanker slop 2026-07-26 20:19:46 -03:00
Patricio Whittingslow 0c1a51150d begin adding readMultiPart 2026-07-26 18:04:34 -03:00
Patricio Whittingslow 4f1a178f29 first Multipart approach 2026-07-26 17:22:09 -03:00
Patricio Whittingslow dd7c4bb037 remove status type 2026-07-26 13:57:18 -03:00
Patricio Whittingslow cc7ecc0c19 finish rounding up multipart form parsing 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 4976cdf38e begin adding multipart form logic 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 92cf46e570 add streaming API distinct from Exchange 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 6d88506541 add raw buffer access 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 229acd3e68 fail on incomplete staging 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 69640a6235 minor doc nit 2026-07-26 13:57:18 -03:00
Patricio Whittingslow b79e58b812 add MethodFrom 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 10932ebf34 rework Mux interface to receive a string request path 2026-07-26 13:57:18 -03:00
Patricio Whittingslow c19fd2093c run go fix 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 5937070cc5 Router.Handle returns error after being torn down 2026-07-26 13:57:18 -03:00
Patricio Whittingslow dab5095a49 massive documentation push and code reordering in files 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 9faa0c2722 remove ForEach pattern, allocates in TinyGo 2026-07-26 13:57:18 -03:00
Patricio Whittingslow d83da243a0 add query handling 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 99f848f93f add benchmarks 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 6e332e7833 small nit 2026-07-26 13:57:18 -03:00
Patricio Whittingslow a7f598f975 several bugfixes, add internal.IntLen, round up http-linux example with new router API 2026-07-26 13:57:18 -03:00
Patricio Whittingslow d4666630f7 improve locking and acquisition of Exchanges in reconfiguring 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 962f6864be add Hijacker-like functionality 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 5b83b18da0 more tests, run go generate 2026-07-26 13:57:18 -03:00
Patricio Whittingslow e0dd19416c add low level Handle function and more tests 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 9397caf144 claude found neat bugs 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 0fd0ad8cbf begin adding httphi tests 2026-07-26 13:57:18 -03:00
Patricio Whittingslow 6e7cd94040 add http/httphi 2026-07-26 13:57:18 -03:00
Pat Whittingslow a3f2742abf DHCPv4+Debug (#170)
* DHCPv4+Debug: add RawData method and improve Logging semantics with configured logger instead of default

* add xnet.LogAllocs
2026-07-26 13:55:48 -03:00
Marvin 马维 Drees 8873b55e5d feat(tcp): add RFC 6298 RTO as a LossRecovery implementation (#169)
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>
2026-07-22 13:44:31 -03:00
Pat Whittingslow 41c7e3c445 add loss.go (#168) 2026-07-22 13:09:12 -03:00
Pat Whittingslow 1bbfd5eac3 @MDr164 trick to ignore no-extension files (#162)
* @MDr164 trick to ignore no-extension files

* catch changes to LICENSE
2026-07-21 16:14:53 -03:00
Pat Whittingslow 1a474154cb more httpraw bug fixes (#160)
* more httpraw bug fixes

* add http-linux example and add httpraw.Header.SetInt

* finish http-linux example

* fix CI vet
2026-07-19 11:09:09 -03:00
Patricio Whittingslow 347cef9ba5 README: update binary benchmark table v0.2.1 2026-07-17 12:03:28 -03:00
Pat Whittingslow 157a8537a2 testing.B.Loop() standardization and StackAsync.Debug improvement (#156)
* testing.B.Loop() standardization and StackAsync.Debug heap debugging improvement

* apply @MDr164 fixes

* @MDr164 great suggestions to prevent panic and print correct mallocs
2026-07-17 11:59:27 -03:00
Pat Whittingslow 766e03e90e httpraw: fix overrwrite/empty val bugs in Header.Set/SetBytes (#159) 2026-07-17 11:07:59 -03:00
Marvin Drees ab1a0c735a Add out-of-order segment reassembly (#148)
* 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>
2026-07-10 10:36:15 -03:00
Marvin Drees 3c1f0e0281 Handle IA_NA/IA_PD requests and config options in DHCPv6 (#147)
* 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>
2026-07-09 14:12:30 -03:00
Pat Whittingslow 99e9d90a60 Netdev revamp (#145)
* 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
2026-07-09 14:04:10 -03:00
Marvin Drees 4fc53a84cd fix: make github action comment work right (#153)
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>
2026-07-09 14:01:53 -03:00
Marvin Drees 104a2b0b26 feat(ci): add benchci for better visualization (#149)
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>
2026-07-02 20:21:49 -03:00
Patricio Whittingslow e5f8ac0687 add as of now unused af_inet6 for posterity 2026-07-01 21:09:28 -03:00
Patricio Whittingslow 3b5b010673 export xnet: AF_INET, SOCK_STREAM, SOCK_DGRAM 2026-07-01 21:07:21 -03:00
Pat Whittingslow 4d6363da00 bound MTU on Stack EgressIP (#151) 2026-07-01 18:46:24 -03:00
Pat Whittingslow cdc99fb9ff work on removing heap allocations (#150) 2026-07-01 13:26:05 -03:00
Pat Whittingslow 96a02e7d2c begin writing noipv6 test (#146) 2026-06-28 10:26:49 -03:00
Pat Whittingslow b795d6a437 use ltesto as package to contain scheduler/goroutine testing logic (#143)
* use ltesto as package to contain scheduler/goroutine testing logic

* add sched usage to another test

* testCloseTransmitsPending rewrite

* replace deadline with context
2026-06-27 10:37:46 -03:00
Ron Evans fa609ea54f fix: two fixes for dhcp/ap (#136)
* 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>
v0.2.0
2026-06-24 22:16:53 -03:00
Pat Whittingslow a42f0b404c feature: ipv4 broadcast support and bugfix for reset connection reset of IPv4+IPv6 stacks (#139)
* feature: ipv4 broadcast support

* stackip4 method receiver varname
2026-06-24 16:54:41 -03:00
Pat Whittingslow ef279863a9 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
2026-06-24 13:07:19 -03:00