best address logic

This commit is contained in:
Aiden McClelland
2025-08-07 17:15:23 -06:00
parent 4d5ff1a97b
commit 3845550e90
9 changed files with 119 additions and 107 deletions

View File

@@ -72,9 +72,7 @@ pub enum IpHostname {
},
Domain {
#[ts(type = "string")]
domain: InternedString,
#[ts(type = "string | null")]
subdomain: Option<InternedString>,
value: InternedString,
port: Option<u16>,
ssl_port: Option<u16>,
},
@@ -85,15 +83,7 @@ impl IpHostname {
Self::Ipv4 { value, .. } => InternedString::from_display(value),
Self::Ipv6 { value, .. } => InternedString::from_display(value),
Self::Local { value, .. } => value.clone(),
Self::Domain {
domain, subdomain, ..
} => {
if let Some(subdomain) = subdomain {
InternedString::from_display(&lazy_format!("{subdomain}.{domain}"))
} else {
domain.clone()
}
}
Self::Domain { value, .. } => value.clone(),
}
}
}