From ddae94f590c5f6f3e865580bc66e4a8adf6c73f6 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 14 Jul 2013 13:37:24 +0100 Subject: [PATCH] Connecting to the correct host for outgoing connections --- server/irc/connection.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/irc/connection.js b/server/irc/connection.js index 722be5d..4239b6e 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -145,6 +145,11 @@ IrcConnection.prototype.connect = function () { outgoing = global.config.outgoing_address.IPv6; } else { outgoing = global.config.outgoing_address.IPv4 || '0.0.0.0'; + + // We don't have an IPv6 interface but dest_addr may still resolve to + // an IPv4 address. Reset `host` and try connecting anyway, letting it + // fail if an IPv4 resolved address is not found + host = dest_addr; } } else { @@ -155,7 +160,7 @@ IrcConnection.prototype.connect = function () { // Are we connecting through a SOCKS proxy? if (this.socks) { that.socket = Socks.connect({ - host: that.irc_host.hostname, + host: host, port: that.irc_host.port, ssl: that.ssl, rejectUnauthorized: global.config.reject_unauthorised_certificates @@ -171,7 +176,7 @@ IrcConnection.prototype.connect = function () { if (that.ssl) { that.socket = tls.connect({ - host: that.irc_host.hostname, + host: host, port: that.irc_host.port, rejectUnauthorized: global.config.reject_unauthorised_certificates, localAddress: outgoing -- 2.25.1