-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.d.ts
More file actions
55 lines (49 loc) · 1.63 KB
/
Copy pathmodule.d.ts
File metadata and controls
55 lines (49 loc) · 1.63 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
declare module "gip" {
/**
* Configuration options for the GIP module.
*/
interface Options {
/**
* An array of custom "IP echo" service URLs to use for resolving the IP address.
* These will be merged with the built-in services.
*/
services?: string[];
/**
* The number of matching IP addresses required from different services before
* returning a successful result. A higher number increases reliability but may take longer.
* @default 3
*/
ensure?: number;
/**
* Global timeout in milliseconds for the entire IP resolution process.
* @default 10000
*/
timeout?: number;
/**
* If true, errors from failed service requests will be printed to stderr.
* @default true
*/
verbose?: boolean;
/**
* If true, a random query parameter is appended to each request to bypass caches.
* @default false
*/
noCache?: boolean;
/**
* The type of IP address to retrieve.
* - `ipv4`: Forces DNS resolution to IPv4 (`family: 4`).
* - `ipv6`: Forces DNS resolution to IPv6 (`family: 6`).
* - `automatic`: Uses both lists and accepts whichever IP version resolves first.
* @default "automatic"
*/
type?: "ipv4" | "ipv6" | "automatic";
}
/**
* Retrieves your real public IPv4 or IPv6 address.
*
* @param options - Optional configuration object.
* @returns A promise that resolves to the validated IP address as a string.
* @throws If no valid IP address can be resolved within the timeout, or if ensure count is not met.
*/
export default function gip(options?: Options): Promise<string>;
}