import { ExtensionKey } from "../http/index.js"; import type { HttpLayer } from "../layer/index.js"; import type { HttpService } from "../service/index.js"; /** * Extension key which holds the client IP. */ export declare const CLIENT_IP: ExtensionKey; /** * A layer that extracts the client IP address from the request. * * If `trustProxy` is set to true, the `x-forwarded-for` header is considered. * * The client IP can later be accessed through the {@link CLIENT_IP} extension * key. * * @example * ```ts * import { SetClientIpLayer } from "@taxum/core/middleware/client-ip"; * import { m, Router } from "@taxum/core/routing"; * * const router = new Router() * .route("/", m.get(() => "Hello World)) * .layer(new SetClientIpLayer()); * ``` */ export declare class SetClientIpLayer implements HttpLayer { private readonly trustProxy; /** * Creates a new {@link SetClientIpLayer}. * * @param trustProxy - whether to trust proxy headers. */ constructor(trustProxy?: boolean); layer(inner: HttpService): HttpService; }