Make --host-rules an alias for --host-resolver-rules.

Refs https://chromium-review.googlesource.com/c/chromium/src/+/4867872
This commit is contained in:
deepak1556
2025-08-26 17:53:20 +09:00
parent 99d8aa104a
commit 422eafaa9b
4 changed files with 26 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ Field trials to be forcefully enabled or disabled.
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
### --host-rules=`rules`
### --host-rules=`rules` _Deprecated_
A comma-separated list of `rules` that control how hostnames are mapped.
@@ -104,9 +104,23 @@ These mappings apply to the endpoint host in a net request (the TCP connect
and host resolver in a direct connection, and the `CONNECT` in an HTTP proxy
connection, and the endpoint host in a `SOCKS` proxy connection).
**Deprecated:** Use the `--host-resolver-rules` switch instead.
### --host-resolver-rules=`rules`
Like `--host-rules` but these `rules` only apply to the host resolver.
A comma-separated list of `rules` that control how hostnames are mapped.
For example:
* `MAP * 127.0.0.1` Forces all hostnames to be mapped to 127.0.0.1
* `MAP *.google.com proxy` Forces all google.com subdomains to be resolved to
"proxy".
* `MAP test.com [::1]:77` Forces "test.com" to resolve to IPv6 loopback. Will
also force the port of the resulting socket address to be 77.
* `MAP * baz, EXCLUDE www.google.com` Remaps everything to "baz", except for
"www.google.com".
These `rules` only apply to the host resolver.
### --ignore-certificate-errors

View File

@@ -12,6 +12,14 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (39.0)
### Deprecated: `--host-rules` command line switch
Chromium is deprecating the `--host-rules` switch.
You should use `--host-resolver-rules` instead.
## Planned Breaking API Changes (38.0)
### Removed: `ELECTRON_OZONE_PLATFORM_HINT` environment variable

View File

@@ -28,8 +28,8 @@ app.on('window-all-closed', () => null);
// Use fake device for Media Stream to replace actual camera and microphone.
app.commandLine.appendSwitch('use-fake-device-for-media-stream');
app.commandLine.appendSwitch('host-rules', 'MAP localhost2 127.0.0.1');
app.commandLine.appendSwitch('host-resolver-rules', [
'MAP localhost2 127.0.0.1',
'MAP ipv4.localhost2 10.0.0.1',
'MAP ipv6.localhost2 [::1]',
'MAP notfound.localhost2 ~NOTFOUND'

View File

@@ -351,7 +351,7 @@ app.whenReady().then(() => {
// https://github.com/electron/electron/blob/main/docs/api/command-line-switches.md
app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
app.commandLine.appendSwitch('host-resolver-rules', 'MAP * 127.0.0.1');
app.commandLine.appendSwitch('vmodule', 'console=0');
// systemPreferences