-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.d.ts
37 lines (32 loc) · 910 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import express = require('express');
export type Ip = string;
export type CidrRange = string;
export type Route = string;
export type StartEndIpRange = Ip[];
export type IpRange = CidrRange | StartEndIpRange;
export type IpList = Array<Ip | IpRange>;
export interface IpCallback {
(): IpList;
}
export interface IpFilterOptions {
detectIp?: (request: express.Request) => Ip;
excluding?: Route[];
log?: boolean;
logLevel?: 'all' | 'deny' | 'allow';
logF?: (message: string) => void;
mode?: 'deny' | 'allow';
// `@types/proxy-addr` does not export the `trust` parameter type
trustProxy?: any;
}
export function IpFilter(
ips: IpList | IpCallback,
opts?: IpFilterOptions,
): express.RequestHandler;
export class IpDeniedError extends Error {
status: number;
extra: { ip: Ip };
constructor(
message: string,
extra: any,
);
}