windscribe-proxy-sdk
Version:
Unofficial Windscribe proxy SDK with custom SNI support, bulk testing, and session management for Node.js
240 lines (188 loc) โข 6.18 kB
Markdown
# Windscribe SDK Examples
This directory contains practical usage examples for the Windscribe Proxy SDK, featuring both functional and object-oriented approaches.
## Available Examples
### 1. Login (login.js)
Initial authentication and session creation:
- ๐ Login with username/password
- ๐พ Save session to session.json
- โ
Prepare for subsequent operations
```bash
node examples/login.js
```
### 2. Load and Test All (testproxy.js)
Complete proxy testing using saved session:
- ๐ Load existing session from session.json
- ๐ค Display account information (username, traffic usage)
- ๐ Automatic server list fetching
- ๐งช Testing all available proxy servers
```bash
node examples/testproxy.js
```
### 3. Custom Request (customreq.js)
Advanced proxy request with customizable SNI:
- ๐ง Custom SNI implementation for enhanced privacy
- ๐ IP address verification
- โก Latency measurement
- ๐ Protocol information
```bash
node examples/customreq.js
```
### 4. Advanced Monitoring (monitoring.js)
Real-time connection monitoring with health checks:
- ๐ Continuous connection monitoring
- ๐ Health check automation
- ๐ Real-time latency tracking
- ๐ Auto-reconnect demonstration
- ๐ฑ Event-driven notifications
```bash
node examples/monitoring.js
```
### 5. Load Balancing (loadbalance.js)
Smart request distribution across multiple servers:
- โ๏ธ Load balancing with round-robin strategy
- ๐ Automatic failover handling
- ๐ Performance comparison
- ๐ฏ Best server selection
- ๐ Success rate tracking
```bash
node examples/loadbalance.js
```
### 6. Server Discovery (discovery.js)
Intelligent server selection and optimization:
- ๐ Find best servers by location
- ๐ Performance-based filtering
- ๐ Geographic optimization
- โก Latency-based ranking
- ๐พ Smart caching
```bash
node examples/discovery.js
```
## Quick Setup
### Step 1: Update credentials in login.js
```javascript
const USERNAME = 'your_username';
const PASSWORD = 'your_password';
```
### Step 2: Login and save session
```bash
node examples/login.js
```
### Step 3: Test custom proxy with SNI
```bash
node examples/customreq.js
```
### Step 4: (Optional) Test all servers using saved session
```bash
node examples/testproxy.js
```
### Step 5: (Optional) Try advanced monitoring
```bash
node examples/monitoring.js
```
### Step 6: (Optional) Test load balancing
```bash
node examples/loadbalance.js
```
### Step 7: (Optional) Try server discovery
```bash
node examples/discovery.js
```
## Example Output
### Login:
```
// examples/login.js
๐ Logging in...
โ
Login successful! Session saved to session.json
๐ค Welcome: WS_1234567890
๐ Traffic: 833.55 KB/10.00 GB
๐ Available servers: 42
Now you can run other examples!
```
### Test All Proxies:
```
// examples/testproxy.js
๐ Loading existing session...
๐ค Proxy User: WS_1234567890
๐ Traffic: 833.55 KB/10.00 GB
๐ Testing 42 proxies...
โ
Canada Toronto (ca-toronto-003.whiskergalaxy.com) - IP: 142.44.133.45 (234ms)
โ
US East (us-east-026.whiskergalaxy.com) - IP: 198.7.58.232 (156ms)
โ UK London (uk-london-018.whiskergalaxy.com) - Proxy error: timeout
๐ Results: 38/42 servers working (90.5% success rate)
```
### Custom SNI & Custom Request:
```
// examples/customreq.js
๐ง Testing with custom SNI...
โ
Connection successful!
๐ Your IP: 142.44.133.45
โก Latency: 234ms
๐ Protocol: HTTPS with SNI: www.google.com
๐ Location: Toronto, Canada
```
### Advanced Monitoring:
```
// examples/monitoring.js
๐ Starting WindscribeSDK with monitoring...
โ
Session created for: WS_1234567890
๐ Starting connection monitoring...
๐ Health Check: โ
Healthy (187ms)
๐ Health Check: โ
Healthy (201ms)
๐ Health Check: โ ๏ธ Slow (456ms)
๐ Health Check: โ
Healthy (198ms)
๐ Monitoring completed:
- Average latency: 210ms
- Success rate: 100%
- Packet loss: 0%
```
### Load Balancing:
```
// examples/loadbalance.js
โ๏ธ Testing load balancing...
๐ Distributing 10 requests across 3 servers...
๐ Load Balance Results:
- us-east-001: 4 requests (avg: 156ms)
- us-west-001: 3 requests (avg: 203ms)
- ca-toronto-001: 3 requests (avg: 234ms)
โ
Overall success rate: 100%
๐ Best server: us-east-001 (156ms avg)
```
### Server Discovery:
```
// examples/discovery.js
๐ Discovering best servers...
๐ Searching for US servers with <300ms latency...
๐ Top 5 servers found:
1. us-east-001.whiskergalaxy.com (156ms) โญ
2. us-central-012.whiskergalaxy.com (187ms)
3. us-west-005.whiskergalaxy.com (203ms)
4. us-east-026.whiskergalaxy.com (234ms)
5. us-west-018.whiskergalaxy.com (267ms)
๐พ Results cached for 10 minutes
```
## Usage Patterns
### Functional API (Simple)
```javascript
const { session, testProxy } = require('windscribe-proxy-sdk');
await session('user', 'pass');
const result = await testProxy('proxy.windscribe.com');
```
### OOP API (Advanced)
```javascript
const { WindscribeSDK } = require('windscribe-proxy-sdk');
const sdk = new WindscribeSDK({ autoReconnect: true });
sdk.on('proxy_connected', (data) => console.log('Connected!', data));
await sdk.session('user', 'pass');
const servers = await sdk.findBestServers({ country: 'US' });
```
## Notes
- ๐พ Session data is automatically saved to `session.json`
- ๐ง `www.google.com` is the most effective custom SNI option
- โก First login may take longer due to authentication
- ๐ Proxy list is dynamically fetched from Windscribe servers
- ๐ Always run `login.js` first to create `session.json`
- ๐งช Use `customreq.js` for testing custom proxy configurations
- ๐ Advanced examples demonstrate OOP API with event handling
- ๐ Monitoring examples show real-time connection tracking
- โ๏ธ Load balancing examples demonstrate smart request distribution
- ๐ Discovery examples show intelligent server selection