mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:47:41 +00:00
refactor(net): share hostname normalization
This commit is contained in:
7
src/infra/net/hostname.ts
Normal file
7
src/infra/net/hostname.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user