Skip to content

Commit 94e9f9f

Browse files
committed
Added TypeScript type declarations
1 parent 0302c0c commit 94e9f9f

File tree

4 files changed

+80
-3
lines changed

4 files changed

+80
-3
lines changed

LICENSE.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 IP2Location.com
3+
Copyright (c) 2022 IP2Location.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ip2proxy-nodejs",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "IP2Proxy proxy detection component",
55
"keywords": [
66
"vpn-detection",
@@ -21,9 +21,11 @@
2121
"files": [
2222
"src/ip2proxy.js",
2323
"src/test.js",
24+
"src/ip2proxy.d.ts",
2425
"./README.md"
2526
],
2627
"main": "src/ip2proxy.js",
28+
"types": "src/ip2proxy.d.ts",
2729
"license": "MIT",
2830
"dependencies": {
2931
"big-integer": ">=1.6.8"

src/ip2proxy.d.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
export class IP2Proxy {
2+
readRow(readBytes: any, position: any): any;
3+
readBin(readBytes: any, position: any, readType: any, isBigInt: any): any;
4+
read8(position: any): any;
5+
read32(position: any, isBigInt: any): any;
6+
read32Row(position: any, buffer: any): any;
7+
read32Or128(position: any, ipType: any): any;
8+
read128(position: any): any;
9+
readStr(position: any): any;
10+
loadBin(): boolean;
11+
open(binPath: any): 0 | -1;
12+
close(): 0 | -1;
13+
proxyQueryData(myIP: any, ipType: any, data: any, mode: any): void;
14+
proxyQuery(myIP: any, mode: any): {
15+
ip: string;
16+
ipNo: string;
17+
isProxy: number;
18+
proxyType: string;
19+
countryShort: string;
20+
countryLong: string;
21+
region: string;
22+
city: string;
23+
isp: string;
24+
domain: string;
25+
usageType: string;
26+
asn: string;
27+
as: string;
28+
lastSeen: string;
29+
threat: string;
30+
provider: string;
31+
};
32+
getModuleVersion(): string;
33+
getPackageVersion(): number;
34+
getDatabaseVersion(): string;
35+
isProxy(myIP: any): number;
36+
getCountryShort(myIP: any): string;
37+
getCountryLong(myIP: any): string;
38+
getRegion(myIP: any): string;
39+
getCity(myIP: any): string;
40+
getISP(myIP: any): string;
41+
getProxyType(myIP: any): string;
42+
getDomain(myIP: any): string;
43+
getUsageType(myIP: any): string;
44+
getASN(myIP: any): string;
45+
getAS(myIP: any): string;
46+
getLastSeen(myIP: any): string;
47+
getThreat(myIP: any): string;
48+
getProvider(myIP: any): string;
49+
getAll(myIP: any): {
50+
ip: string;
51+
ipNo: string;
52+
isProxy: number;
53+
proxyType: string;
54+
countryShort: string;
55+
countryLong: string;
56+
region: string;
57+
city: string;
58+
isp: string;
59+
domain: string;
60+
usageType: string;
61+
asn: string;
62+
as: string;
63+
lastSeen: string;
64+
threat: string;
65+
provider: string;
66+
};
67+
#private;
68+
}
69+
export class IP2ProxyWebService {
70+
open(apiKey: any, apiPackage: any, useSSL?: boolean): void;
71+
checkParams(): void;
72+
lookup(myIP: any, callback: any): void;
73+
getCredit(callback: any): void;
74+
#private;
75+
}

src/ip2proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var bigInt = require("big-integer");
44
var https = require("https");
55

66
// For BIN queries
7-
const VERSION = "4.0.0";
7+
const VERSION = "4.1.0";
88
const MAX_INDEX = 65536;
99
const COUNTRY_POSITION = [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3];
1010
const REGION_POSITION = [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4];

0 commit comments

Comments
 (0)