diff options
author | Benny Morrison <benmorrison@ttm.sh> | 2019-03-14 03:54:00 -0400 |
---|---|---|
committer | Benny Morrison <benmorrison@ttm.sh> | 2019-03-14 03:54:00 -0400 |
commit | 3e8bdbbff6ad95b3c06e6fe22035e0714fabcec9 (patch) | |
tree | a10816e25581e38cb78d9880142fbb92c44f3b33 | |
parent | 4810fbc0d1f4d7788c344879afeb18c71692165d (diff) | |
download | goofbot-3e8bdbbff6ad95b3c06e6fe22035e0714fabcec9.tar.gz |
tls connection to IRC server
-rw-r--r-- | main.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/main.go b/main.go index 006d3d0..ef324a7 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,8 @@ package main import ( + "crypto/tls" "log" - "net" "gopkg.in/irc.v3" ) @@ -20,7 +20,7 @@ func main() { Handler: irc.HandlerFunc(func(c *irc.Client, m *irc.Message) { if m.Command == "001" { // 001 = welcome - c.Write("JOIN #institute") + c.Write("JOIN #institute") //initial channel join } else if m.Command == "PRIVMSG" && c.FromChannel(m) { c.WriteMessage(&irc.Message{ Command: "PRIVMSG", @@ -33,7 +33,14 @@ func main() { }), } - conn, err := net.Dial("tcp", "irc.tilde.chat:6697") + // set up the tls params for the connection + tlsconfig := tls.Config{ + InsecureSkipVerify: false, //set to true if you want to be dumb + RootCAs: nil, //use the OS's root CAs + PreferServerCipherSuites: true, //use the server's cipher list + } + + conn, err := tls.Dial("tcp", "irc.tilde.chat:6697", &tlsconfig) if err != nil { log.Fatalln(err) } |