From: Darren Date: Sat, 2 Nov 2013 13:01:31 +0000 (+0000) Subject: Net. interface binding per outgoing IRC connection X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7cf75020c7d6fa1c68c7eab0edca44726ae76efe;p=KiwiIRC.git Net. interface binding per outgoing IRC connection --- 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 {