International Domain Names (IDN) support (closes #207)

This commit is contained in:
Maurus Decimus
2026-06-20 09:02:26 +02:00
parent 52a938297b
commit 0958d97925
14 changed files with 201 additions and 26 deletions

View File

@@ -41,9 +41,14 @@ use store::{
};
use trc::{AddContext, StoreEvent};
use types::id::Id;
use utils::DomainPart;
impl Server {
pub async fn domain(&self, domain: &str) -> trc::Result<Option<Arc<DomainCache>>> {
let Some(domain) = domain.to_ascii_domain() else {
return Ok(None);
};
let domain = domain.as_ref();
let domain_names = &self.inner.cache.domain_names;
if let Some(domain_id) = domain_names.get(domain) {

View File

@@ -189,6 +189,17 @@ pub(crate) fn build_certified_key(
pub(crate) fn build_self_signed_cert(
domains: impl Into<Vec<String>>,
) -> Result<CertifiedKey, String> {
let domains = domains
.into()
.into_iter()
.map(|domain| {
if domain.is_ascii() {
domain
} else {
idna::domain_to_ascii(&domain).unwrap_or(domain)
}
})
.collect::<Vec<_>>();
let rcgen::CertifiedKey { cert, signing_key } = generate_simple_self_signed(domains)
.map_err(|err| format!("Failed to generate self-signed certificate: {err}",))?;
build_certified_key(