refactor(net): share hostname normalization

This commit is contained in:
Peter Steinberger
2026-02-16 01:01:22 +00:00
parent d5ee766afe
commit 4aaafe5322
3 changed files with 9 additions and 16 deletions

View File

@@ -0,0 +1,7 @@
export function normalizeHostname(hostname: string): string {
const normalized = hostname.trim().toLowerCase().replace(/\.$/, "");
if (normalized.startsWith("[") && normalized.endsWith("]")) {
return normalized.slice(1, -1);
}
return normalized;
}