Function tor_dirclient::download
source · [−]pub async fn download<R, S, SP>(
runtime: &SP,
req: &R,
stream: &mut S,
source: Option<SourceInfo>
) -> Result<DirResponse> where
R: Requestable + ?Sized,
S: AsyncRead + AsyncWrite + Send + Unpin,
SP: SleepProvider,
Expand description
Fetch a Tor directory object from a provided stream.
To do this, we send a simple HTTP/1.0 request for the described
object in req
over stream
, and then wait for a response. In
log messages, we describe the origin of the data as coming from
source
.
Notes
It’s kind of bogus to have a ‘source’ field here at all; we may eventually want to remove it.
This function doesn’t close the stream; you may want to do that yourself.