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§
source§impl 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§
source§impl Clone for StreamParameters
impl Clone for StreamParameters
source§fn clone(&self) -> StreamParameters
fn clone(&self) -> StreamParameters
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more