tor-hsclient: impl HasKind for InvalidTarget: ..DescriptorValidationFailed

This basically always means we couldn't cope with the descriptor.

We need to extend the description of OnionServiceDescriptorValidationFailed
This commit is contained in:
Ian Jackson 2023-06-08 13:20:45 +01:00
parent 33c90e5b72
commit 9d22ce9f8a
2 changed files with 11 additions and 3 deletions

View File

@ -502,12 +502,14 @@ pub enum ErrorKind {
/// Failed to obtain a valid descriptor for the target hidden service (`.onion` service).
///
/// None of the hidden service descriptors we found for this service were valid (either because
/// of an invalid signature, or because of an untimely certificate).
/// None of the hidden service descriptors we found for this service were valid (because
/// of an invalid signature, an untimely certificate,
/// or connection instructions we could not handle).
///
/// This error has several possible causes:
/// * Our clock is set incorrectly
/// * The clock of the hidden service is set incorrectly
/// * The service's Tor version is not compatible with ours
#[cfg(feature = "experimental-api")]
#[display(fmt = "Onion Service descriptor validation failed")]
OnionServiceDescriptorValidationFailed,

View File

@ -5,7 +5,7 @@
#![allow(dead_code, unreachable_pub)] // TODO HS remove these once this API is exposed.
use tor_error::into_internal;
use tor_error::{into_internal, ErrorKind};
use tor_linkspec::{
decode::Strictness, verbatim::VerbatimLinkSpecCircTarget, CircTarget, EncodedLinkSpec,
OwnedChanTargetBuilder, OwnedCircTarget,
@ -102,3 +102,9 @@ pub enum InvalidTarget {
#[error("{0}")]
Bug(#[from] tor_error::Bug),
}
impl tor_error::HasKind for InvalidTarget {
fn kind(&self) -> ErrorKind {
ErrorKind::OnionServiceDescriptorValidationFailed
}
}