UNPKG

@thi.ng/server

Version:

Minimal HTTP server with declarative routing, static file serving and freely extensible via pre/post interceptors

42 lines 1.35 kB
/** * Takes a hostname or IPv6 address `test` and compares it against `expected`, * returns true if matching. * * @remarks * If `test` is an IPv6 address in the format `[...]`, it will be compared * without surrounding square brackets. If `expected` is an IPv6 address it MUST * have been pre-normalized using {@link normalizeIPv6Address}. For performance * reasons only `test` will be automatically normalized, i.e. `::1` will be * normalized as `0:0:0:0:0:0:0:1`. * * @param test * @param expected * * @internal */ export declare const isMatchingHost: (test: string, expected: string) => boolean; /** * Parses given IPv6 address into an 8-tuple of 16bit uints. Throws error if * address is invalid. * * @remarks * https://en.wikipedia.org/wiki/IPv6_address * * @param addr */ export declare const parseIPv6Address: (addr: string) => number[]; /** * Returns normalized version of given IPv6 address, i.e. expanding `::` * sections, removing leading zeroes and performing other syntactic validations. * The returned address always has 8 parts. Throws error if address is invalid. * * @remarks * Internally uses {@link parseIPv6Address}. * * Reference: * https://en.wikipedia.org/wiki/IPv6_address * * @param addr */ export declare const normalizeIPv6Address: (addr: string) => string; //# sourceMappingURL=host.d.ts.map