Skip to content

Instantly share code, notes, and snippets.

@prawnsalad
Created July 13, 2013 22:52
Show Gist options
  • Save prawnsalad/5992512 to your computer and use it in GitHub Desktop.
Save prawnsalad/5992512 to your computer and use it in GitHub Desktop.
getConnectionFamily(this.socks.host, function (err, family, host) {
var outgoing;
if ((family === 'IPv6') && (global.config.outgoing_address.IPv6) && (global.config.outgoing_address.IPv6 !== '')) {
outgoing = global.config.outgoing_address.IPv6;
} else {
outgoing = global.config.outgoing_address.IPv4;
}
if (this.socks) {
that.socket = Socks.connect({
host: that.irc_host.hostname,
port: that.irc_host.port,
ssl: that.ssl,
rejectUnauthorized: global.config.reject_unauthorised_certificates
}, {host: host,
port: that.socks.port,
user: that.socks.user,
pass: that.socks.pass,
localAddress: outgoing
});
} else {
if (that.ssl) {
that.socket = tls.connect({
host: host,
port: that.irc_host.port,
rejectUnauthorized: global.config.reject_unauthorised_certificates,
localAddress: outgoing
});
socket_connect_event_name = 'secureConnect';
} else {
that.socket = net.connect({
host: host,
port: that.irc_host.port,
localAddress: outgoing
});
}
}
addSocketHandlers.call(that);§
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment