pub struct NetworkTimeClient { /* private fields */ }Expand description
An HTTPS client that reports the contents of the response Date header.
Implementations§
Source§impl NetworkTimeClient
impl NetworkTimeClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new NetworkTimeClient that uses the trust anchors provided through
the ‘root-ssl-certificates’ component feature.
Sourcepub async fn get_network_time(
&mut self,
uri: Uri,
) -> Result<DateTime<FixedOffset>, HttpsDateError>
pub async fn get_network_time( &mut self, uri: Uri, ) -> Result<DateTime<FixedOffset>, HttpsDateError>
Makes a best effort to get network time via an HTTPS connection to
uri.
§Errors
get_network_time will return errors for network failures and TLS failures.
§Panics
httpdate needs access to the root-ssl-certificates sandbox feature. If
it is not available this API will panic.
§Security
Validation of the TLS connection is deferred until after the handshake and then performed with respect to the time provided by the remote host. We validate the TLS connection against the system rootstore and time the server reports. This does mean that the best we can guarantee is that the host certificates were valid at some point, but the server can always provide a date that falls into the validity period of the certificates they provide.
Auto Trait Implementations§
impl Freeze for NetworkTimeClient
impl !RefUnwindSafe for NetworkTimeClient
impl Send for NetworkTimeClient
impl Sync for NetworkTimeClient
impl Unpin for NetworkTimeClient
impl !UnwindSafe for NetworkTimeClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more