Repository navigation
Add WebRTCIPPolicy setting to webContents - #8866
Conversation
Resolves electron#8777 Code to set and get the policy come from the muon framework code: https://github.com/brave/muon/blob/master/atom/browser/api/atom_api_web_ contents.cc#L1324...L1343
|
@jkleinsc thanks for adding this. I'm wondering though if we really need the new Adding Would you be okay just setting it via one of those methods instead? |
|
@kevinsawicki I'm fine with it just being set on I can update the PR to not include the |
|
@kevinsawicki PR has been updated to not include the |
Awesome, thanks, would you also mind adding a small spec to |
| void GoForward(); | ||
| void GoToOffset(int offset); | ||
| const std::string& GetWebRTCIPHandlingPolicy() const; | ||
| void SetWebRTCIPHandlingPolicy(const std::string webrtc_ip_handling_policy); |
There was a problem hiding this comment.
This should take a reference:
void SetWebRTCIPHandlingPolicy(const std::string& webrtc_ip_handling_policy);| void GoBack(); | ||
| void GoForward(); | ||
| void GoToOffset(int offset); | ||
| const std::string& GetWebRTCIPHandlingPolicy() const; |
There was a problem hiding this comment.
Looks like our other getter APIs like GetUserAgent and GetTitle don't return references so I think it is fine to just return a std::string here for consistency.
|
@kevinsawicki thanks for the feedback. I updated the reference issues and added the spec. Let me know if you have any further feedback. |
| * `default` - Exposes user's public and local IPs. This is the default behavior if not specified. | ||
| * `default_public_interface_only` - Exposes user's public IP, but does not expose user's local IP. | ||
| * `default_public_and_private_interfaces` - Exposes user's public and local IPs. | ||
| * `disable_non_proxied_udp` - Does not expose public or local IPs. |
There was a problem hiding this comment.
It would be better to also add the explanation for each of these policies from https://cs.chromium.org/chromium/src/content/public/common/webrtc_ip_handling_policy.h
There was a problem hiding this comment.
Good point. I'll update the PR.
|
Docs have been updated. |
|
Thanks for this @jkleinsc, great to support this in Electron 👍 🔒 📶 |
|
OS: Linux mint 18.1 KDE Edition (64) crash when you use the code |
|
@Binom777 Having trouble reproducing with your app, it successfully loads for me, can you double check you are using Electron 1.6.4 or above? |
|
@kevinsawicki I apologize, this is my inattention. |


Resolves #8777
The WebRTC IP Handling Policy can now be set on webContents via the
setWebRTCIPHandlingPolicymethod. The following values are supported:default- Exposes user's public and local IPs. This is the default behavior if not specified.default_public_interface_only- Exposes user's public IP, but does not expose user's local IP.default_public_and_private_interfaces- Exposes user's public and local IPs.disable_non_proxied_udp- Does not expose public or local IPs.Code to set and get the policy on webContents come from the Muon framework code:
https://github.com/brave/muon/blob/master/atom/browser/api/atom_api_web_
contents.cc#L1324...L1343
Here is a screenshot of a sample Electron app setting the WebRTCIPPolicy to disable_non_proxied_udp