Files
lneto/x/rawsock/rawsock_other.go
T
Pat Whittingslow 5c54030f19 add http/httphi (#171)
* 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
2026-07-29 20:20:21 -03:00

50 lines
1.9 KiB
Go

//go:build tinygo || (!linux && !darwin)
package rawsock
import (
"errors"
"net"
"net/netip"
"time"
)
var (
_ net.Conn = (*Conn)(nil)
_ net.Listener = (*Listener)(nil)
)
// Addr is a socket address implementing [net.Addr].
type Addr netip.AddrPort
func (a Addr) Network() string { return "tcp" }
func (a Addr) String() string { return netip.AddrPort(a).String() }
func (a Addr) AddrPort() netip.AddrPort { return netip.AddrPort(a) }
// Conn is an accepted connection. Unsupported on this platform.
type Conn struct{}
func (c *Conn) Read(b []byte) (int, error) { return 0, errors.ErrUnsupported }
func (c *Conn) Write(b []byte) (int, error) { return 0, errors.ErrUnsupported }
func (c *Conn) Close() error { return errors.ErrUnsupported }
func (c *Conn) LocalAddr() net.Addr { return Addr{} }
func (c *Conn) RemoteAddr() net.Addr { return Addr{} }
func (c *Conn) SetDeadline(t time.Time) error { return errors.ErrUnsupported }
func (c *Conn) SetReadDeadline(t time.Time) error { return errors.ErrUnsupported }
func (c *Conn) SetWriteDeadline(t time.Time) error { return errors.ErrUnsupported }
func (c *Conn) SetReadTimeout(timeout time.Duration) error { return errors.ErrUnsupported }
func (c *Conn) SetWriteTimeout(timeout time.Duration) error { return errors.ErrUnsupported }
// Listener is a listening socket. Unsupported on this platform.
type Listener struct{}
// Listen is unsupported on this platform.
func (l *Listener) Listen(port uint16) error { return errors.ErrUnsupported }
func (l *Listener) Accept() (net.Conn, error) { return nil, errors.ErrUnsupported }
func (l *Listener) AcceptConn(conn *Conn) error { return errors.ErrUnsupported }
func (l *Listener) Addr() net.Addr { return Addr{} }
func (l *Listener) Port() uint16 { return 0 }
func (l *Listener) Close() error { return errors.ErrUnsupported }