Skip to main content

measure_https_latency

Function measure_https_latency 

Source
pub async fn measure_https_latency<'c>(
    servers: impl IntoIterator<Item = &'c ServerConnInfo>,
    config: Config,
) -> Option<(Duration, &'c ServerConnInfo, SocketAddr)>
Expand description

Measure the HTTPS latency to a set of servers, conventionally comprising a single DERP region.

The servers are assumed to be presented in order of preference and are tried serially. Any error during connection or latency measurement causes this function to advance to trying the next server.

Returns None iff no servers could be successfully measured, either due to connectivity errors or because they were not configured to be reachable. See the notes on dial_region_tls and dial_region_tcp for more details on when servers are treated as not configured for reachability.