#[non_exhaustive]pub enum Error {
Show 22 variants
InappropriateMessage {
expect_types: Vec<ContentType>,
got_type: ContentType,
},
InappropriateHandshakeMessage {
expect_types: Vec<HandshakeType>,
got_type: HandshakeType,
},
InvalidEncryptedClientHello(EncryptedClientHelloError),
InvalidMessage(InvalidMessage),
NoCertificatesPresented,
UnsupportedNameType,
DecryptError,
EncryptError,
PeerIncompatible(PeerIncompatible),
PeerMisbehaved(PeerMisbehaved),
AlertReceived(AlertDescription),
InvalidCertificate(CertificateError),
InvalidCertRevocationList(CertRevocationListError),
General(String),
FailedToGetCurrentTime,
FailedToGetRandomBytes,
HandshakeNotComplete,
PeerSentOversizedRecord,
NoApplicationProtocol,
BadMaxFragmentSize,
InconsistentKeys(InconsistentKeys),
Other(OtherError),
}展开描述
rustls 通过该类型上报协议错误。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
非穷尽枚举将来可能添加额外的变体。因此,在对非穷尽枚举的变体进行模式匹配时,必须额外添加一个通配分支以容纳未来可能新增的变体。
InappropriateMessage
我们收到了此刻并不合法的 TLS 消息。expect_types 列出当前阶段预期可能出现的消息类型;got_type 则是我们实际收到的类型。此错误通常由 TLS 协议栈存在 bug(对端或本端)、网络故障或攻击所致。
InappropriateHandshakeMessage
我们收到了此刻并不合法的 TLS 握手消息。expect_types 列出当前阶段预期可能出现的握手消息类型;got_type 则是我们实际收到的类型。
InvalidEncryptedClientHello(EncryptedClientHelloError)
处理 ECH(Encrypted Client Hello)时发生错误。
InvalidMessage(InvalidMessage)
对端发来了内容非法的 TLS 消息。
NoCertificatesPresented
对端未提供任何证书。
UnsupportedNameType
证书验证器不支持所给名称的类型。
DecryptError
无法解密某条消息。此错误总是致命的。
EncryptError
由于消息大小超过允许上限,我们无法对其进行加密。只要应用程序使用了合法的记录大小,此错误就绝不会发生。
PeerIncompatible(PeerIncompatible)
对端不支持我们所需的某个协议版本或特性。参数给出具体是哪个版本或特性的提示。
PeerMisbehaved(PeerMisbehaved)
对端偏离了标准 TLS 协议。参数给出偏差位置的提示。
AlertReceived(AlertDescription)
我们收到了致命告警。这表示对端不满意。
InvalidCertificate(CertificateError)
发现了一张非法证书。
其中包含的错误来自证书验证 trait 的实现。
InvalidCertRevocationList(CertRevocationListError)
所提供的证书吊销列表(CRL)无效。
General(String)
用于兜底处理不太可能出现的错误。
FailedToGetCurrentTime
无法获取当前时间。
FailedToGetRandomBytes
无法从系统获取随机字节。
HandshakeNotComplete
在 TLS 握手完成之前,该函数无法使用。
PeerSentOversizedRecord
对端发送了过大的记录或分片。
NoApplicationProtocol
入站连接不支持任何已知的应用层协议。
BadMaxFragmentSize
配置中提供的 max_fragment_size 值过小或过大。
InconsistentKeys(InconsistentKeys)
来自 keys_match 或无法产生对应公钥的 crate::crypto::signer::SigningKey 的特定失败情形。
Other(OtherError)
任何其他错误。
此变体应仅在错误无法被更具体的变体准确描述时使用。例如,自定义加密提供者返回的特定错误。
持有此变体的枚举值之间永远不会判等。
trait 实现§
源代码§impl Error for Error
Available on crate feature std only.
impl Error for Error
Available on crate feature
std only.源代码§impl From<CertRevocationListError> for Error
impl From<CertRevocationListError> for Error
源代码§fn from(e: CertRevocationListError) -> Error
fn from(e: CertRevocationListError) -> Error
从输入类型转换为此类型。
源代码§impl From<CertificateError> for Error
impl From<CertificateError> for Error
源代码§fn from(e: CertificateError) -> Error
fn from(e: CertificateError) -> Error
从输入类型转换为此类型。
源代码§impl From<EncryptedClientHelloError> for Error
impl From<EncryptedClientHelloError> for Error
源代码§fn from(e: EncryptedClientHelloError) -> Error
fn from(e: EncryptedClientHelloError) -> Error
从输入类型转换为此类型。
源代码§impl From<GetRandomFailed> for Error
impl From<GetRandomFailed> for Error
源代码§fn from(_: GetRandomFailed) -> Error
fn from(_: GetRandomFailed) -> Error
从输入类型转换为此类型。
源代码§impl From<InconsistentKeys> for Error
impl From<InconsistentKeys> for Error
源代码§fn from(e: InconsistentKeys) -> Error
fn from(e: InconsistentKeys) -> Error
从输入类型转换为此类型。
源代码§impl From<InvalidMessage> for Error
impl From<InvalidMessage> for Error
源代码§fn from(e: InvalidMessage) -> Error
fn from(e: InvalidMessage) -> Error
从输入类型转换为此类型。
源代码§impl From<OtherError> for Error
impl From<OtherError> for Error
源代码§fn from(value: OtherError) -> Error
fn from(value: OtherError) -> Error
从输入类型转换为此类型。
源代码§impl From<PeerIncompatible> for Error
impl From<PeerIncompatible> for Error
源代码§fn from(e: PeerIncompatible) -> Error
fn from(e: PeerIncompatible) -> Error
从输入类型转换为此类型。
源代码§impl From<PeerMisbehaved> for Error
impl From<PeerMisbehaved> for Error
源代码§fn from(e: PeerMisbehaved) -> Error
fn from(e: PeerMisbehaved) -> Error
从输入类型转换为此类型。
源代码§impl From<SystemTimeError> for Error
Available on crate feature std only.
impl From<SystemTimeError> for Error
Available on crate feature
std only.源代码§fn from(_: SystemTimeError) -> Error
fn from(_: SystemTimeError) -> Error
从输入类型转换为此类型。
源代码§impl From<UnsupportedOperationError> for Error
impl From<UnsupportedOperationError> for Error
源代码§fn from(value: UnsupportedOperationError) -> Error
fn from(value: UnsupportedOperationError) -> Error
从输入类型转换为此类型。
impl StructuralPartialEq for Error
自动 trait 实现§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
blanket 实现§
源代码§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
源代码§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. 更多信息