browser-vm icon indicating copy to clipboard operation
browser-vm copied to clipboard

Networking support

Open avaer opened this issue 4 years ago • 5 comments

Any chance we would be able to do netcat/curl/wget/dig type things inside of the VM?

Obviously the browser has a lot of restrictions on network so these probably can't work the usual way, but I'm wondering if we could get a basic fetch or XHR-type thing in there. It seems it would be logically possible with all of the existing resource sharing.

Also, is this the right repository for this question? :P

avaer avatar Dec 15 '19 08:12 avaer

You could get those built into this vm, yes. All it would require is to tweak the buildroot packages that get installed via the menu configs, which I discuss how to do in the README. However, I didn't do it for a couple of reasons:

  1. VM size. Everything you add, even "small" utilities like these, start to increase the size of the VM significantly. For my purposes, I wanted it to be as small as possible, so I don't bundle a ton of things I'd love to have.
  2. Same-Origin. Once you have all this networking gear in place, you can't really do much because of same-origin policies in the browser. You could XHR/fetch data from the host that served the VM. But you can't satisfy what most users would expect, namely, arbitrary networking to third-party hosts.

The v86 "hardware" I'm using here does support networking, if you want to play with it. You just have to run your own proxy server, and via WebSockets, you can get out to the wider internet. He's also got a heavier VM running Archlinux, which has the networking enabled.

humphd avatar Dec 15 '19 14:12 humphd

@humphd I have added the required package, device driver using Linux-menuconfig. Although it fails to add the network interface (for instance : eth0). The booting fails if I use v86 bios and Filer included libv86.js from browser-shell. I am really stuck to figure out where is the issue. My purpose is to have stream of data fed into a process running inside the VM through network port. Any suggestion?

dawnofman avatar Apr 11 '21 13:04 dawnofman

I think you should talk to the v86 folks, I've never played with their networking support, and the work I have in this repo specifically has it all disabled.

humphd avatar Apr 11 '21 14:04 humphd

I cracked it and thank you!

dawnofman avatar Apr 13 '21 14:04 dawnofman

Holy shit this package is amazing. Networking side can be solved using a library like https://github.com/SahidMiller/network-stackify on the front end with go-ipfs p2p streams on the backend. go-ipfs is particularly useful as a generic server side websocket tunnel / exit node, but with much more features for configuration.

The real kicker is that once SSH is tunneled over libp2p and the browser terminal connects (I used xtermjs + ssh2 for this) then the user can create new tunneled connections to other ips using go-ipfs... actually, it might be possible to reuse that SSH connection to forward to any ip, never needing to touch go-ipfs again.

I think the VM just needs to act like these websocket connections are legit TCP connections like you would js and polyfilling.

SahidMiller avatar Aug 12 '21 11:08 SahidMiller