openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
15 lines (14 loc) • 597 B
JavaScript
import { o as normalizeLowercaseStringOrEmpty } from "./string-coerce-CCIiB4H7.mjs";
//#region src/infra/net/hostname.ts
/** Bracket IPv6 hosts when serializing a URL authority or host:port target. */
function formatHostForUrl(e) {
return e.includes(":") && !e.startsWith("[") ? `[${e}]` : e;
}
/** Normalize a hostname for policy comparisons. */
function normalizeHostname(e) {
const t = normalizeLowercaseStringOrEmpty(e).replace(/\.+$/, "");
if (t.startsWith("[") && t.endsWith("]")) return t.slice(1, -1);
return t;
}
//#endregion
export { normalizeHostname as n, formatHostForUrl as t };