-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tcpip.js networking examples / docs #1197
Comments
Nice work! Would you like to share it in this discussion: #1048? |
Super cool stuff. Im sure this is way more comprehensive then what we've done in 1300 lines of javascript code. I also thought about maybe using the gvisor stuff similar to container2wasm, but it looked too heavy weight. lwip looks like it could be pretty nice, especially as it also seems to have a http server and TLS. Its a bit tough to make a sweet example without DHCP, DNS, and maybe even HTTP working in tcpip.js, as thats what most people are actually going to need to make their VMs work. |
@basicer Good timing. I'm just finishing up UDP, DHCP, and DNS support for tcpip.js (along with adapters for container2wasm to do the same thing there). I'll post an update when it's ready. HTTP is partway done - I'll get back to that after the above is finished. PS. fun fact tcpip.js used to be built on Go + gvisor but I rewrote on lwIP for the same reason - wasm output was ~5MB vs under 100KB now. |
Hey 👋 amazing tool.
So far the networking examples focus on connecting to external networks or proxies (fetch proxy, WISP). I'm interested in local networking - communicating directly between JS and v86. This would open the door to use cases like running a server-side program (like Postgres, nginx, etc) inside v86 and communicate with it from JS.
I built tcpip.js to solve this. It's a virtual network stack that can run in the browser. It's built on top of lwIP compiled to WASM with bindings to hook into each layer of the network stack (L2, L3, L4).
Example use case
Set up plumbing that pipes ethernet packets between v86 and the virtual network stack.
Now we can establish a TCP connection to the emulator from JS (assuming VM has IP
192.168.1.2
and a server listening on port 80):Or we can create a TCP server and listen for inbound connections:
Other use cases
I'm planning to add bridge interface support soon, which would allow you to use tcpip.js as a switch/router. This can be useful for connecting more than 2 VMs together in a LAN.
I was wondering if you are interested in adding docs / examples for this use case? If so happy to put a PR together that adds some demos and networking docs.
The text was updated successfully, but these errors were encountered: