iploop 1.0.2 → 1.0.3
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 +41 -180
- package/package.json +14 -39
- package/src/client.js +128 -0
- package/src/exceptions.js +16 -0
- package/src/headers.js +47 -0
- package/src/index.js +5 -0
- package/src/retry.js +28 -0
- package/src/session.js +18 -0
- package/src/support.js +61 -0
- package/dist/index.d.ts +0 -155
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -320
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
# IPLoop Node.js SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Residential proxy SDK — one-liner web fetching through millions of real IPs.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
5
|
+
## Install
|
|
9
6
|
|
|
10
7
|
```bash
|
|
11
8
|
npm install iploop
|
|
@@ -13,193 +10,57 @@ npm install iploop
|
|
|
13
10
|
|
|
14
11
|
## Quick Start
|
|
15
12
|
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const client = new IPLoopClient({ apiKey: 'your-api-key' });
|
|
20
|
-
const response = await client.get('https://httpbin.org/ip');
|
|
21
|
-
console.log(response.data);
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
- **Residential proxies** — millions of real IPs across 195+ countries
|
|
27
|
-
- **Geographic targeting** — country and city-level precision
|
|
28
|
-
- **Sticky sessions** — keep the same IP across multiple requests
|
|
29
|
-
- **Auto-retry** — failed requests automatically retry with fresh IPs
|
|
30
|
-
- **Smart headers** — Chrome fingerprint headers matched to target country
|
|
31
|
-
- **HTTP & SOCKS5** — both protocols supported
|
|
32
|
-
- **Concurrent fetching** — batch requests with configurable concurrency
|
|
33
|
-
- **TypeScript** — full type definitions included
|
|
34
|
-
|
|
35
|
-
## Authentication
|
|
36
|
-
|
|
37
|
-
Get your API key from the [IPLoop Dashboard](https://iploop.io/dashboard).
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
const client = new IPLoopClient({
|
|
41
|
-
apiKey: 'your-api-key',
|
|
42
|
-
country: 'US', // default country for all requests
|
|
43
|
-
debug: true, // enable request logging
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Geographic Targeting
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
// Target a specific country
|
|
51
|
-
const resp = await client.get('https://example.com', { country: 'DE' });
|
|
52
|
-
|
|
53
|
-
// Target a specific city
|
|
54
|
-
const resp = await client.get('https://example.com', { country: 'US', city: 'miami' });
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Sticky Sessions
|
|
13
|
+
```javascript
|
|
14
|
+
const { IPLoop } = require('iploop');
|
|
15
|
+
const ip = new IPLoop('YOUR_API_KEY');
|
|
58
16
|
|
|
59
|
-
|
|
17
|
+
// One-liner fetch through US residential IP
|
|
18
|
+
const result = await ip.fetch('https://example.com', { country: 'US' });
|
|
19
|
+
console.log(result.status, result.body);
|
|
60
20
|
|
|
61
|
-
|
|
62
|
-
const session =
|
|
21
|
+
// Sticky session (same IP across requests)
|
|
22
|
+
const session = ip.session({ country: 'US', city: 'newyork' });
|
|
23
|
+
const page1 = await session.fetch('https://site.com/page1');
|
|
24
|
+
const page2 = await session.fetch('https://site.com/page2');
|
|
63
25
|
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## HTTP Methods
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
// GET
|
|
72
|
-
const resp = await client.get('https://httpbin.org/get');
|
|
73
|
-
|
|
74
|
-
// POST
|
|
75
|
-
const resp = await client.post('https://httpbin.org/post', { key: 'value' });
|
|
76
|
-
|
|
77
|
-
// PUT
|
|
78
|
-
const resp = await client.put('https://httpbin.org/put', { key: 'value' });
|
|
79
|
-
|
|
80
|
-
// DELETE
|
|
81
|
-
const resp = await client.delete('https://httpbin.org/delete');
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Concurrent Fetching
|
|
85
|
-
|
|
86
|
-
Fetch multiple URLs in parallel:
|
|
26
|
+
// Check usage
|
|
27
|
+
const usage = await ip.usage();
|
|
87
28
|
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
'https://example.com/page1',
|
|
91
|
-
'https://example.com/page2',
|
|
92
|
-
'https://example.com/page3',
|
|
93
|
-
], { country: 'US' }, 10); // 10 concurrent workers
|
|
94
|
-
|
|
95
|
-
console.log(results);
|
|
96
|
-
// [{ url: '...', status: 200, success: true, sizeKb: 42 }, ...]
|
|
29
|
+
// Ask support
|
|
30
|
+
const answer = await ip.ask('how to handle captcha?');
|
|
97
31
|
```
|
|
98
32
|
|
|
99
|
-
##
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
// Use SOCKS5 protocol
|
|
103
|
-
const resp = await client.get('https://example.com', { protocol: 'socks5' });
|
|
104
|
-
|
|
105
|
-
// Get SOCKS5 proxy URL for use with other libraries
|
|
106
|
-
const proxyUrl = client.getProxyUrl({ protocol: 'socks5', country: 'US' });
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Use with Other Libraries
|
|
110
|
-
|
|
111
|
-
Get the proxy URL or agent for use with Puppeteer, Playwright, Got, etc:
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
// Get proxy URL string
|
|
115
|
-
const proxyUrl = client.getProxyUrl({ country: 'US', session: 'my-session' });
|
|
116
|
-
// → http://your-api-key:country-us:session-my-session@gateway.iploop.io:8880
|
|
117
|
-
|
|
118
|
-
// Get axios-compatible agent
|
|
119
|
-
const agent = client.getProxyAgent({ country: 'DE' });
|
|
120
|
-
|
|
121
|
-
// Use with Puppeteer
|
|
122
|
-
const browser = await puppeteer.launch({
|
|
123
|
-
args: [`--proxy-server=${client.getProxyUrl({ country: 'US' })}`],
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Chrome Fingerprinting
|
|
128
|
-
|
|
129
|
-
Every request automatically includes 14 Chrome desktop headers matched to the target country. You can also get them directly:
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
const headers = client.fingerprint('JP');
|
|
133
|
-
// Full Chrome headers with Japanese locale
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Request Statistics
|
|
137
|
-
|
|
138
|
-
```typescript
|
|
139
|
-
// After making requests...
|
|
140
|
-
console.log(client.getStats());
|
|
141
|
-
// { requests: 10, success: 9, errors: 1, totalTime: 23500, avgTime: 2350, successRate: 90.0 }
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## API Methods
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
// Check bandwidth usage
|
|
148
|
-
const usage = await client.getUsage();
|
|
149
|
-
|
|
150
|
-
// Service status
|
|
151
|
-
const status = await client.getStatus();
|
|
152
|
-
|
|
153
|
-
// Available countries
|
|
154
|
-
const countries = await client.getCountries();
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Error Handling
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import { AuthenticationError, QuotaExceededError, ProxyError, RateLimitError } from 'iploop';
|
|
161
|
-
|
|
162
|
-
try {
|
|
163
|
-
const resp = await client.get('https://example.com');
|
|
164
|
-
} catch (err) {
|
|
165
|
-
if (err instanceof AuthenticationError) {
|
|
166
|
-
console.log('Invalid API key');
|
|
167
|
-
} else if (err instanceof QuotaExceededError) {
|
|
168
|
-
console.log('Upgrade at https://iploop.io/pricing');
|
|
169
|
-
} else if (err instanceof ProxyError) {
|
|
170
|
-
console.log('Proxy connection failed');
|
|
171
|
-
} else if (err instanceof RateLimitError) {
|
|
172
|
-
console.log('Rate limited, retry after:', err.retryAfter);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
```
|
|
33
|
+
## Features
|
|
176
34
|
|
|
177
|
-
|
|
35
|
+
- **Zero dependencies** — uses Node.js built-in `http`/`https` modules
|
|
36
|
+
- **Auto-retry** with IP rotation (3 attempts by default)
|
|
37
|
+
- **Smart headers** per country (28 countries, 12 Chrome UA versions)
|
|
38
|
+
- **Sticky sessions** for multi-page scraping
|
|
39
|
+
- **Support API** — usage, status, ask
|
|
40
|
+
- **Debug mode** — `new IPLoop('KEY', { debug: true })`
|
|
178
41
|
|
|
179
|
-
|
|
180
|
-
const client = new IPLoopClient({ apiKey: 'your-key', debug: true });
|
|
181
|
-
// Logs: IPLoop: GET https://example.com → 200 (450ms) country=US session=abc123
|
|
182
|
-
```
|
|
42
|
+
## API
|
|
183
43
|
|
|
184
|
-
|
|
44
|
+
### `new IPLoop(apiKey, options?)`
|
|
45
|
+
- `apiKey` — your API key from https://iploop.io
|
|
46
|
+
- `options.country` — default country code
|
|
47
|
+
- `options.city` — default city
|
|
48
|
+
- `options.debug` — enable debug logging
|
|
185
49
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
| `country` | — | Default target country |
|
|
194
|
-
| `city` | — | Default target city |
|
|
195
|
-
| `debug` | `false` | Enable debug logging |
|
|
50
|
+
### `ip.fetch(url, options?)`
|
|
51
|
+
Returns `{ status, headers, body }`
|
|
52
|
+
- `country`, `city` — geo targeting
|
|
53
|
+
- `session` — session ID for sticky IP
|
|
54
|
+
- `headers` — custom headers (merged with smart defaults)
|
|
55
|
+
- `retries` — retry count (default: 3)
|
|
56
|
+
- `timeout` — seconds (default: 30)
|
|
196
57
|
|
|
197
|
-
|
|
58
|
+
### `ip.session(options?)`
|
|
59
|
+
Returns a `StickySession` with `.fetch()` that reuses the same IP.
|
|
198
60
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
- **Documentation**: [docs.iploop.io](https://docs.iploop.io)
|
|
61
|
+
### `ip.usage()` / `ip.status()` / `ip.ask(question)`
|
|
62
|
+
Support API endpoints.
|
|
202
63
|
|
|
203
64
|
## License
|
|
204
65
|
|
|
205
|
-
MIT
|
|
66
|
+
MIT — https://iploop.io
|
package/package.json
CHANGED
|
@@ -1,53 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iploop",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Residential proxy SDK — one-liner web fetching through millions of real IPs",
|
|
5
|
+
"main": "src/index.js",
|
|
10
6
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"prepublishOnly": "npm run build",
|
|
13
|
-
"test": "jest",
|
|
14
|
-
"lint": "eslint src/**/*.ts"
|
|
7
|
+
"test": "node -e \"const {IPLoop} = require('.'); console.log('OK');\""
|
|
15
8
|
},
|
|
16
9
|
"keywords": [
|
|
17
10
|
"proxy",
|
|
18
|
-
"residential
|
|
19
|
-
"
|
|
20
|
-
"web
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
11
|
+
"residential",
|
|
12
|
+
"scraping",
|
|
13
|
+
"web",
|
|
14
|
+
"fetch",
|
|
15
|
+
"rotating",
|
|
16
|
+
"ip"
|
|
24
17
|
],
|
|
25
|
-
"author": "IPLoop <
|
|
18
|
+
"author": "IPLoop <partners@iploop.io>",
|
|
26
19
|
"license": "MIT",
|
|
20
|
+
"homepage": "https://iploop.io",
|
|
27
21
|
"repository": {
|
|
28
22
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/iploop/
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://iploop.io",
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "https://github.com/iploop/nodejs-sdk/issues"
|
|
23
|
+
"url": "https://github.com/iploop/iploop-node-sdk"
|
|
34
24
|
},
|
|
35
25
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"axios": "^1.6.0",
|
|
40
|
-
"https-proxy-agent": "^7.0.0",
|
|
41
|
-
"socks-proxy-agent": "^8.0.0"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/node": "^20.0.0",
|
|
45
|
-
"typescript": "^5.0.0",
|
|
46
|
-
"jest": "^29.0.0",
|
|
47
|
-
"@types/jest": "^29.0.0",
|
|
48
|
-
"ts-jest": "^29.0.0",
|
|
49
|
-
"eslint": "^8.0.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
51
|
-
"@typescript-eslint/parser": "^6.0.0"
|
|
26
|
+
"node": ">=14.0.0"
|
|
52
27
|
}
|
|
53
28
|
}
|
package/src/client.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const http = require('http');
|
|
2
|
+
const https = require('https');
|
|
3
|
+
const zlib = require('zlib');
|
|
4
|
+
const { getHeaders } = require('./headers');
|
|
5
|
+
const { retryRequest, newSessionId } = require('./retry');
|
|
6
|
+
const { SupportClient } = require('./support');
|
|
7
|
+
const { StickySession } = require('./session');
|
|
8
|
+
const { AuthError, ProxyError, TimeoutError } = require('./exceptions');
|
|
9
|
+
|
|
10
|
+
class IPLoop {
|
|
11
|
+
constructor(apiKey, opts = {}) {
|
|
12
|
+
if (!apiKey) throw new AuthError('API key is required');
|
|
13
|
+
this.apiKey = apiKey;
|
|
14
|
+
this.proxyHost = 'gateway.iploop.io';
|
|
15
|
+
this.proxyPort = 8880;
|
|
16
|
+
this.apiBase = 'https://gateway.iploop.io:9443';
|
|
17
|
+
this._country = opts.country || null;
|
|
18
|
+
this._city = opts.city || null;
|
|
19
|
+
this._debug = opts.debug || false;
|
|
20
|
+
this._support = new SupportClient(apiKey, this.apiBase);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_buildAuth(opts = {}) {
|
|
24
|
+
const parts = [this.apiKey];
|
|
25
|
+
const c = opts.country || this._country;
|
|
26
|
+
if (c) parts.push(`country-${c.toLowerCase()}`);
|
|
27
|
+
const ci = opts.city || this._city;
|
|
28
|
+
if (ci) parts.push(`city-${ci.toLowerCase()}`);
|
|
29
|
+
if (opts.session) parts.push(`session-${opts.session}`);
|
|
30
|
+
return parts.join(':');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_log(...args) { if (this._debug) console.error('[IPLoop]', ...args); }
|
|
34
|
+
|
|
35
|
+
fetch(url, opts = {}) {
|
|
36
|
+
const retries = opts.retries || 3;
|
|
37
|
+
const timeout = (opts.timeout || 30) * 1000;
|
|
38
|
+
const country = opts.country || this._country || 'US';
|
|
39
|
+
const hdrs = { ...getHeaders(country), ...(opts.headers || {}) };
|
|
40
|
+
|
|
41
|
+
return retryRequest(async (attempt) => {
|
|
42
|
+
const sid = opts._noRotate ? opts.session : (opts.session || newSessionId());
|
|
43
|
+
const auth = this._buildAuth({ ...opts, session: sid });
|
|
44
|
+
const start = Date.now();
|
|
45
|
+
|
|
46
|
+
const result = await this._connectAndFetch(url, auth, hdrs, timeout);
|
|
47
|
+
const elapsed = ((Date.now() - start) / 1000).toFixed(2);
|
|
48
|
+
this._log(`GET ${url} → ${result.status} (${elapsed}s) country=${country} session=${sid}`);
|
|
49
|
+
return result;
|
|
50
|
+
}, retries);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_connectAndFetch(url, auth, headers, timeout) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const parsed = new URL(url);
|
|
56
|
+
const isHttps = parsed.protocol === 'https:';
|
|
57
|
+
const targetHost = parsed.hostname;
|
|
58
|
+
const targetPort = parsed.port || (isHttps ? 443 : 80);
|
|
59
|
+
|
|
60
|
+
const connectReq = http.request({
|
|
61
|
+
host: this.proxyHost,
|
|
62
|
+
port: this.proxyPort,
|
|
63
|
+
method: 'CONNECT',
|
|
64
|
+
path: `${targetHost}:${targetPort}`,
|
|
65
|
+
headers: {
|
|
66
|
+
'Host': `${targetHost}:${targetPort}`,
|
|
67
|
+
'Proxy-Authorization': 'Basic ' + Buffer.from(auth).toString('base64'),
|
|
68
|
+
},
|
|
69
|
+
timeout,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
connectReq.on('connect', (res, socket) => {
|
|
73
|
+
if (res.statusCode !== 200) {
|
|
74
|
+
socket.destroy();
|
|
75
|
+
return reject(new ProxyError(`CONNECT failed: ${res.statusCode}`));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const reqOpts = {
|
|
79
|
+
hostname: targetHost,
|
|
80
|
+
port: targetPort,
|
|
81
|
+
path: parsed.pathname + (parsed.search || ''),
|
|
82
|
+
method: 'GET',
|
|
83
|
+
headers: { ...headers, Host: targetHost },
|
|
84
|
+
socket,
|
|
85
|
+
agent: false,
|
|
86
|
+
timeout,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const mod = isHttps ? https : http;
|
|
90
|
+
const req = (isHttps ? mod.request({ ...reqOpts, servername: targetHost }) : mod.request(reqOpts));
|
|
91
|
+
|
|
92
|
+
req.on('response', (response) => {
|
|
93
|
+
const chunks = [];
|
|
94
|
+
const encoding = response.headers['content-encoding'];
|
|
95
|
+
let stream = response;
|
|
96
|
+
if (encoding === 'gzip') stream = response.pipe(zlib.createGunzip());
|
|
97
|
+
else if (encoding === 'deflate') stream = response.pipe(zlib.createInflate());
|
|
98
|
+
else if (encoding === 'br') stream = response.pipe(zlib.createBrotliDecompress());
|
|
99
|
+
|
|
100
|
+
stream.on('data', c => chunks.push(c));
|
|
101
|
+
stream.on('end', () => {
|
|
102
|
+
const body = Buffer.concat(chunks).toString();
|
|
103
|
+
resolve({ status: response.statusCode, headers: response.headers, body });
|
|
104
|
+
});
|
|
105
|
+
stream.on('error', reject);
|
|
106
|
+
});
|
|
107
|
+
req.on('error', e => reject(new ProxyError(`Request failed: ${e.message}`)));
|
|
108
|
+
req.on('timeout', () => { req.destroy(); reject(new TimeoutError()); });
|
|
109
|
+
req.end();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
connectReq.on('error', e => reject(new ProxyError(`CONNECT error: ${e.message}`)));
|
|
113
|
+
connectReq.on('timeout', () => { connectReq.destroy(); reject(new TimeoutError()); });
|
|
114
|
+
connectReq.end();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
session(opts = {}) {
|
|
119
|
+
return new StickySession(this, opts.sessionId || newSessionId(), opts.country, opts.city);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
usage() { return this._support.usage(); }
|
|
123
|
+
status() { return this._support.status(); }
|
|
124
|
+
ask(question) { return this._support.ask(question); }
|
|
125
|
+
countries() { return this._support.countries(); }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = { IPLoop };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class IPLoopError extends Error {
|
|
2
|
+
constructor(message) { super(message); this.name = 'IPLoopError'; }
|
|
3
|
+
}
|
|
4
|
+
class AuthError extends IPLoopError {
|
|
5
|
+
constructor(message) { super(message || 'Invalid or missing API key'); this.name = 'AuthError'; }
|
|
6
|
+
}
|
|
7
|
+
class QuotaExceeded extends IPLoopError {
|
|
8
|
+
constructor(message) { super(message || 'Quota exceeded. Upgrade at https://iploop.io/pricing'); this.name = 'QuotaExceeded'; }
|
|
9
|
+
}
|
|
10
|
+
class ProxyError extends IPLoopError {
|
|
11
|
+
constructor(message) { super(message || 'Proxy connection failed'); this.name = 'ProxyError'; }
|
|
12
|
+
}
|
|
13
|
+
class TimeoutError extends IPLoopError {
|
|
14
|
+
constructor(message) { super(message || 'Request timed out'); this.name = 'TimeoutError'; }
|
|
15
|
+
}
|
|
16
|
+
module.exports = { IPLoopError, AuthError, QuotaExceeded, ProxyError, TimeoutError };
|
package/src/headers.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const CHROME_VERSIONS = [
|
|
2
|
+
'120.0.6099.109','120.0.6099.199','121.0.6167.85','121.0.6167.160',
|
|
3
|
+
'122.0.6261.69','122.0.6261.112','123.0.6312.58','123.0.6312.105',
|
|
4
|
+
'124.0.6367.60','124.0.6367.118','125.0.6422.60','125.0.6422.113',
|
|
5
|
+
];
|
|
6
|
+
const PLATFORMS = {
|
|
7
|
+
windows: v => `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${v} Safari/537.36`,
|
|
8
|
+
mac: v => `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${v} Safari/537.36`,
|
|
9
|
+
linux: v => `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${v} Safari/537.36`,
|
|
10
|
+
};
|
|
11
|
+
const COUNTRY_PROFILES = {
|
|
12
|
+
US:['windows','en-US','en-US,en;q=0.9'],GB:['windows','en-GB','en-GB,en;q=0.9'],
|
|
13
|
+
CA:['windows','en-CA','en-CA,en;q=0.9'],AU:['windows','en-AU','en-AU,en;q=0.9'],
|
|
14
|
+
DE:['windows','de-DE','de-DE,de;q=0.9,en;q=0.8'],FR:['windows','fr-FR','fr-FR,fr;q=0.9,en;q=0.8'],
|
|
15
|
+
ES:['windows','es-ES','es-ES,es;q=0.9,en;q=0.8'],IT:['windows','it-IT','it-IT,it;q=0.9,en;q=0.8'],
|
|
16
|
+
PT:['windows','pt-PT','pt-PT,pt;q=0.9,en;q=0.8'],BR:['windows','pt-BR','pt-BR,pt;q=0.9,en;q=0.8'],
|
|
17
|
+
NL:['windows','nl-NL','nl-NL,nl;q=0.9,en;q=0.8'],PL:['windows','pl-PL','pl-PL,pl;q=0.9,en;q=0.8'],
|
|
18
|
+
RU:['windows','ru-RU','ru-RU,ru;q=0.9,en;q=0.8'],UA:['windows','uk-UA','uk-UA,uk;q=0.9,en;q=0.8'],
|
|
19
|
+
JP:['mac','ja-JP','ja-JP,ja;q=0.9,en;q=0.8'],KR:['windows','ko-KR','ko-KR,ko;q=0.9,en;q=0.8'],
|
|
20
|
+
CN:['windows','zh-CN','zh-CN,zh;q=0.9,en;q=0.8'],TW:['windows','zh-TW','zh-TW,zh;q=0.9,en;q=0.8'],
|
|
21
|
+
IN:['windows','en-IN','en-IN,en;q=0.9,hi;q=0.8'],ID:['windows','id-ID','id-ID,id;q=0.9,en;q=0.8'],
|
|
22
|
+
TH:['windows','th-TH','th-TH,th;q=0.9,en;q=0.8'],VN:['windows','vi-VN','vi-VN,vi;q=0.9,en;q=0.8'],
|
|
23
|
+
TR:['windows','tr-TR','tr-TR,tr;q=0.9,en;q=0.8'],MX:['windows','es-MX','es-MX,es;q=0.9,en;q=0.8'],
|
|
24
|
+
AR:['windows','es-AR','es-AR,es;q=0.9,en;q=0.8'],IL:['windows','he-IL','he-IL,he;q=0.9,en;q=0.8'],
|
|
25
|
+
SE:['windows','sv-SE','sv-SE,sv;q=0.9,en;q=0.8'],NO:['windows','nb-NO','nb-NO,nb;q=0.9,en;q=0.8'],
|
|
26
|
+
};
|
|
27
|
+
function randomUA(platform='windows') {
|
|
28
|
+
const v = CHROME_VERSIONS[Math.floor(Math.random()*CHROME_VERSIONS.length)];
|
|
29
|
+
return (PLATFORMS[platform]||PLATFORMS.windows)(v);
|
|
30
|
+
}
|
|
31
|
+
function getHeaders(country='US') {
|
|
32
|
+
const [platform,lang,acceptLang] = COUNTRY_PROFILES[country.toUpperCase()]||COUNTRY_PROFILES.US;
|
|
33
|
+
return {
|
|
34
|
+
'User-Agent': randomUA(platform),
|
|
35
|
+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
|
36
|
+
'Accept-Language': acceptLang,
|
|
37
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
38
|
+
'Connection': 'keep-alive',
|
|
39
|
+
'Upgrade-Insecure-Requests': '1',
|
|
40
|
+
'Sec-Fetch-Dest': 'document',
|
|
41
|
+
'Sec-Fetch-Mode': 'navigate',
|
|
42
|
+
'Sec-Fetch-Site': 'none',
|
|
43
|
+
'Sec-Fetch-User': '?1',
|
|
44
|
+
'Sec-Ch-Ua-Platform': platform==='windows'?'"Windows"':platform==='mac'?'"macOS"':'"Linux"',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
module.exports = { getHeaders, randomUA, COUNTRY_PROFILES, CHROME_VERSIONS };
|
package/src/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const { IPLoop } = require('./client');
|
|
2
|
+
const { StickySession } = require('./session');
|
|
3
|
+
const { IPLoopError, AuthError, QuotaExceeded, ProxyError, TimeoutError } = require('./exceptions');
|
|
4
|
+
|
|
5
|
+
module.exports = { IPLoop, StickySession, IPLoopError, AuthError, QuotaExceeded, ProxyError, TimeoutError };
|
package/src/retry.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const RETRYABLE_STATUS = new Set([403, 407, 429, 500, 502, 503, 504]);
|
|
3
|
+
function newSessionId() { return crypto.randomBytes(8).toString('hex'); }
|
|
4
|
+
function shouldRetry(err, statusCode) {
|
|
5
|
+
if (statusCode && RETRYABLE_STATUS.has(statusCode)) return true;
|
|
6
|
+
if (err && (err.code === 'ECONNRESET' || err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT' || err.code === 'EPIPE')) return true;
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
async function retryRequest(fn, retries = 3, delay = 1000) {
|
|
10
|
+
let lastErr;
|
|
11
|
+
for (let i = 0; i < retries; i++) {
|
|
12
|
+
try {
|
|
13
|
+
const result = await fn(i);
|
|
14
|
+
if (result && result.status && shouldRetry(null, result.status)) {
|
|
15
|
+
if (i < retries - 1) { await sleep(delay * (i + 1)); continue; }
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
lastErr = e;
|
|
20
|
+
if (shouldRetry(e) && i < retries - 1) { await sleep(delay * (i + 1)); continue; }
|
|
21
|
+
if (i === retries - 1) break;
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
throw lastErr;
|
|
26
|
+
}
|
|
27
|
+
function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
|
|
28
|
+
module.exports = { retryRequest, newSessionId, shouldRetry };
|
package/src/session.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class StickySession {
|
|
2
|
+
constructor(client, sessionId, country, city) {
|
|
3
|
+
this._client = client;
|
|
4
|
+
this.sessionId = sessionId;
|
|
5
|
+
this.country = country || client._country;
|
|
6
|
+
this.city = city || client._city;
|
|
7
|
+
}
|
|
8
|
+
fetch(url, opts = {}) {
|
|
9
|
+
return this._client.fetch(url, {
|
|
10
|
+
country: opts.country || this.country,
|
|
11
|
+
city: opts.city || this.city,
|
|
12
|
+
session: this.sessionId,
|
|
13
|
+
_noRotate: true,
|
|
14
|
+
...opts,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
module.exports = { StickySession };
|
package/src/support.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const { AuthError, QuotaExceeded } = require('./exceptions');
|
|
3
|
+
|
|
4
|
+
class SupportClient {
|
|
5
|
+
constructor(apiKey, apiBase) {
|
|
6
|
+
this.apiKey = apiKey;
|
|
7
|
+
this.apiBase = apiBase.replace(/\/+$/, '');
|
|
8
|
+
this.headers = { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
_request(method, path, body) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const url = new URL(this.apiBase + path);
|
|
14
|
+
const opts = {
|
|
15
|
+
hostname: url.hostname, port: url.port || 443, path: url.pathname,
|
|
16
|
+
method, headers: { ...this.headers }, timeout: 15000,
|
|
17
|
+
rejectUnauthorized: true,
|
|
18
|
+
};
|
|
19
|
+
if (body) {
|
|
20
|
+
const data = JSON.stringify(body);
|
|
21
|
+
opts.headers['Content-Length'] = Buffer.byteLength(data);
|
|
22
|
+
}
|
|
23
|
+
const req = https.request(opts, res => {
|
|
24
|
+
let chunks = [];
|
|
25
|
+
res.on('data', c => chunks.push(c));
|
|
26
|
+
res.on('end', () => {
|
|
27
|
+
const text = Buffer.concat(chunks).toString();
|
|
28
|
+
if (res.statusCode === 401) return reject(new AuthError());
|
|
29
|
+
if (res.statusCode >= 400) return reject(new Error(`HTTP ${res.statusCode}: ${text}`));
|
|
30
|
+
try { resolve(JSON.parse(text)); } catch { resolve(text); }
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
req.on('error', reject);
|
|
34
|
+
req.on('timeout', () => { req.destroy(); reject(new Error('Request timeout')); });
|
|
35
|
+
if (body) req.write(JSON.stringify(body));
|
|
36
|
+
req.end();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async usage() {
|
|
41
|
+
const data = await this._request('GET', '/api/support/diagnose');
|
|
42
|
+
this._checkQuota(data);
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
status() { return this._request('GET', '/api/support/status'); }
|
|
46
|
+
ask(question) { return this._request('POST', '/api/support/ask', { question }); }
|
|
47
|
+
countries() { return this._request('GET', '/api/support/countries'); }
|
|
48
|
+
|
|
49
|
+
_checkQuota(data) {
|
|
50
|
+
try {
|
|
51
|
+
const used = data.used_gb || 0;
|
|
52
|
+
const total = used + (data.remaining_gb || 999);
|
|
53
|
+
if (total > 0) {
|
|
54
|
+
const pct = used / total * 100;
|
|
55
|
+
if (pct >= 100) throw new QuotaExceeded();
|
|
56
|
+
if (pct >= 80) process.stderr.write(`⚠️ IPLoop: ${pct.toFixed(0)}% bandwidth used. Upgrade at https://iploop.io/pricing\n`);
|
|
57
|
+
}
|
|
58
|
+
} catch (e) { if (e instanceof QuotaExceeded) throw e; }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
module.exports = { SupportClient };
|
package/dist/index.d.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IPLoop Node.js SDK
|
|
3
|
-
* Official SDK for IPLoop residential proxy service
|
|
4
|
-
* https://iploop.io
|
|
5
|
-
*/
|
|
6
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
7
|
-
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
8
|
-
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
9
|
-
export interface IPLoopConfig {
|
|
10
|
-
/** Your IPLoop API key */
|
|
11
|
-
apiKey: string;
|
|
12
|
-
/** Proxy gateway hostname (default: gateway.iploop.io) */
|
|
13
|
-
proxyHost?: string;
|
|
14
|
-
/** HTTP proxy port (default: 8880) */
|
|
15
|
-
httpPort?: number;
|
|
16
|
-
/** SOCKS5 proxy port (default: 1080) */
|
|
17
|
-
socksPort?: number;
|
|
18
|
-
/** Management API URL (default: https://gateway.iploop.io:9443) */
|
|
19
|
-
apiUrl?: string;
|
|
20
|
-
/** Default request timeout in ms (default: 30000) */
|
|
21
|
-
timeout?: number;
|
|
22
|
-
/** Default target country code */
|
|
23
|
-
country?: string;
|
|
24
|
-
/** Default target city */
|
|
25
|
-
city?: string;
|
|
26
|
-
/** Enable debug logging */
|
|
27
|
-
debug?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface ProxyOptions {
|
|
30
|
-
/** Target country code (e.g. "US", "DE", "JP") */
|
|
31
|
-
country?: string;
|
|
32
|
-
/** Target city (e.g. "miami", "london") */
|
|
33
|
-
city?: string;
|
|
34
|
-
/** Session ID for sticky sessions (same IP across requests) */
|
|
35
|
-
session?: string;
|
|
36
|
-
/** Proxy protocol (default: "http") */
|
|
37
|
-
protocol?: 'http' | 'socks5';
|
|
38
|
-
/** Enable JavaScript rendering */
|
|
39
|
-
render?: boolean;
|
|
40
|
-
}
|
|
41
|
-
export interface FetchResult {
|
|
42
|
-
url: string;
|
|
43
|
-
status: number;
|
|
44
|
-
success: boolean;
|
|
45
|
-
sizeKb: number;
|
|
46
|
-
error?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface UsageSummary {
|
|
49
|
-
totalBytes: number;
|
|
50
|
-
totalRequests: number;
|
|
51
|
-
planLimitBytes: number;
|
|
52
|
-
usagePercent: number;
|
|
53
|
-
estimatedCost: number;
|
|
54
|
-
}
|
|
55
|
-
export interface DailyUsage {
|
|
56
|
-
date: string;
|
|
57
|
-
bytesTransferred: number;
|
|
58
|
-
requestCount: number;
|
|
59
|
-
successRate: number;
|
|
60
|
-
}
|
|
61
|
-
export declare class IPLoopError extends Error {
|
|
62
|
-
statusCode?: number | undefined;
|
|
63
|
-
response?: any | undefined;
|
|
64
|
-
constructor(message: string, statusCode?: number | undefined, response?: any | undefined);
|
|
65
|
-
}
|
|
66
|
-
export declare class AuthenticationError extends IPLoopError {
|
|
67
|
-
constructor(message?: string);
|
|
68
|
-
}
|
|
69
|
-
export declare class RateLimitError extends IPLoopError {
|
|
70
|
-
retryAfter?: number | undefined;
|
|
71
|
-
constructor(message?: string, retryAfter?: number | undefined);
|
|
72
|
-
}
|
|
73
|
-
export declare class QuotaExceededError extends IPLoopError {
|
|
74
|
-
constructor(message?: string);
|
|
75
|
-
}
|
|
76
|
-
export declare class ProxyError extends IPLoopError {
|
|
77
|
-
constructor(message?: string);
|
|
78
|
-
}
|
|
79
|
-
export declare class StickySession {
|
|
80
|
-
private readonly client;
|
|
81
|
-
readonly sessionId: string;
|
|
82
|
-
readonly country?: string;
|
|
83
|
-
readonly city?: string;
|
|
84
|
-
constructor(client: IPLoopClient, sessionId: string, country?: string, city?: string);
|
|
85
|
-
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
86
|
-
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
87
|
-
}
|
|
88
|
-
export declare class IPLoopClient {
|
|
89
|
-
private readonly apiKey;
|
|
90
|
-
private readonly proxyHost;
|
|
91
|
-
private readonly httpPort;
|
|
92
|
-
private readonly socksPort;
|
|
93
|
-
private readonly apiUrl;
|
|
94
|
-
private readonly timeout;
|
|
95
|
-
private readonly defaultCountry?;
|
|
96
|
-
private readonly defaultCity?;
|
|
97
|
-
private readonly debug;
|
|
98
|
-
private readonly apiClient;
|
|
99
|
-
private stats;
|
|
100
|
-
constructor(config: IPLoopConfig);
|
|
101
|
-
private buildAuth;
|
|
102
|
-
/**
|
|
103
|
-
* Get proxy URL for use with other HTTP libraries (e.g. puppeteer, playwright, got).
|
|
104
|
-
*/
|
|
105
|
-
getProxyUrl(options?: ProxyOptions): string;
|
|
106
|
-
/**
|
|
107
|
-
* Get an HTTP/SOCKS agent for use with axios or other libraries.
|
|
108
|
-
*/
|
|
109
|
-
getProxyAgent(options?: ProxyOptions): HttpsProxyAgent<string> | SocksProxyAgent;
|
|
110
|
-
/**
|
|
111
|
-
* Fetch a URL through the residential proxy with auto-retry and smart headers.
|
|
112
|
-
*/
|
|
113
|
-
fetch<T = any>(url: string, options?: ProxyOptions, config?: AxiosRequestConfig, retries?: number): Promise<AxiosResponse<T>>;
|
|
114
|
-
/** GET request through proxy. */
|
|
115
|
-
get<T = any>(url: string, options?: ProxyOptions, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
116
|
-
/** POST request through proxy. */
|
|
117
|
-
post<T = any>(url: string, data?: any, options?: ProxyOptions, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
118
|
-
/** PUT request through proxy. */
|
|
119
|
-
put<T = any>(url: string, data?: any, options?: ProxyOptions, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
120
|
-
/** DELETE request through proxy. */
|
|
121
|
-
delete<T = any>(url: string, options?: ProxyOptions, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
122
|
-
/**
|
|
123
|
-
* Create a sticky session — all requests reuse the same proxy IP.
|
|
124
|
-
*/
|
|
125
|
-
session(sessionId?: string, country?: string, city?: string): StickySession;
|
|
126
|
-
/**
|
|
127
|
-
* Fetch multiple URLs concurrently through the proxy.
|
|
128
|
-
*/
|
|
129
|
-
fetchAll(urls: string[], options?: ProxyOptions, concurrency?: number): Promise<FetchResult[]>;
|
|
130
|
-
/**
|
|
131
|
-
* Get request statistics.
|
|
132
|
-
*/
|
|
133
|
-
getStats(): {
|
|
134
|
-
avgTime: number;
|
|
135
|
-
successRate: number;
|
|
136
|
-
requests: number;
|
|
137
|
-
success: number;
|
|
138
|
-
errors: number;
|
|
139
|
-
totalTime: number;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Get Chrome desktop fingerprint headers for a country.
|
|
143
|
-
*/
|
|
144
|
-
fingerprint(country?: string): Record<string, string>;
|
|
145
|
-
/** Check bandwidth usage and quota. */
|
|
146
|
-
getUsage(): Promise<UsageSummary>;
|
|
147
|
-
/** Check service status. */
|
|
148
|
-
getStatus(): Promise<any>;
|
|
149
|
-
/** List available proxy countries. */
|
|
150
|
-
getCountries(): Promise<any>;
|
|
151
|
-
}
|
|
152
|
-
declare const SDK_VERSION = "1.0.1";
|
|
153
|
-
export { SDK_VERSION };
|
|
154
|
-
export default IPLoopClient;
|
|
155
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAc,EAAiB,kBAAkB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,WAAW,YAAY;IAC3B,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAA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importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.SDK_VERSION = exports.IPLoopClient = exports.StickySession = exports.ProxyError = exports.QuotaExceededError = exports.RateLimitError = exports.AuthenticationError = exports.IPLoopError = void 0;
|
|
12
|
-
const axios_1 = __importDefault(require("axios"));
|
|
13
|
-
const socks_proxy_agent_1 = require("socks-proxy-agent");
|
|
14
|
-
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
15
|
-
const crypto_1 = require("crypto");
|
|
16
|
-
// ── Errors ───────────────────────────────────────────────────
|
|
17
|
-
class IPLoopError extends Error {
|
|
18
|
-
constructor(message, statusCode, response) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.statusCode = statusCode;
|
|
21
|
-
this.response = response;
|
|
22
|
-
this.name = 'IPLoopError';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.IPLoopError = IPLoopError;
|
|
26
|
-
class AuthenticationError extends IPLoopError {
|
|
27
|
-
constructor(message = 'Invalid API key') {
|
|
28
|
-
super(message, 401);
|
|
29
|
-
this.name = 'AuthenticationError';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.AuthenticationError = AuthenticationError;
|
|
33
|
-
class RateLimitError extends IPLoopError {
|
|
34
|
-
constructor(message = 'Rate limit exceeded', retryAfter) {
|
|
35
|
-
super(message, 429);
|
|
36
|
-
this.retryAfter = retryAfter;
|
|
37
|
-
this.name = 'RateLimitError';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.RateLimitError = RateLimitError;
|
|
41
|
-
class QuotaExceededError extends IPLoopError {
|
|
42
|
-
constructor(message = 'Quota exceeded. Upgrade at https://iploop.io/pricing') {
|
|
43
|
-
super(message, 402);
|
|
44
|
-
this.name = 'QuotaExceededError';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.QuotaExceededError = QuotaExceededError;
|
|
48
|
-
class ProxyError extends IPLoopError {
|
|
49
|
-
constructor(message = 'Proxy connection failed') {
|
|
50
|
-
super(message);
|
|
51
|
-
this.name = 'ProxyError';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.ProxyError = ProxyError;
|
|
55
|
-
// ── Sticky Session ───────────────────────────────────────────
|
|
56
|
-
class StickySession {
|
|
57
|
-
constructor(client, sessionId, country, city) {
|
|
58
|
-
this.client = client;
|
|
59
|
-
this.sessionId = sessionId;
|
|
60
|
-
this.country = country;
|
|
61
|
-
this.city = city;
|
|
62
|
-
}
|
|
63
|
-
async get(url, config) {
|
|
64
|
-
return this.client.get(url, { country: this.country, city: this.city, session: this.sessionId }, config);
|
|
65
|
-
}
|
|
66
|
-
async post(url, data, config) {
|
|
67
|
-
return this.client.post(url, data, { country: this.country, city: this.city, session: this.sessionId }, config);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.StickySession = StickySession;
|
|
71
|
-
// ── Chrome Fingerprint ───────────────────────────────────────
|
|
72
|
-
const CHROME_VERSIONS = ['120.0.0.0', '121.0.0.0', '122.0.0.0', '123.0.0.0', '124.0.0.0', '125.0.0.0', '126.0.0.0'];
|
|
73
|
-
const LANG_MAP = {
|
|
74
|
-
US: 'en-US,en;q=0.9', GB: 'en-GB,en;q=0.9', DE: 'de-DE,de;q=0.9,en;q=0.8',
|
|
75
|
-
FR: 'fr-FR,fr;q=0.9,en;q=0.8', JP: 'ja-JP,ja;q=0.9,en;q=0.8', BR: 'pt-BR,pt;q=0.9,en;q=0.8',
|
|
76
|
-
KR: 'ko-KR,ko;q=0.9,en;q=0.8', IN: 'en-IN,en;q=0.9,hi;q=0.8', ES: 'es-ES,es;q=0.9,en;q=0.8',
|
|
77
|
-
IT: 'it-IT,it;q=0.9,en;q=0.8', NL: 'nl-NL,nl;q=0.9,en;q=0.8', AU: 'en-AU,en;q=0.9',
|
|
78
|
-
};
|
|
79
|
-
function chromeFingerprint(country = 'US') {
|
|
80
|
-
const ver = CHROME_VERSIONS[Math.floor(Math.random() * CHROME_VERSIONS.length)];
|
|
81
|
-
const major = ver.split('.')[0];
|
|
82
|
-
const lang = LANG_MAP[country.toUpperCase()] || 'en-US,en;q=0.9';
|
|
83
|
-
return {
|
|
84
|
-
'User-Agent': `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ver} Safari/537.36`,
|
|
85
|
-
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
|
86
|
-
'Accept-Language': lang,
|
|
87
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
88
|
-
'Connection': 'keep-alive',
|
|
89
|
-
'Upgrade-Insecure-Requests': '1',
|
|
90
|
-
'Sec-Fetch-Dest': 'document',
|
|
91
|
-
'Sec-Fetch-Mode': 'navigate',
|
|
92
|
-
'Sec-Fetch-Site': 'none',
|
|
93
|
-
'Sec-Fetch-User': '?1',
|
|
94
|
-
'Sec-Ch-Ua': `"Chromium";v="${major}", "Google Chrome";v="${major}", "Not-A.Brand";v="99"`,
|
|
95
|
-
'Sec-Ch-Ua-Mobile': '?0',
|
|
96
|
-
'Sec-Ch-Ua-Platform': '"Windows"',
|
|
97
|
-
'Cache-Control': 'max-age=0',
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
// ── Retryable statuses ───────────────────────────────────────
|
|
101
|
-
const RETRYABLE_STATUSES = new Set([403, 407, 429, 500, 502, 503, 504]);
|
|
102
|
-
function newSessionId() {
|
|
103
|
-
return (0, crypto_1.randomUUID)().replace(/-/g, '').slice(0, 16);
|
|
104
|
-
}
|
|
105
|
-
function sleep(ms) {
|
|
106
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
107
|
-
}
|
|
108
|
-
// ── Main Client ──────────────────────────────────────────────
|
|
109
|
-
class IPLoopClient {
|
|
110
|
-
constructor(config) {
|
|
111
|
-
this.stats = { requests: 0, success: 0, errors: 0, totalTime: 0 };
|
|
112
|
-
if (!config.apiKey)
|
|
113
|
-
throw new AuthenticationError('API key is required');
|
|
114
|
-
this.apiKey = config.apiKey;
|
|
115
|
-
this.proxyHost = config.proxyHost || 'gateway.iploop.io';
|
|
116
|
-
this.httpPort = config.httpPort || 8880;
|
|
117
|
-
this.socksPort = config.socksPort || 1080;
|
|
118
|
-
this.apiUrl = config.apiUrl || 'https://gateway.iploop.io:9443';
|
|
119
|
-
this.timeout = config.timeout || 30000;
|
|
120
|
-
this.defaultCountry = config.country;
|
|
121
|
-
this.defaultCity = config.city;
|
|
122
|
-
this.debug = config.debug || false;
|
|
123
|
-
this.apiClient = axios_1.default.create({
|
|
124
|
-
baseURL: this.apiUrl,
|
|
125
|
-
timeout: this.timeout,
|
|
126
|
-
headers: {
|
|
127
|
-
'Authorization': `Bearer ${this.apiKey}`,
|
|
128
|
-
'Content-Type': 'application/json',
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
// ── Proxy URL & Auth ────────────────────────────────────
|
|
133
|
-
buildAuth(options = {}) {
|
|
134
|
-
const parts = [this.apiKey];
|
|
135
|
-
const country = options.country || this.defaultCountry;
|
|
136
|
-
const city = options.city || this.defaultCity;
|
|
137
|
-
if (country)
|
|
138
|
-
parts.push(`country-${country.toLowerCase()}`);
|
|
139
|
-
if (city)
|
|
140
|
-
parts.push(`city-${city.toLowerCase()}`);
|
|
141
|
-
if (options.session)
|
|
142
|
-
parts.push(`session-${options.session}`);
|
|
143
|
-
if (options.render)
|
|
144
|
-
parts.push('render-1');
|
|
145
|
-
return parts.join(':');
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get proxy URL for use with other HTTP libraries (e.g. puppeteer, playwright, got).
|
|
149
|
-
*/
|
|
150
|
-
getProxyUrl(options = {}) {
|
|
151
|
-
const auth = this.buildAuth(options);
|
|
152
|
-
if (options.protocol === 'socks5') {
|
|
153
|
-
return `socks5://${auth}@${this.proxyHost}:${this.socksPort}`;
|
|
154
|
-
}
|
|
155
|
-
return `http://${auth}@${this.proxyHost}:${this.httpPort}`;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Get an HTTP/SOCKS agent for use with axios or other libraries.
|
|
159
|
-
*/
|
|
160
|
-
getProxyAgent(options = {}) {
|
|
161
|
-
const url = this.getProxyUrl(options);
|
|
162
|
-
if (options.protocol === 'socks5')
|
|
163
|
-
return new socks_proxy_agent_1.SocksProxyAgent(url);
|
|
164
|
-
return new https_proxy_agent_1.HttpsProxyAgent(url);
|
|
165
|
-
}
|
|
166
|
-
// ── Request Methods ─────────────────────────────────────
|
|
167
|
-
/**
|
|
168
|
-
* Fetch a URL through the residential proxy with auto-retry and smart headers.
|
|
169
|
-
*/
|
|
170
|
-
async fetch(url, options = {}, config = {}, retries = 3) {
|
|
171
|
-
const country = options.country || this.defaultCountry || 'US';
|
|
172
|
-
const headers = { ...chromeFingerprint(country), ...config.headers };
|
|
173
|
-
const agent = this.getProxyAgent(options);
|
|
174
|
-
this.stats.requests++;
|
|
175
|
-
const start = Date.now();
|
|
176
|
-
let lastError;
|
|
177
|
-
for (let attempt = 0; attempt < retries; attempt++) {
|
|
178
|
-
const sid = options.session || newSessionId();
|
|
179
|
-
const proxyOpts = { ...options, session: sid };
|
|
180
|
-
const proxyAgent = options.session ? agent : this.getProxyAgent(proxyOpts);
|
|
181
|
-
try {
|
|
182
|
-
const resp = await (0, axios_1.default)({
|
|
183
|
-
method: config.method || 'GET',
|
|
184
|
-
url,
|
|
185
|
-
...config,
|
|
186
|
-
headers,
|
|
187
|
-
httpsAgent: proxyAgent,
|
|
188
|
-
httpAgent: proxyAgent,
|
|
189
|
-
timeout: this.timeout,
|
|
190
|
-
});
|
|
191
|
-
const elapsed = Date.now() - start;
|
|
192
|
-
if (this.debug) {
|
|
193
|
-
console.log(`IPLoop: ${config.method || 'GET'} ${url} → ${resp.status} (${elapsed}ms) country=${country} session=${sid}`);
|
|
194
|
-
}
|
|
195
|
-
if (RETRYABLE_STATUSES.has(resp.status) && attempt < retries - 1) {
|
|
196
|
-
await sleep(1000 * (attempt + 1));
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
this.stats.success++;
|
|
200
|
-
this.stats.totalTime += elapsed;
|
|
201
|
-
return resp;
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
lastError = err;
|
|
205
|
-
if (attempt < retries - 1) {
|
|
206
|
-
await sleep(1000 * (attempt + 1));
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
this.stats.errors++;
|
|
211
|
-
this.stats.totalTime += Date.now() - start;
|
|
212
|
-
if (lastError?.message?.includes('timeout')) {
|
|
213
|
-
throw new IPLoopError(`All ${retries} retries timed out for ${url}`);
|
|
214
|
-
}
|
|
215
|
-
throw new ProxyError(`Proxy connection failed after ${retries} retries: ${lastError?.message}`);
|
|
216
|
-
}
|
|
217
|
-
/** GET request through proxy. */
|
|
218
|
-
async get(url, options = {}, config = {}) {
|
|
219
|
-
return this.fetch(url, options, { ...config, method: 'GET' });
|
|
220
|
-
}
|
|
221
|
-
/** POST request through proxy. */
|
|
222
|
-
async post(url, data, options = {}, config = {}) {
|
|
223
|
-
return this.fetch(url, options, { ...config, method: 'POST', data });
|
|
224
|
-
}
|
|
225
|
-
/** PUT request through proxy. */
|
|
226
|
-
async put(url, data, options = {}, config = {}) {
|
|
227
|
-
return this.fetch(url, options, { ...config, method: 'PUT', data });
|
|
228
|
-
}
|
|
229
|
-
/** DELETE request through proxy. */
|
|
230
|
-
async delete(url, options = {}, config = {}) {
|
|
231
|
-
return this.fetch(url, options, { ...config, method: 'DELETE' });
|
|
232
|
-
}
|
|
233
|
-
// ── Sticky Sessions ─────────────────────────────────────
|
|
234
|
-
/**
|
|
235
|
-
* Create a sticky session — all requests reuse the same proxy IP.
|
|
236
|
-
*/
|
|
237
|
-
session(sessionId, country, city) {
|
|
238
|
-
return new StickySession(this, sessionId || newSessionId(), country || this.defaultCountry, city || this.defaultCity);
|
|
239
|
-
}
|
|
240
|
-
// ── Batch / Concurrent ─────────────────────────────────
|
|
241
|
-
/**
|
|
242
|
-
* Fetch multiple URLs concurrently through the proxy.
|
|
243
|
-
*/
|
|
244
|
-
async fetchAll(urls, options = {}, concurrency = 10) {
|
|
245
|
-
const results = [];
|
|
246
|
-
const queue = [...urls];
|
|
247
|
-
const worker = async () => {
|
|
248
|
-
while (queue.length > 0) {
|
|
249
|
-
const url = queue.shift();
|
|
250
|
-
try {
|
|
251
|
-
const resp = await this.get(url, options);
|
|
252
|
-
results.push({ url, status: resp.status, success: true, sizeKb: Math.round(JSON.stringify(resp.data).length / 1024) });
|
|
253
|
-
}
|
|
254
|
-
catch (err) {
|
|
255
|
-
results.push({ url, status: 0, success: false, sizeKb: 0, error: err.message });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
await Promise.all(Array.from({ length: Math.min(concurrency, urls.length) }, () => worker()));
|
|
260
|
-
return results;
|
|
261
|
-
}
|
|
262
|
-
// ── Stats ───────────────────────────────────────────────
|
|
263
|
-
/**
|
|
264
|
-
* Get request statistics.
|
|
265
|
-
*/
|
|
266
|
-
getStats() {
|
|
267
|
-
const avg = this.stats.requests > 0 ? this.stats.totalTime / this.stats.requests : 0;
|
|
268
|
-
const rate = this.stats.requests > 0 ? (this.stats.success / this.stats.requests) * 100 : 0;
|
|
269
|
-
return { ...this.stats, avgTime: Math.round(avg), successRate: Math.round(rate * 10) / 10 };
|
|
270
|
-
}
|
|
271
|
-
// ── Chrome Fingerprint ──────────────────────────────────
|
|
272
|
-
/**
|
|
273
|
-
* Get Chrome desktop fingerprint headers for a country.
|
|
274
|
-
*/
|
|
275
|
-
fingerprint(country = 'US') {
|
|
276
|
-
return chromeFingerprint(country);
|
|
277
|
-
}
|
|
278
|
-
// ── API Methods ─────────────────────────────────────────
|
|
279
|
-
/** Check bandwidth usage and quota. */
|
|
280
|
-
async getUsage() {
|
|
281
|
-
const resp = await this.apiClient.get('/api/support/diagnose');
|
|
282
|
-
return resp.data;
|
|
283
|
-
}
|
|
284
|
-
/** Check service status. */
|
|
285
|
-
async getStatus() {
|
|
286
|
-
const resp = await this.apiClient.get('/api/support/status');
|
|
287
|
-
return resp.data;
|
|
288
|
-
}
|
|
289
|
-
/** List available proxy countries. */
|
|
290
|
-
async getCountries() {
|
|
291
|
-
const resp = await this.apiClient.get('/api/support/countries');
|
|
292
|
-
return resp.data;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
exports.IPLoopClient = IPLoopClient;
|
|
296
|
-
// ── Version Check ────────────────────────────────────────────
|
|
297
|
-
const SDK_VERSION = '1.0.1';
|
|
298
|
-
exports.SDK_VERSION = SDK_VERSION;
|
|
299
|
-
function checkVersion() {
|
|
300
|
-
try {
|
|
301
|
-
const https = require('https');
|
|
302
|
-
https.get('https://registry.npmjs.org/iploop/latest', { timeout: 3000 }, (res) => {
|
|
303
|
-
let data = '';
|
|
304
|
-
res.on('data', (chunk) => { data += chunk; });
|
|
305
|
-
res.on('end', () => {
|
|
306
|
-
try {
|
|
307
|
-
const latest = JSON.parse(data).version;
|
|
308
|
-
if (latest && latest !== SDK_VERSION) {
|
|
309
|
-
console.warn(`\n⚠️ IPLoop v${latest} available (you have ${SDK_VERSION}). Run: npm update iploop\n`);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
catch { }
|
|
313
|
-
});
|
|
314
|
-
}).on('error', () => { });
|
|
315
|
-
}
|
|
316
|
-
catch { }
|
|
317
|
-
}
|
|
318
|
-
checkVersion();
|
|
319
|
-
exports.default = IPLoopClient;
|
|
320
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAAgF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