pub struct StreamPrefs { /* private fields */ }
Expand description

Preferences for how to route a stream over the Tor network.

Implementations

Construct a new StreamPrefs.

Indicate that a stream may be made over IPv4 or IPv6, but that we’d prefer IPv6.

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.

Indicate that a stream may be made over IPv4 or IPv6, but that we’d prefer IPv4.

This is the default.

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.

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.

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.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more