dispatchrun / wasi-go

A Go implementation of the WebAssembly System Interface (WASI)
Apache License 2.0
124 stars 7 forks source link

export socket pairs when accepting/connecting #37

Closed achille-roussel closed 1 year ago

achille-roussel commented 1 year ago

This change makes it possible to know the pair of local and remote addresses when accepting connections from a pre-open file descriptor, in cases where SockLocalAddress was never called by the guest application. It also results in having all the information needed to construct a net.Conn without having to make an extra call.

I also added a second commit to rename SockPeerAddress to SockRemoteAddress, the correspondence between Local/Remote is more coherent than Local/Peer, which I think we had derived from the WasmEdge ABI. It also reuses the naming of Go's net package, making API more familiar to developers.