@types/request-ip
TypeScript icon, indicating that this package has built-in type declarations

0.0.41 • Public • Published

Installation

npm install --save @types/request-ip

Summary

This package contains type definitions for request-ip (https://github.com/pbojinov/request-ip).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/request-ip.

index.d.ts

/// <reference types="node" />

import * as http from "http";

interface RequestHeaders extends http.IncomingHttpHeaders {
    "x-client-ip"?: string | undefined;
    "x-forwarded-for"?: string | undefined;
    "x-real-ip"?: string | undefined;
    "x-cluster-client-ip"?: string | undefined;
    "x-forwarded"?: string | undefined;
    "forwarded-for"?: string | undefined;
    "forwarded"?: string | undefined;
}

interface Request {
    headers?: RequestHeaders;
    connection?: {
        remoteAddress?: string | undefined;
        socket?: {
            remoteAddress?: string | undefined;
        } | undefined;
    } | undefined;
    info?: {
        remoteAddress?: string | undefined;
    } | undefined;
    socket?: {
        remoteAddress?: string | undefined;
    } | undefined;
}

interface Options {
    attributeName: string;
}

export declare function getClientIp(req: Request): string | null;

export function mw(options?: Options): (req: Request, res: any, next: any) => any;

declare global {
    namespace Express {
        interface Request {
            clientIp?: string | undefined;
        }
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Adam Babcock.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/request-ip

Weekly Downloads

663,437

Version

0.0.41

License

MIT

Unpacked Size

4.87 kB

Total Files

5

Last publish

Collaborators

  • types