brook icon indicating copy to clipboard operation
brook copied to clipboard

build brook wasm(WebAssembly) wssclient

Open likev opened this issue 2 years ago • 2 comments

Since brook is a cross-platform network tool designed for developers, I think we can build a brook wasm(WebAssembly) wssclient to make brook run in browsers, so that many other network tools such as curl and ssh can also run in browsers(using brook as proxy) to do a lot of thing(ftp, email, TELNET).

https://github.com/golang/go/wiki/WebAssembly https://developer.mozilla.org/en-US/docs/WebAssembly https://developer.mozilla.org/en-US/docs/Web/API/Worker https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

likev avatar Jan 14 '23 03:01 likev

Indeed, go can be compiled into wasm, but wasm (browser) does not seem to support transport layer APIs, such as bind and listen a address by unknown

txthinking-bot avatar Jan 14 '23 04:01 txthinking-bot

Indeed, go can be compiled into wasm, but wasm (browser) does not seem to support transport layer APIs, such as bind and listen a address by unknown

That's why we need a brook wasm wssclient to proxy tcp/udp on browser, we can make a bind/listen polyfill with Worker Channel Messaging API postMessage and Streams_API WritableStream.

This approach is theoretically possible and will open up many application scenarios, but on the other hand requires a lot of additional work.

likev avatar Jan 15 '23 09:01 likev