UNPKG

@arcjet/ip

Version:

Arcjet utilities for finding the originating IP of a request

45 lines (44 loc) 1.52 kB
import { ProxyService } from "./index.js"; //#region src/cloudflare.d.ts /** * Cloudflare IPv4 ranges. * * Source: https://www.cloudflare.com/ips-v4/ */ declare const cloudflareIpv4Ranges: ReadonlyArray<string>; /** * Cloudflare IPv6 ranges. * * Source: https://www.cloudflare.com/ips-v6/ */ declare const cloudflareIpv6Ranges: ReadonlyArray<string>; /** * Configuration for {@linkcode cloudflare}. */ interface CloudflareOptions { /** * IP addresses and CIDR ranges that identify Cloudflare * (optional; defaults to the ranges bundled with this package). * * Override this only if the bundled ranges are out of date for your setup. */ ranges?: ReadonlyArray<string> | null | undefined; } /** * Describe Cloudflare as a trusted proxy in front of your application. * * Pass the result in the `proxies` array. When a request reaches your platform * from a Cloudflare IP, Arcjet will read the real client IP from the * `CF-Connecting-IP` / `CF-Connecting-IPv6` header instead of treating the * Cloudflare edge address as the client. The header is only trusted when the * connecting address is within Cloudflare's ranges, so it cannot be spoofed by * clients connecting directly to your platform. * * @param options * Configuration (optional). * @returns * Proxy service descriptor to include in the `proxies` array. */ declare function cloudflare(options?: CloudflareOptions | null | undefined): ProxyService; //#endregion export { CloudflareOptions, cloudflare, cloudflareIpv4Ranges, cloudflareIpv6Ranges };