Struct arti_client::StreamPrefs
source · [−]pub struct StreamPrefs { /* private fields */ }
Expand description
Preferences for how to route a stream over the Tor network.
Implementations
sourceimpl StreamPrefs
impl StreamPrefs
sourcepub fn ipv6_preferred(&mut self) -> &mut Self
pub fn ipv6_preferred(&mut self) -> &mut Self
Indicate that a stream may be made over IPv4 or IPv6, but that we’d prefer IPv6.
sourcepub fn ipv6_only(&mut self) -> &mut Self
pub fn ipv6_only(&mut self) -> &mut Self
Indicate that a stream may only be made over IPv6.
When this option is set, we will only pick exit relays that support IPv6, and we will tell them to only give us IPv6 connections.
sourcepub fn ipv4_preferred(&mut self) -> &mut Self
pub fn ipv4_preferred(&mut self) -> &mut Self
Indicate that a stream may be made over IPv4 or IPv6, but that we’d prefer IPv4.
This is the default.
sourcepub fn ipv4_only(&mut self) -> &mut Self
pub fn ipv4_only(&mut self) -> &mut Self
Indicate that a stream may only be made over IPv4.
When this option is set, we will only pick exit relays that support IPv4, and we will tell them to only give us IPv4 connections.
sourcepub fn optimistic(&mut self) -> &mut Self
pub fn optimistic(&mut self) -> &mut Self
Indicate that the stream should be opened “optimistically”.
By default, streams are not “optimistic”. When you call
TorClient::connect()
, it won’t give you a stream until the
exit node has confirmed that it has successfully opened a
connection to your target address. It’s safer to wait in this
way, but it is slower: it takes an entire round trip to get
your confirmation.
If a stream is configured to be “optimistic”, on the other
hand, then TorClient::connect()
will return the stream
immediately, without waiting for an answer from the exit. You
can start sending data on the stream right away, though of
course this data will be lost if the connection is not
actually successful.
sourcepub fn set_isolation_group(
&mut self,
isolation_group: IsolationToken
) -> &mut Self
pub fn set_isolation_group(
&mut self,
isolation_group: IsolationToken
) -> &mut Self
Indicate which other connections might use the same circuit as this one.
By default all connections made on all clones of a TorClient
may share connections.
Connections made with a particular isolation_group
may share circuits with each other.
This connection preference is orthogonal to isolation established by
TorClient::isolated_client
. Connections made with an isolated_client
(and its
clones) will not share circuits with the original client, even if the same
isolation_group
is specified via the ConnectionPrefs
in force.
sourcepub fn new_isolation_group(&mut self) -> &mut Self
pub fn new_isolation_group(&mut self) -> &mut Self
Indicate that connections with these preferences should have their own isolation group
This is a convenience method which creates a fresh IsolationToken
and sets it for these preferences.
This connection preference is orthogonal to isolation established by
TorClient::isolated_client
. Connections made with an isolated_client
(and its
clones) will not share circuits with the original client, even if the same
isolation_group
is specified via the ConnectionPrefs
in force.
sourcepub fn isolate_every_stream(&mut self) -> &mut Self
pub fn isolate_every_stream(&mut self) -> &mut Self
Indicate that no connection should share a circuit with any other.
Use with care: This is likely to have poor performance, and imposes a much greater load on the Tor network. Use this option only to make small numbers of connections each of which needs to be isolated from all other connections.
(Don’t just use this as a “get more privacy!!” method: the circuits that it put connections on will have no more privacy than any other circuits. The only benefit is that these circuits will not be shared by multiple streams.)
This can be undone by calling set_isolation_group
or new_isolation_group
on these
preferences.
Trait Implementations
sourceimpl Clone for StreamPrefs
impl Clone for StreamPrefs
sourcefn clone(&self) -> StreamPrefs
fn clone(&self) -> StreamPrefs
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StreamPrefs
impl Debug for StreamPrefs
sourceimpl Default for StreamPrefs
impl Default for StreamPrefs
sourcefn default() -> StreamPrefs
fn default() -> StreamPrefs
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for StreamPrefs
impl Send for StreamPrefs
impl Sync for StreamPrefs
impl Unpin for StreamPrefs
impl UnwindSafe for StreamPrefs
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more