1.1.2 • Published 3 years ago
proxy-manager-client v1.1.2
Example usage
import got from 'got'
import * as tunnel from 'tunnel'
import { ProxyClient } from 'proxy-manager-client'
const proxies = new ProxyClient('http://secret-address.com')
;(async() => {
const proxy = await proxies.get('icanhazip', true)
try {
const someRequest = await got('https://icanhazip.com', {
agent: {
https: tunnel.httpsOverHttp({
proxy: proxy.connectionDetails
})
}
})
} catch (e: Exception) {
// backend might send HTTP 429 (Too Many Requests) or similar error, in that case, mark the proxy as banned
await proxies.ban(proxy)
}
})()