Struct tor_proto::stream::StreamParameters
source · [−]pub struct StreamParameters { /* private fields */ }
Expand description
A set of preferences used to declare how a new stream should be opened.
Implementations
sourceimpl StreamParameters
impl StreamParameters
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new StreamParameters
using default settings.
sourcepub fn ip_version(&mut self, preference: IpVersionPreference) -> &mut Self
pub fn ip_version(&mut self, preference: IpVersionPreference) -> &mut Self
Configure which IP version (IPv4 or IPv6) you’d like to request, if you’re connecting to a hostname.
The default is to allow either version, but to prefer IPv4.
sourcepub fn optimistic(&mut self, optimistic: bool) -> &mut Self
pub fn optimistic(&mut self, optimistic: bool) -> &mut Self
Configure whether the stream should be opened “optimistically.”
By default, streams are not “optimistic”. When you call
ClientCirc::begin_stream()
,
the function 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”, then
ClientCirc::begin_stream()
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.
Trait Implementations
sourceimpl Clone for StreamParameters
impl Clone for StreamParameters
sourcefn clone(&self) -> StreamParameters
fn clone(&self) -> StreamParameters
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 StreamParameters
impl Debug for StreamParameters
sourceimpl Default for StreamParameters
impl Default for StreamParameters
sourcefn default() -> StreamParameters
fn default() -> StreamParameters
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for StreamParameters
impl Send for StreamParameters
impl Sync for StreamParameters
impl Unpin for StreamParameters
impl UnwindSafe for StreamParameters
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
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.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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