pub struct WebRtcConfig {
pub policy: WebRtcPolicy,
pub public_ip: Option<String>,
pub local_ip: Option<String>,
pub location: Option<ProxyLocation>,
}Expand description
WebRTC leak-prevention and geolocation consistency configuration.
Produces both a JavaScript injection script (to run before page load) and
Chrome launch arguments that enforce the chosen WebRtcPolicy.
§Example
use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy};
let cfg = WebRtcConfig::default();
assert_eq!(cfg.policy, WebRtcPolicy::DisableNonProxied);
let args = cfg.chrome_args();
assert!(args.iter().any(|a| a.contains("disable_non_proxied_udp")));Fields§
§policy: WebRtcPolicyWebRTC IP-handling policy.
public_ip: Option<String>Fake public IP address to substitute in WebRTC SDP when using
WebRtcPolicy::BlockAll. Use an IP plausible for the proxy region.
Has no effect when WebRtcPolicy::AllowAll or
WebRtcPolicy::DisableNonProxied is selected.
local_ip: Option<String>Fake LAN IP address to substitute in WebRTC SDP when using
WebRtcPolicy::BlockAll.
location: Option<ProxyLocation>Optional geographic location to inject via navigator.geolocation.
When None, geolocation is not overridden.
Implementations§
Source§impl WebRtcConfig
impl WebRtcConfig
Sourcepub fn is_permissive(&self) -> bool
pub fn is_permissive(&self) -> bool
Returns true when WebRTC is not being restricted at all.
§Example
use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy};
let cfg = WebRtcConfig { policy: WebRtcPolicy::AllowAll, ..Default::default() };
assert!(cfg.is_permissive());Sourcepub fn chrome_args(&self) -> Vec<String>
pub fn chrome_args(&self) -> Vec<String>
Chrome launch arguments that enforce the selected WebRtcPolicy.
Returns an empty Vec for WebRtcPolicy::AllowAll since no Chrome
flag is needed in that case.
§Example
use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy};
let cfg = WebRtcConfig { policy: WebRtcPolicy::BlockAll, ..Default::default() };
let args = cfg.chrome_args();
assert!(args.iter().any(|a| a.contains("disable_non_proxied_udp")));Sourcepub fn injection_script(&self) -> String
pub fn injection_script(&self) -> String
JavaScript injection script that overrides RTCPeerConnection and
optionally overrides navigator.geolocation.
The generated script is an IIFE (immediately-invoked function expression)
designed to be injected via CDP Page.addScriptToEvaluateOnNewDocument.
§Example
use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy};
let cfg = WebRtcConfig { policy: WebRtcPolicy::BlockAll, ..Default::default() };
let script = cfg.injection_script();
assert!(script.contains("RTCPeerConnection"));Trait Implementations§
Source§impl Clone for WebRtcConfig
impl Clone for WebRtcConfig
Source§fn clone(&self) -> WebRtcConfig
fn clone(&self) -> WebRtcConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more