1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
use super::Class; use crate::DomainName; use hex::encode; use std::fmt::{Display, Formatter, Result as FmtResult}; try_from_enum_to_integer! { #[repr(u8)] #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum SSHFPAlgorithm { Reserved = 0, RSA = 1, DSS = 2, } } try_from_enum_to_integer! { #[repr(u8)] #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum SSHFPType { Reserved = 0, Sha1 = 1, } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SSHFP { pub domain_name: DomainName, pub ttl: u32, pub class: Class, pub algorithm: SSHFPAlgorithm, pub type_: SSHFPType, pub fp: Vec<u8>, } impl_to_type!(SSHFP); impl Display for SSHFP { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!( f, "{} {} {} SSHFP {} {} {}", self.domain_name, self.ttl, self.class, self.algorithm, self.type_, encode(self.fp.as_slice()), ) } }