Allow the app to specify a tls.Config to use for purposes of negotiating the TLS layer.
--- a/examples/interact.go Thu Jan 19 16:23:15 2012 -0600
+++ b/examples/interact.go Thu Jan 19 16:27:55 2012 -0600
@@ -6,6 +6,7 @@
import (
"cjyar/xmpp"
+ "crypto/tls"
"flag"
"fmt"
"log"
@@ -19,6 +20,8 @@
xmpp.Log = log.New(os.Stderr, "", 0)
xmpp.Loglevel = syslog.LOG_NOTICE
+ xmpp.TLSConfig = &tls.Config{InsecureSkipVerify: true}
+
var jid xmpp.JID
flag.Var(&jid, "jid", "JID to log in as")
var pw *string = flag.String("pw", "", "password")
--- a/stream.go Thu Jan 19 16:23:15 2012 -0600
+++ b/stream.go Thu Jan 19 16:27:55 2012 -0600
@@ -401,7 +401,7 @@
cl.socketSync.Wait()
// Negotiate TLS with the server.
- tls := tls.Client(tcp, nil)
+ tls := tls.Client(tcp, TLSConfig)
// Make the TLS connection available to the reader, and wait
// for it to signal that it's working again.
--- a/xmpp.go Thu Jan 19 16:23:15 2012 -0600
+++ b/xmpp.go Thu Jan 19 16:27:55 2012 -0600
@@ -8,6 +8,7 @@
import (
"bytes"
+ "crypto/tls"
"encoding/xml"
"errors"
"fmt"
@@ -42,6 +43,8 @@
Log *log.Logger
// Threshold for which messages are logged.
Loglevel syslog.Priority = syslog.LOG_NOTICE
+ // Use this Config to negotiate TLS connections.
+ TLSConfig *tls.Config = nil
)
// This channel may be used as a convenient way to generate a unique