UNPKG

request-pool

Version:

An intelligent proxy and request manager.

47 lines 1.08 kB
declare var request: any; declare var cheerio: any; interface IServerState { alive: boolean; total: number; fail: number; last: number; } interface IRequestCallback { (err: any, res: any, body: string): void; } interface IRequest { url: string; callback: IRequestCallback; } interface IInitCallback { (Handler: IHandler): any; } interface IHandler { Get: IGetHandler; AddProxy: IAddProxyHandler; AutoGetProxy: IAutoGetProxyHandler; } interface IGetHandler { (url: string, callback: IRequestCallback): void; } interface IAutoGetProxyHandler { (): void; } interface IAddProxyHandler { (address: string): void; } declare class RequestPool { private ServerTimeout; private ServerInterval; private ServerList; private ServerState; private ServerAvailable; private ServerUsed; private ServerToCheck; private RequestQueue; private HighPriorityQueue; private Handler; constructor(); Init(callback: IInitCallback): void; } export=RequestPool;