UNPKG

@0xtld/tair-node

Version:

A Node.js package for Tair functionality with configuration, core, and helper modules.

28 lines (27 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const urban_proxy_1 = require("./core/urban-proxy"); async function testUrbanProxy() { const urbanProxy = new urban_proxy_1.UrbanProxy(); console.log('Now:', Date.now()); try { console.log('Fetching proxy list...'); const proxyList = await urbanProxy.getProxyList(); console.log('Proxy list fetched:', proxyList.length); console.log('Fetching a proxy...'); const proxy = await urbanProxy.getProxy(); console.log('Proxy fetched:', proxy); if (!proxy) { throw new Error('Proxy not found'); } const remainingTime = proxy.expiration_time - Date.now(); console.log('Remaining time:', remainingTime); console.log('Fetching IP using the proxy...'); const ip = await urbanProxy.getIp(proxy); console.log('IP fetched:', ip); } catch (error) { console.error('Error during testing:', error); } } testUrbanProxy();