pub struct ContextOverride {
pub proxy: Option<Proxy>,
pub user_agent: Option<String>,
pub locale: Option<String>,
pub timezone_id: Option<String>,
pub platform: Option<String>,
pub os: Option<OsType>,
pub geolocation: Option<Geolocation>,
pub window_size: Option<(u32, u32)>,
}Available on crate feature
camoufox only.Expand description
每标签(BrowserContext)级别的覆盖项:在 Browser::new_tab_with
打开标签时,叠加到浏览器基线选项之上,实现“同一浏览器进程内、每个标签不同代理 / 指纹“。
这些都是 Juggler context 级可下发的字段(Browser.set*Override{browserContextId} /
Browser.setContextProxy),因此能 per-Tab 轮换。深指纹(canvas/webgl/screen/humanize)是
进程级的,无法经此覆盖——需要时给不同浏览器 worker 配不同 BrowserOptions。
仅“设置了的项“会覆盖基线(None 沿用基线),便于只换代理或只换 UA。
Fields§
§proxy: Option<Proxy>覆盖代理(Browser.setContextProxy)。
user_agent: Option<String>覆盖 User-Agent。
locale: Option<String>覆盖语言 locale(如 zh-CN)。
timezone_id: Option<String>覆盖时区(如 Asia/Shanghai)。
platform: Option<String>覆盖 navigator.platform。
os: Option<OsType>覆盖目标 OS 指纹(影响 platform 推断等)。
geolocation: Option<Geolocation>覆盖地理位置。
window_size: Option<(u32, u32)>覆盖视口大小。
Implementations§
Source§impl ContextOverride
impl ContextOverride
pub fn new() -> Self
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
覆盖 User-Agent。
Sourcepub fn geolocation(self, latitude: f64, longitude: f64) -> Self
pub fn geolocation(self, latitude: f64, longitude: f64) -> Self
覆盖地理位置。
Sourcepub fn window_size(self, width: u32, height: u32) -> Self
pub fn window_size(self, width: u32, height: u32) -> Self
覆盖视口大小。
Trait Implementations§
Source§impl Clone for ContextOverride
impl Clone for ContextOverride
Source§fn clone(&self) -> ContextOverride
fn clone(&self) -> ContextOverride
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextOverride
impl Debug for ContextOverride
Source§impl Default for ContextOverride
impl Default for ContextOverride
Source§fn default() -> ContextOverride
fn default() -> ContextOverride
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextOverride
impl RefUnwindSafe for ContextOverride
impl Send for ContextOverride
impl Sync for ContextOverride
impl Unpin for ContextOverride
impl UnsafeUnpin for ContextOverride
impl UnwindSafe for ContextOverride
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more