12 Commits

Author SHA1 Message Date
Scott Feldman c134160ae4 correct netdever Accept() prototype
According to man page accept(2), accept returns new client sockfd and
remote peer ip:port.  This patch corrects the Accept() prototype in the
netdever interface to not take in an ip:port arg, but rather return an
ip:port for remote peer.
2023-12-18 10:15:35 +01:00
Scott Feldman 4bc93e2fd8 stub out more types/funcs to compile against golang.org/x/net/internal/socket (#17)
* stub out more types/funcs to compile against golang.org/x/net/internal/socket

These are changes need to compile github.com/domainr/dnsr/ with TinyGo. See issue tinygo-org/net#14.

These change are mostly to fix missing symbols in src/net. Missing types and functions are cut-and-pasted from go1.21.4. Functions are stubbed out returning errors.New("not implemented").

DNRS is compiled by running tinygo test:

   sfeldma@nuc:~/work/dnsr$ tinygo test -target=wasi

With this patch, and a corresponding patch for tinygo/ to fixup crypto/tls, you should get a clean compile.
2023-12-17 15:29:45 +01:00
soypat 1c4a014aa7 add some docs to netdev interface 2023-12-08 14:21:22 +01:00
soypat 1c04b2c40d fix netdev.Addr docstring 2023-12-04 11:38:39 +01:00
soypat f3548296e1 refurbish internal netdever interface to use netip types instead of net.IP 2023-12-04 11:38:39 +01:00
Scott Feldman 8612dcd77b netdev: improve documentation
Call out netdev as L3/L4 interface for TinyGo, to differentiate between
netlink which is stricly L2.
2023-07-07 20:00:29 +02:00
Scott Feldman 044dc8d374 netdev: move GetIPAddr() from netlink to netdev
Netlink is for L2; netdev is for L3/L4
2023-07-07 20:00:29 +02:00
Scott Feldman 6bb697535a Unexport net constants copied over from syscall 2023-07-07 20:00:29 +02:00
Scott Feldman 2d46776c18 move syscall constants for networking into net space to avoid windows build issue 2023-07-07 20:00:29 +02:00
Scott Feldman 7898c5e946 BUG Fix: return proper net.OpError's for Read/Write operations
Need to return the same error structure/content as regular Go for
net.Conn Read/Write operations.  Found/fixed when testing deadlines
on Read/Write operations.
2023-07-07 20:00:29 +02:00
Scott Feldman 331151cafe move IPPROTO_TLS to netdev to avoid src/syscall dependency 2023-07-07 20:00:29 +02:00
Scott Feldman 693edae782 Add network device driver model, netdev
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).
2023-07-07 20:00:29 +02:00