()
| 76 | |
| 77 | // Example with HTTPS |
| 78 | async function httpsWithSocks5Example () { |
| 79 | console.log('\n=== HTTPS with SOCKS5 Proxy Example ===') |
| 80 | |
| 81 | try { |
| 82 | const socks5Proxy = new Socks5Agent('socks5://localhost:1080') |
| 83 | |
| 84 | const response = await request('https://httpbin.org/ip', { |
| 85 | dispatcher: socks5Proxy |
| 86 | }) |
| 87 | |
| 88 | console.log('Status:', response.statusCode) |
| 89 | const body = await response.body.json() |
| 90 | console.log('HTTPS Response:', body) |
| 91 | |
| 92 | await socks5Proxy.close() |
| 93 | } catch (error) { |
| 94 | console.error('Error:', error.message) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | // Example with connection pooling |
| 99 | async function connectionPoolingExample () { |
no test coverage detected