1// Type definitions for agent-base 4.2.1 2// Project: https://github.com/TooTallNate/node-agent-base 3// Definitions by: Christopher Quadflieg <https://github.com/Shinigami92> 4 5/// <reference types="node" /> 6import { EventEmitter } from 'events'; 7 8declare namespace Agent { 9 export type AgentCallback = ( 10 req?: any, 11 opts?: { 12 secureEndpoint: boolean; 13 } 14 ) => void; 15 16 export interface AgentOptions { 17 timeout?: number; 18 host?: string; 19 port?: number; 20 [key: string]: any; 21 } 22 23 export interface Agent extends EventEmitter { 24 _promisifiedCallback: boolean; 25 timeout: number | null; 26 options?: AgentOptions; 27 callback: AgentCallback; 28 addRequest: (req?: any, opts?: any) => void; 29 freeSocket: (socket: any, opts: any) => void; 30 } 31} 32 33/** 34 * Base `http.Agent` implementation. 35 * No pooling/keep-alive is implemented by default. 36 */ 37declare function Agent(opts?: Agent.AgentOptions): Agent.Agent; 38declare function Agent( 39 callback: Agent.AgentCallback, 40 opts?: Agent.AgentOptions 41): Agent.Agent; 42 43export = Agent; 44