dispatchrun / net

Go package implementing WASI socket extensions
Apache License 2.0
137 stars 7 forks source link

wasip1: add wasip1.ListenPacket and implementation of net.PacketConn #15

Closed achille-roussel closed 1 year ago

achille-roussel commented 1 year ago

This PR adds wasip1.ListenPacket which is the equivalent of net.ListenPacket, and an implementation of net.PacketConn using the sock_send_to and sock_recv_from host functions of wasmedge.

The tests validate the behavior of IP and Unix Datagram sockets, and addresses a couple of bugs that I hit along the way.

This will be useful to support https://go-review.googlesource.com/c/go/+/500579/13; I also intend to add an example showcasing end-to-end DNS with net.Resolver and https://github.com/miekg/dns.