Something went wrong. Try again.
A free, open-source, self-hosted place to write a novel.
Something went wrong. Try again.
1.2 kB · 29 lines
at main
123456789101112131415161718192021222324252627282930/** * Types for `forwarded.mjs`, which is plain JavaScript so `server.js` can load it * before the app. The spec in `src/` is type-checked, so the signatures are * written down here once. */
/** The scheme of a declared origin, or null when it is empty, invalid or not http(s). */export function schemeFromOrigin(origin: string | null | undefined): 'http' | 'https' | null;
/** The scheme the nearest proxy appended, or null when the value names none. */export function schemeFromForwarded(value: string | string[] | undefined): 'http' | 'https' | null;
/** The client address `depth` entries from the right of a chain, or null. */export function addressFromForwarded( value: string | string[] | undefined, depth: number): string | null;
/** A positive whole proxy depth, or 1 for anything unusable. */export function proxyDepth(value: string | number | undefined): number;
/** The one client address the entry point writes for every consumer. */export function resolveClientAddress(options: { trustProxy: boolean; addressHeader: string; depth: number; headers: Record<string, string | string[] | undefined>; socket: string;}): string;