From: Darren Date: Sat, 3 Aug 2013 21:13:04 +0000 (+0100) Subject: Multiple outgoing interface addresses X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=72280d53c4dc4426dbe44d0135dd94a391da6283;p=KiwiIRC.git Multiple outgoing interface addresses --- diff --git a/server/irc/connection.js b/server/irc/connection.js index 37aa134..5cb8dc8 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -168,6 +168,15 @@ IrcConnection.prototype.connect = function () { host = dest_addr; } + // If we have an array of interfaces, select a random one + if (typeof outgoing !== 'string' && outgoing.length) { + outgoing = outgoing[Math.floor(Math.random() * outgoing.length)]; + } + + // Make sure we have a valid interface address + if (typeof outgoing !== 'string') + outgoing = '0.0.0.0'; + } else { // No config was found so use the default outgoing = '0.0.0.0';