Add TLS connection support

Also update the example config to be safe by default.
This commit is contained in:
Tom Most 2014-06-17 23:36:10 -07:00
parent c79ef9a7d7
commit 7edbb2131a
2 changed files with 9 additions and 6 deletions

View File

@ -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: [

View File

@ -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);