Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getName (option) {
var name = AgentOrigin.prototype.getName.call(this, option);
name += ':';
if (option.customSocketId) {
name += option.customSocketId
}
return name;
}
}
var https = require('https');
var http = require('http');
var Watchdog = require('./watchdog');
var HttpAgent = require('agentkeepalive');
var HttpsAgent = HttpAgent.HttpsAgent;
HttpsAgent.prototype.getName = HttpAgent.prototype.getName;
function Upstream(upstreamURL, statsdClient, agentOpts) {
if (typeof upstreamURL === 'string') {
upstreamURL = require('url').parse(upstreamURL);
}
this.host = upstreamURL.hostname;
this.protocol = upstreamURL.protocol;
this.port = parseInt(upstreamURL.port, 10) || (this.protocol == 'https:' ? 443 : 80);
this.httpModule = this.protocol == 'http:' ? http : https;
this.agent = agentOpts ? createAgent(this.protocol, agentOpts) : false;
this.forwardAgent = agentOpts ? agentOpts.forwardAgent : false;
this.dog = new Watchdog(this.port, this.host);
this.statsdClient = statsdClient;
if (!this.statsdClient.fake) {
this.statsdTimer = setInterval(this.recordPoolStats.bind(this), 1000);
}