UNPKG

@aikidosec/firewall

Version:

Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.

23 lines (22 loc) 600 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hostnameToUnicode = hostnameToUnicode; const url_1 = require("url"); /** * Converts a punycode hostname to its unicode form. * e.g. "xn--mnchen-3ya.example.com" -> "münchen.example.com" * * Returns the original hostname if conversion fails or produces an empty result. */ function hostnameToUnicode(hostname) { try { const unicode = (0, url_1.domainToUnicode)(hostname); if (unicode) { return unicode; } } catch { // Ignore } return hostname; }