lib-qqwry-next 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +232 -0
- package/dist/index.cjs +735 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +714 -0
- package/dist/index.js.map +1 -0
- package/index.d.cts +3 -0
- package/package.json +54 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
|
|
3
|
+
interface IpInfo {
|
|
4
|
+
int: number;
|
|
5
|
+
ip: string;
|
|
6
|
+
Country: string;
|
|
7
|
+
Area: string;
|
|
8
|
+
}
|
|
9
|
+
interface IpScopeInfo {
|
|
10
|
+
begInt: number;
|
|
11
|
+
endInt: number;
|
|
12
|
+
begIP: string;
|
|
13
|
+
endIP: string;
|
|
14
|
+
Country: string;
|
|
15
|
+
Area: string;
|
|
16
|
+
}
|
|
17
|
+
interface StreamOptions {
|
|
18
|
+
format?: "text" | "csv" | "json" | "object";
|
|
19
|
+
outHeader?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface IpdbOptions {
|
|
22
|
+
language?: string;
|
|
23
|
+
}
|
|
24
|
+
interface QqwryCallable {
|
|
25
|
+
(ip: string | number): IpInfo;
|
|
26
|
+
(begin: string | number, end: string | number): IpScopeInfo[];
|
|
27
|
+
(begin: string | number, end: string | number, callback: (err: Error | null, data: IpScopeInfo[]) => void): void;
|
|
28
|
+
searchIP(ip: string | number): IpInfo;
|
|
29
|
+
searchIPScope(begin: string | number, end: string | number): IpScopeInfo[];
|
|
30
|
+
searchIPScope(begin: string | number, end: string | number, callback: (err: Error | null, data: IpScopeInfo[]) => void): void;
|
|
31
|
+
searchIPScopeStream(begin: string | number, end: string | number, options?: StreamOptions): Readable;
|
|
32
|
+
speed(): QqwryCallable;
|
|
33
|
+
unSpeed(): QqwryCallable;
|
|
34
|
+
}
|
|
35
|
+
interface IpdbCallable {
|
|
36
|
+
(ip?: string | number, language?: string): Record<string, string>;
|
|
37
|
+
searchIP(ip: string | number, language?: string): Record<string, string>;
|
|
38
|
+
fields(): string[];
|
|
39
|
+
languages(): string[];
|
|
40
|
+
buildTime(): number;
|
|
41
|
+
speed(): IpdbCallable;
|
|
42
|
+
unSpeed(): IpdbCallable;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* IP地址转数值
|
|
47
|
+
*/
|
|
48
|
+
declare function ipToInt(IP: string | number): number;
|
|
49
|
+
/**
|
|
50
|
+
* 数值转IP地址
|
|
51
|
+
*/
|
|
52
|
+
declare function intToIP(int: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* 32位 Big Endian 与 Little Endian 数值互转
|
|
55
|
+
*/
|
|
56
|
+
declare function ipEndianChange(int: number): number;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* lib-qqwry
|
|
60
|
+
* 纯真IP库(qqwry.dat) Node.js 解析引擎
|
|
61
|
+
*/
|
|
62
|
+
declare const libqqwry: ((dataPath: string, speed?: boolean) => QqwryCallable) & {
|
|
63
|
+
ipToInt: typeof ipToInt;
|
|
64
|
+
intToIP: typeof intToIP;
|
|
65
|
+
ipEndianChange: typeof ipEndianChange;
|
|
66
|
+
ipdb(dataPath: string, options?: IpdbOptions): IpdbCallable;
|
|
67
|
+
init(dataPath: string, speed?: boolean): QqwryCallable;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { libqqwry as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
|
|
3
|
+
interface IpInfo {
|
|
4
|
+
int: number;
|
|
5
|
+
ip: string;
|
|
6
|
+
Country: string;
|
|
7
|
+
Area: string;
|
|
8
|
+
}
|
|
9
|
+
interface IpScopeInfo {
|
|
10
|
+
begInt: number;
|
|
11
|
+
endInt: number;
|
|
12
|
+
begIP: string;
|
|
13
|
+
endIP: string;
|
|
14
|
+
Country: string;
|
|
15
|
+
Area: string;
|
|
16
|
+
}
|
|
17
|
+
interface StreamOptions {
|
|
18
|
+
format?: "text" | "csv" | "json" | "object";
|
|
19
|
+
outHeader?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface IpdbOptions {
|
|
22
|
+
language?: string;
|
|
23
|
+
}
|
|
24
|
+
interface QqwryCallable {
|
|
25
|
+
(ip: string | number): IpInfo;
|
|
26
|
+
(begin: string | number, end: string | number): IpScopeInfo[];
|
|
27
|
+
(begin: string | number, end: string | number, callback: (err: Error | null, data: IpScopeInfo[]) => void): void;
|
|
28
|
+
searchIP(ip: string | number): IpInfo;
|
|
29
|
+
searchIPScope(begin: string | number, end: string | number): IpScopeInfo[];
|
|
30
|
+
searchIPScope(begin: string | number, end: string | number, callback: (err: Error | null, data: IpScopeInfo[]) => void): void;
|
|
31
|
+
searchIPScopeStream(begin: string | number, end: string | number, options?: StreamOptions): Readable;
|
|
32
|
+
speed(): QqwryCallable;
|
|
33
|
+
unSpeed(): QqwryCallable;
|
|
34
|
+
}
|
|
35
|
+
interface IpdbCallable {
|
|
36
|
+
(ip?: string | number, language?: string): Record<string, string>;
|
|
37
|
+
searchIP(ip: string | number, language?: string): Record<string, string>;
|
|
38
|
+
fields(): string[];
|
|
39
|
+
languages(): string[];
|
|
40
|
+
buildTime(): number;
|
|
41
|
+
speed(): IpdbCallable;
|
|
42
|
+
unSpeed(): IpdbCallable;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* IP地址转数值
|
|
47
|
+
*/
|
|
48
|
+
declare function ipToInt(IP: string | number): number;
|
|
49
|
+
/**
|
|
50
|
+
* 数值转IP地址
|
|
51
|
+
*/
|
|
52
|
+
declare function intToIP(int: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* 32位 Big Endian 与 Little Endian 数值互转
|
|
55
|
+
*/
|
|
56
|
+
declare function ipEndianChange(int: number): number;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* lib-qqwry
|
|
60
|
+
* 纯真IP库(qqwry.dat) Node.js 解析引擎
|
|
61
|
+
*/
|
|
62
|
+
declare const libqqwry: ((dataPath: string, speed?: boolean) => QqwryCallable) & {
|
|
63
|
+
ipToInt: typeof ipToInt;
|
|
64
|
+
intToIP: typeof intToIP;
|
|
65
|
+
ipEndianChange: typeof ipEndianChange;
|
|
66
|
+
ipdb(dataPath: string, options?: IpdbOptions): IpdbCallable;
|
|
67
|
+
init(dataPath: string, speed?: boolean): QqwryCallable;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { libqqwry as default };
|