ipv6.d.ts 971 B

1234567891011121314151617181920
  1. import type * as http from 'node:http';
  2. import type { Options } from '../types.js';
  3. /**
  4. * Normalize bracketed IPv6 URL targets into unbracketed host options.
  5. *
  6. * RFC 2732 defines the URL syntax for literal IPv6 addresses as bracketed
  7. * host references (for example `http://[::1]:8080/path` where host is
  8. * `[::1]`).
  9. *
  10. * `httpxy` resolves bracketed hostnames (for example `[::1]`) via DNS,
  11. * which can fail for IPv6 literals. This converts string/URL `target` and
  12. * `forward` values into object form with `hostname: ::1` (brackets removed)
  13. * so the address can be connected directly.
  14. *
  15. * Reference: RFC 2732, Section 2 (Literal IPv6 Address Format in URL's)
  16. * https://www.ietf.org/rfc/rfc2732.txt
  17. *
  18. * The provided options object is mutated in place.
  19. */
  20. export declare function normalizeIPv6LiteralTargets<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(options: Options<TReq, TRes>): void;