(input: string | undefined)
| 547 | } |
| 548 | |
| 549 | const parseForwardedAddress = (input: string | undefined): NetAddress.IpAddress | undefined => { |
| 550 | if (input === undefined) return undefined |
| 551 | const ip = NetAddress.ipFromString(input.startsWith("[") && input.endsWith("]") ? input.slice(1, -1) : input) |
| 552 | if (Result.isSuccess(ip)) return NetAddress.toCanonical(ip.success) |
| 553 | const inet = NetAddress.inetAddressFromString(input) |
| 554 | return Result.isSuccess(inet) ? NetAddress.toCanonical(inet.success.address) : undefined |
| 555 | } |
| 556 | |
| 557 | const hostShape = /^(?:\[[0-9a-f:.]+\]|[a-z0-9._-]+)(?::\d{1,5})?$/i |
| 558 |
no test coverage detected