(req: Request, subdomainOffset = 2)
| 62 | all(req, trustRemoteAddress(req)) |
| 63 | |
| 64 | export const getSubdomains = (req: Request, subdomainOffset = 2): string[] => { |
| 65 | const hostname = getHostname(req) |
| 66 | |
| 67 | if (!hostname) return [] |
| 68 | |
| 69 | const subdomains = isIP(hostname) ? [hostname] : hostname.split('.').reverse() |
| 70 | |
| 71 | return subdomains.slice(subdomainOffset) |
| 72 | } |
| 73 | |
| 74 | export type Connection = IncomingMessage['socket'] & { |
| 75 | encrypted: boolean |
no test coverage detected