Add a SAN, automatically choosing `IpAddress` or `DnsName` based on the value.
(sans: &mut Vec<SanType>, value: &str)
| 143 | |
| 144 | /// Add a SAN, automatically choosing `IpAddress` or `DnsName` based on the value. |
| 145 | fn add_san(sans: &mut Vec<SanType>, value: &str) { |
| 146 | if let Ok(ip) = value.parse::<IpAddr>() { |
| 147 | sans.push(SanType::IpAddress(ip)); |
| 148 | } else if let Ok(dns) = Ia5String::try_from(value) { |
| 149 | sans.push(SanType::DnsName(dns)); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | #[cfg(test)] |
| 154 | mod tests { |
no test coverage detected