From 72280d53c4dc4426dbe44d0135dd94a391da6283 Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 3 Aug 2013 22:13:04 +0100 Subject: [PATCH] Multiple outgoing interface addresses --- server/irc/connection.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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'; -- 2.25.1