pion / .goassets

Asset files automatically deployed to Go package repositories
https://pion.ly/
MIT License
9 stars 10 forks source link

Enable tests for WASM once WASM supports it #5

Open at-wat opened 4 years ago

at-wat commented 4 years ago

WASM is still in Minimum Viable Product stage. IP socket is not yet supported and net_fake.go is used in Go1.13. A lot of the tests using net.Conn fail to be built, deadlock, or cause below runtime error in net_fake.go.

panic: interface conversion: net.sockaddr is *net.UDPAddr, not *net.TCPAddr

Now, some tests in dtls, ice, sctp, transport, turn, and webrtc packages are disabled. Once WASM and Go support UDP connection, we can enable them.

ref: https://github.com/pion/.goassets/pull/4#issuecomment-573394065

ondrejtomcik commented 3 years ago

@at-wat AFAIK WASM will never support direct access to TCP/UDP socket as it's still running in the sandbox of the browser. At least that's my understanding. Am I wrong? I am asking because I am using pion/DTLS, would like to use it in a web assembly, but I think this won't be ever supported. What do you think?

Thanks

at-wat commented 3 years ago

@ondrejtomcik There is an open discussion about it: https://github.com/WebAssembly/design/issues/1251 and at least not denied.

BTW, the issue title should be

-Enable tests for WASM once Go supports it
+Enable tests for WASM once WASM supports it
ondrejtomcik commented 3 years ago

I think it was answered, not sure why it's not closed.

This is not a limitation in WebAssembly, it is a limitation in the web browser itself: the browser only allows you to use HTTP(S), WebSockets, or WebRTC. It has no support for raw sockets (UDP or TCP).

Sean-Der commented 3 years ago

Hey @ondrejtomcik

It may be possible to use pion/dtls in WASM! It just expects a net.Conn. You can make out this interface and have output just be buffers in/out.

If the library hardcodes UDP internally I would love to change that.

ondrejtomcik commented 3 years ago

@Sean-Der AFAIK it will be at the end translated only to websockets, so the other side will have to use websockets for communication.

Sean-Der commented 3 years ago

Would you mind starting a demo repo and we could iterate there? So the goal is to create a WebSocket, but then have a DTLS connection over it?

I think we can make that happen!

ondrejtomcik commented 3 years ago

Sorry @Sean-Der, this is not what I am interested in. I hoped for being able to use native UDP in WASM but this doesn't seem to be possible.

stv0g commented 1 year ago

If I am not mistaken, WASM tests have been added in the meanwhile:

https://github.com/pion/.goassets/blob/master/.github/workflows/test-wasm.reusable.yml

@at-wat Can you confirm, so this issue can be closed?

at-wat commented 1 year ago

My original thoughts was to remove //go:build !js in all tests. It will be possible once WASI Sockets proposal is implemented and Go WASM supports WASI syscall.

stv0g commented 1 year ago

Cool :) But I think there is no more to do within the goassets repo to realize this?

The GitHub actions workflow is already setup?