* net: add UDP listen, resolver, DNSError, and TCP listener APIs for wasm
TinyGo's net package was missing several symbols that upstream Go's
js/wasm net declares, blocking builds that pull pion/transport, pion/dtls,
and similar (via netbird's WASM client). Add them, backed by the existing
netdev abstraction so they compile for all targets and no-op cleanly under
nopNetdev (matching Go's js runtime behavior):
- DNSError type (dnserror.go), copied from Go 1.26.2.
- Resolver + DefaultResolver with LookupHost/LookupIP/LookupIPAddr/
LookupNetIP/LookupPort; LookupHost/LookupIP package funcs; Dialer.Resolver
field for API compatibility.
- UDPConn: ListenUDP, ReadFromUDP(AddrPort), WriteToUDP(AddrPort),
SetReadBuffer, SetWriteBuffer.
- TCPConn: CloseRead, SetNoDelay, SetReadBuffer, SetWriteBuffer,
ReadFrom(io.Reader).
- TCPListener: ListenTCP, AcceptTCP, SetDeadline; ListenPacket package func.
- Interface: Addrs, MulticastAddrs stubs.
* more complete PR for adding more net support (#64)
* format unixsock
The js/wasm RoundTrip fallback called t.roundTrip(req), an upstream
Go private method that was never backported to TinyGo's Transport stub.
Replace the call with an explicit error return, since the empty
Transport has no dial capability and cannot perform a fallback
round-trip.
Fixes#52
Signed-off-by: deadprogram <ron@hybridgroup.com>
This change introduces a CheckRedirect field to the http.Client struct in TinyGo,
mirroring the behavior of Go's standard library http.Client.
The purpose of this addition is to resolve build errors in projects that rely
on packages (such as golang.org/x/oauth2) expecting the Client to have a
CheckRedirect field. The field provides no functional change within TinyGo’s
HTTP client at this time — it is only included for API compatibility and
compilation success. There is no effect on runtime behavior unless explicitly
used by downstream code.
This PR adds a network device driver model called netdev. There will be a companion PR for TinyGo drivers to update the netdev drivers and network examples. This PR covers the core "net" package.
An RFC for the work is here: #tinygo-org/drivers#487. Some things have changed from the RFC, but nothing major.
The "net" package is a partial port of Go's "net" package, version 1.19.3. The src/net/README file has details on what is modified from Go's "net" package.
Most "net" features are working as they would in normal Go. TCP/UDP/TLS protocol support is there. As well as HTTP client and server support. Standard Go network packages such as golang.org/x/net/websockets and Paho MQTT client work as-is. Other packages are likely to work as-is.
Testing results are here (https://docs.google.com/spreadsheets/d/e/2PACX-1vT0cCjBvwXf9HJf6aJV2Sw198F2ief02gmbMV0sQocKT4y4RpfKv3dh6Jyew8lQW64FouZ8GwA2yjxI/pubhtml?gid=1013173032&single=true).