agent-pool
Version:
Agent pool that rotates keepalive agents for traffic switching via DNS
35 lines (27 loc) • 727 B
TypeScript
import { AgentStatus } from 'agentkeepalive'
import { AgentOptions, Agent } from 'http';
type LogFn = (message?: any, ...optional: any[]) => void;
interface Logger {
info: LogFn;
warn: LogFn;
error: LogFn;
debug: LogFn;
}
export interface AgentPoolOptions {
agentType?: Agent;
maxAgents?: number;
destroyTime?: number;
logger?: Logger;
}
declare class AgentPool {
constructor(options? : AgentPoolOptions, agentOptions?: AgentOptions) {}
/**
* Get active agent from the pool
*/
getAgent(): Agent;
/**
* Get the stats for the pool at any given point of time
*/
stats(): AgentStatus | null;
}
export = AgentPool;