feat: session.resolveHost (#37690)

* feat: session.resolveHost

Expose Chromium's host resolution API through the Session object.

* Update shell/browser/api/electron_api_session.cc

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

* address feedback

* fix tests

* address feedback

* Add options

* Update shell/browser/api/electron_api_session.cc

Co-authored-by: Cheng Zhao <github@zcbenz.com>

* Update shell/browser/net/resolve_host_function.cc

Co-authored-by: Cheng Zhao <github@zcbenz.com>

* lint

* return object

* add missing file

* fix crash

* handle scope

* links

---------

Co-authored-by: Fedor Indutny <indutny@signal.org>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Cheng Zhao <github@zcbenz.com>
This commit is contained in:
Fedor Indutny 2023-04-05 07:06:14 -07:00 committed by GitHub
parent db27b9f433
commit 6bfef67aae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 477 additions and 0 deletions

View file

@ -22,6 +22,11 @@ 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 ipv4.localhost2 10.0.0.1',
'MAP ipv6.localhost2 [::1]',
'MAP notfound.localhost2 ~NOTFOUND'
].join(', '));
global.standardScheme = 'app';
global.zoomScheme = 'zoom';