From a5a4f989ac4fef77a7bd9ae3ab69d6bd504ff6bf Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Thu, 21 Jul 2011 22:00:45 +0100 Subject: [PATCH] Update SSL connectivity to use tls.Dial now it supports a config arg. --- client/connection.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/client/connection.go b/client/connection.go index c1309ca..746a65a 100644 --- a/client/connection.go +++ b/client/connection.go @@ -114,18 +114,8 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error { if !hasPort(host) { host += ":6697" } - // It's unfortunate that tls.Dial doesn't allow a tls.Config arg, - // so we simply replicate it here with the correct Config. - // http://codereview.appspot.com/2883041 - if s, err := net.Dial("tcp", host); err == nil { - // Passing nil config => certs are validated. - c := tls.Client(s, conn.SSLConfig) - if err = c.Handshake(); err == nil { - conn.sock = c - } else { - s.Close() - return err - } + if s, err := tls.Dial("tcp", host, conn.SSLConfig); err == nil { + conn.sock = s } else { return err }