# HG changeset patch # User Chris Jones # Date 1327012075 21600 # Node ID a5848c75d270ebfa5e3a51bfa479ba45b84e7934 # Parent edda99a69002f03365f12b1a7cf036b8ad6073b6 Allow the app to specify a tls.Config to use for purposes of negotiating the TLS layer. diff -r edda99a69002 -r a5848c75d270 examples/interact.go --- 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") diff -r edda99a69002 -r a5848c75d270 stream.go --- 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. diff -r edda99a69002 -r a5848c75d270 xmpp.go --- 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