Skip to content
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

Allow embedding of CORS proxy in fetch relay_url #1189

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pass options.net_device to NetworkAdapter constructors
- aligned construction of WispNetworkAdapter and FetchNetworkAdapter classes
- supported members in object options.net_device (all optional):
  id, router_mac, router_ip, vm_ip, masquerade, dns_method, doh_server, cors_proxy
- completed support for free choice between fake network DNS methods "static" and "doh"
  • Loading branch information
chschnell committed Dec 8, 2024
commit 27fc39d1d444afb1787f044f26ea9d64c262dcea
3 changes: 2 additions & 1 deletion src/browser/fetch_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ function FetchNetworkAdapter(bus, config)
this.vm_ip = new Uint8Array((config.vm_ip || "192.168.86.100").split(".").map(function(x) { return parseInt(x, 10); }));
this.masquerade = config.masquerade === undefined || !!config.masquerade;
this.vm_mac = new Uint8Array(6);
this.dns_method = config.dns_method || "static";
this.doh_server = config.doh_server;
this.tcp_conn = {};
this.eth_encoder_buf = create_eth_encoder_buf();
this.dns_method = "static";

// Ex: 'https://corsproxy.io/?'
this.cors_proxy = config.cors_proxy;
Expand Down
4 changes: 2 additions & 2 deletions src/browser/starter.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ V86.prototype.continue_init = async function(emulator, options)
// TODO: remove bus, use direct calls instead
if(relay_url === "fetch")
{
this.network_adapter = new FetchNetworkAdapter(this.bus, options.net_device ? options.net_device : {});
this.network_adapter = new FetchNetworkAdapter(this.bus, options.net_device);
}
else if(relay_url.startsWith("wisp://") || relay_url.startsWith("wisps://"))
{
this.network_adapter = new WispNetworkAdapter(relay_url, this.bus, options);
this.network_adapter = new WispNetworkAdapter(relay_url, this.bus, options.net_device);
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/browser/wisp_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* @constructor
*
* @param {String} wisp_url
* @param {BusConnector} bus
* @param {*=} config
*/
Expand All @@ -21,10 +22,10 @@ function WispNetworkAdapter(wisp_url, bus, config)
this.vm_ip = new Uint8Array((config.vm_ip || "192.168.86.100").split(".").map(function(x) { return parseInt(x, 10); }));
this.masquerade = config.masquerade === undefined || !!config.masquerade;
this.vm_mac = new Uint8Array(6);
this.dns_method = config.dns_method || "doh";
this.doh_server = config.doh_server;
this.tcp_conn = {};
this.eth_encoder_buf = create_eth_encoder_buf();
this.dns_method = "doh";
this.doh_server = config.doh_server;

this.bus.register("net" + this.id + "-mac", function(mac) {
this.vm_mac = new Uint8Array(mac.split(":").map(function(x) { return parseInt(x, 16); }));
Expand Down
Loading