-
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
network: Fetch based browser networking #1061
Conversation
How about use a DNS over HTTPS (https://datatracker.ietf.org/doc/html/rfc8484) or this not suitable for this case? |
I thought about doing that, or making it an option. It's neat for the vm
to know the real ip, but doesn't really unlock anything interesting. Also,
1.1.1.1 didn't seem to support CORS.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this very cool.
From my first look:
- Some parts are rough performance-wise. This doesn't block a merge, but some TODO(perf) comments would be nice
- I think this should be exposed as an experimental option in index.html
- This needs a test (nodejs has fetch now). See tests/devices/virtio_console.js
for an example to script a Linux guest through the serial console. Just a simple udhcpcd and curl should be sufficient for now. - Some documentation should be added to docs/networking.md
Allow HTTP requests from browser to be served by VM.
That would be really cool.
HTTPS support (maybe with help of a rust based TLS stack in WASM)
Could be interesting, but it could also increase the size of v86.wasm significantly. I'd suggest sticking to http for this PR.
After a rebase on master the tests should be passing.
35ea6ca
to
95c0684
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks mostly good now. I've left a few comments on the test.
Before merging, could you rebase on master, run eslint src tests gen lib examples tools --fix
and fix the remaining issues manually?
Emulate a networking stack, intercept HTTP requests, serve them with fetch(). Enable by setting networking_proxy=fetch Somewhat fixes copy#198 Just enough networking for http to work for package managers and net-boot. The networking stack just reflects the macaddress of packets it receives, so shouldnt be bothered by mac address changes. Services include: - ARP replies by establishing the gateways IP - DHCP server sending gateway, dns, and client-ip - Gateway: 192.168.86.1 - Client: 192.168.86.100 - Netmask: 255.255.255.0 - UDP DNS server, all addresses resolve to: 192.168.87.1 - NTP Server, giving out the current time from Date() - Replies to ICMP pings to any IP address - UDP echo server on port 8 Limitations: - Request are limited by CORS rules, but CORS-proxies can work around this. - Redirects are handled transparently by fetch. The upside is sites that force an http->https upgrade appear to the VM to work over http. Future Work: - Allow HTTP requests from browser to be served by VM. - HTTPS support (maybe with help of a rust based TLS stack in WASM) - Support for POSTing binary data
- Add code to establishing TCP connection to VM - Cleanup
8bd658c
to
8df028f
Compare
Thanks! |
Emulate a networking stack, intercept HTTP requests, serve them with fetch(). Enable by setting networking_proxy=fetch
Somewhat fixes #198
Just enough networking for http to work for package managers and net-boot. The networking stack just reflects the mac address of packets it receives, so shouldn't be bothered by mac address changes. Services include:
Limitations:
Future Work: