From 7cf75020c7d6fa1c68c7eab0edca44726ae76efe Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 2 Nov 2013 13:01:31 +0000 Subject: [PATCH] Net. interface binding per outgoing IRC connection --- server/irc/connection.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/irc/connection.js b/server/irc/connection.js index a2d1c13..0bfca1d 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -101,6 +101,9 @@ var IrcConnection = function (hostname, port, ssl, nick, user, options, state, c this.socks = false; } + // Net. interface this connection should be made through + this.outgoing_interface = false; + // Options sent by the IRCd this.options = Object.create(null); this.cap = {requested: [], enabled: []}; @@ -160,7 +163,12 @@ IrcConnection.prototype.connect = function () { var outgoing; // Decide which net. interface to make the connection through - if (global.config.outgoing_address) { + if (that.outgoing_interface) { + // An specific interface has been given for this connection + outgoing = this.outgoing_interface; + + } else if (global.config.outgoing_address) { + // Pick an interface from the config if ((family === 'IPv6') && (global.config.outgoing_address.IPv6)) { outgoing = global.config.outgoing_address.IPv6; } else { -- 2.25.1