From 7edbb2131a4a44f75c4c00e375600e500062936e Mon Sep 17 00:00:00 2001 From: Tom Most Date: Tue, 17 Jun 2014 23:36:10 -0700 Subject: [PATCH] Add TLS connection support Also update the example config to be safe by default. --- config.js | 5 +++-- lib/server.js | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config.js b/config.js index df959c01..ab4cce23 100644 --- a/config.js +++ b/config.js @@ -7,8 +7,9 @@ module.exports = { realname: "http://github.com/erming/shout", }, networks: [{ - host: "irc.freenode.org", - port: 6667, + host: "chat.freenode.net", + port: 6697, + tls: true, onConnect: { commands: [""], join: [ diff --git a/lib/server.js b/lib/server.js index f5e00b98..d16f030c 100644 --- a/lib/server.js +++ b/lib/server.js @@ -5,6 +5,7 @@ var http = require("connect"); var io = require("socket.io"); var irc = require("slate-irc"); var net = require("net"); +var tls = require("tls"); // Models @@ -92,11 +93,12 @@ function connect(params) { var host = params.host; var port = params.port || 6667; - - var stream = net.connect({ - port: port, + var options = { host: host, - }); + port: port, + }; + + var stream = params.tls ? tls.connect(options) : net.connect(options); stream.on("error", function(e) { console.log(e);