|
@@ -20,11 +20,17 @@ pub struct Labels {
|
|
|
segments: Vec<(u8, String)>,
|
|
|
}
|
|
|
|
|
|
+#[cfg(feature = "idna")]
|
|
|
fn label_to_ascii(label: &str) -> Result<String, unic_idna::Errors> {
|
|
|
let flags = unic_idna::Flags{use_std3_ascii_rules: true, transitional_processing: false, verify_dns_length: true};
|
|
|
unic_idna::to_ascii(label, flags)
|
|
|
}
|
|
|
|
|
|
+#[cfg(not(feature = "idna"))]
|
|
|
+fn label_to_ascii(label: &str) -> Result<String, ()> {
|
|
|
+ Ok(label.to_owned())
|
|
|
+}
|
|
|
+
|
|
|
impl Labels {
|
|
|
|
|
|
/// Creates a new empty set of labels, which represent the root of the DNS
|