123456789101112131415161718192021222324252627282930 |
- import net from 'net';
- import type {
- ConnectionCallbackType,
- ConnectionConfigurationType,
- } from '../types';
- import Agent from './Agent';
- class HttpProxyAgent extends Agent {
-
-
- constructor (...args: *) {
- super(...args);
- this.protocol = 'http:';
- this.defaultPort = 80;
- }
- createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) {
- const socket = net.connect(
- configuration.proxy.port,
- configuration.proxy.hostname,
- );
- callback(null, socket);
- }
- }
- export default HttpProxyAgent;
|