conf.http_base_path = "/kiwi";
+/*
+ * SOCKS proxy settings
+ */
+conf.socks_proxy = {};
+
+// Enable proxying outbound connections through a SOCKS proxy
+conf.socks_proxy.enabled = false;
+
+// Proxy *all* outbound connections through a SOCKS proxy
+conf.socks_proxy.all = false;
+
+// Use SOCKS proxy for these hosts only (if conf.sock_proxy.all === false)
+conf.socks_proxy.proxy_hosts = [
+ "irc.example.com"
+];
+
+// Host and port for the SOCKS proxy
+conf.socks_proxy.address = '127.0.0.1';
+conf.socks_proxy.port = 1080;
+
+// Username and password for the SOCKS proxy
+// Set user to null to disable password authentication
+conf.socks_proxy.user = null;
+conf.socks_proxy.pass = null;
+
// Enabled transports for the browser to use
conf.transports = [
IrcServer = require('./server.js'),
IrcChannel = require('./channel.js'),
IrcUser = require('./user.js'),
- SocksConnection = require('./socks.js');
+ SocksConnection = require('../socks.js');
var IrcConnection = function (hostname, port, ssl, nick, user, pass, state) {
this.ssl = !(!ssl);
// SOCKS proxy details
- // TODO: read proxy details from configuration
- this.socks = false;
+ // TODO: Wildcard matching of hostnames and/or CIDR ranges of IP addresses
+ if ((global.config.socks_proxy && global.config.socks_proxy.enabled) && ((global.config.socks_proxy.all) || (_.contains(global.config.socks_proxy.proxy_hosts, this.irc_host.hostname)))) {
+ this.socks = {
+ host: global.config.socks_proxy.address,
+ port: global.config.socks_proxy.port,
+ user: global.config.socks_proxy.user,
+ pass: global.config.socks_proxy.pass
+ };
+ } else {
+ this.socks = false;
+ }
// Options sent by the IRCd
this.options = Object.create(null);
pass: this.socks.pass
});
- socks.on('connect', function (socket){
+ socks.on('connect', function (socket) {
that.socket = socket;
setupSocket.call(that);
+ that.connected = true;
+ socketConnectHandler.call(that);
});
} else {
// Open either a secure or plain text socket
this.socket.on(socket_connect_event_name, function () {
that.connected = true;
- socketConnectHandler.apply(that, arguments);
+ socketConnectHandler.call(that);
});
setupSocket.call(this);