Module webrtc

Module webrtc 

Source
Expand description

WebRTC IP leak prevention and geolocation consistency

Browsers can expose the host machine’s real IP address via RTCPeerConnection, even when a proxy is configured, because WebRTC uses UDP STUN requests that bypass the HTTP proxy tunnel. This module provides:

  • WebRtcPolicy — controls how aggressively WebRTC is restricted.
  • ProxyLocation — optional geolocation to match a proxy’s region.
  • WebRtcConfig — bundles policy + location and generates injection scripts and Chrome launch arguments.

§Example

use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy, ProxyLocation};

let location = ProxyLocation {
    latitude: 40.7128,
    longitude: -74.0060,
    accuracy: 100.0,
    timezone: "America/New_York".to_string(),
    locale: "en-US".to_string(),
};

let config = WebRtcConfig {
    policy: WebRtcPolicy::DisableNonProxied,
    public_ip: Some("203.0.113.42".to_string()),
    local_ip: Some("192.168.1.100".to_string()),
    location: Some(location),
};

let script = config.injection_script();
assert!(script.contains("RTCPeerConnection"));
let args = config.chrome_args();
assert!(args.iter().any(|a| a.contains("disable_non_proxied_udp")));

Structs§

ProxyLocation
Geographic location metadata for geolocation consistency with a proxy.
WebRtcConfig
WebRTC leak-prevention and geolocation consistency configuration.

Enums§

WebRtcPolicy
Controls how WebRTC connections are handled to prevent IP leakage.