also looking at this
fix: allow underscores in domain labels
#2057
2 files
+19
-2
| @@ -41,7 +41,7 @@ export class DnsClient { | ||
| 41 | 41 | * - Start/end dots |
| 42 | 42 | * - Overall length (max 253 characters) |
| 43 | 43 | * - Label length (max 63 characters) |
| 44 | * - Valid characters (a-z, 0-9, -) | |
| 44 | * - Valid characters (a-z, 0-9, -, _) | |
| 45 | 45 | * |
| 46 | 46 | * @param domain - The domain name to validate |
| 47 | 47 | * @throws {Error} If the domain name is invalid |
| @@ -70,7 +70,7 @@ export class DnsClient { | ||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check label characters |
| 73 | if (!/^[a-z0-9-]+$/i.test(label)) { | |
| 73 | if (!/^[a-z0-9_-]+$/i.test(label)) { | |
| 74 | 74 | throw new Error(`Invalid characters in domain label: ${label}`) |
| 75 | 75 | } |
| 76 | 76 | } |