]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/tls: note in comments that setting GetCertificate is now sufficient.
authoraubble <anmol@aubble.com>
Thu, 20 Aug 2015 18:26:56 +0000 (14:26 -0400)
committerAdam Langley <agl@golang.org>
Sat, 29 Aug 2015 22:23:04 +0000 (22:23 +0000)
In Go 1.5, Config.Certificates is no longer required if
Config.GetCertificate has been set. This change updated four comments to
reflect that.

Change-Id: Id72cc22fc79e931b2d645a7c3960c3241042762c
Reviewed-on: https://go-review.googlesource.com/13800
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/tls/common.go
src/crypto/tls/tls.go

index a3d75d69cbfadf33acc4a6726cd0f340c799f32f..d47dc6182f0d91c2aad1da67a1030edca9448cc3 100644 (file)
@@ -255,7 +255,8 @@ type Config struct {
 
        // Certificates contains one or more certificate chains
        // to present to the other side of the connection.
-       // Server configurations must include at least one certificate.
+       // Server configurations must include at least one certificate
+       // or else set GetCertificate.
        Certificates []Certificate
 
        // NameToCertificate maps from a certificate name to an element of
index f6d5bb1b9af9b760ff56235be8b70d73233e0075..fb399d001bc051801aec1e60b9005f3bfa680606 100644 (file)
@@ -20,8 +20,8 @@ import (
 
 // Server returns a new TLS server side connection
 // using conn as the underlying transport.
-// The configuration config must be non-nil and must have
-// at least one certificate.
+// The configuration config must be non-nil and must include
+// at least one certificate or else set GetCertificate.
 func Server(conn net.Conn, config *Config) *Conn {
        return &Conn{conn: conn, config: config}
 }
@@ -53,8 +53,8 @@ func (l *listener) Accept() (c net.Conn, err error) {
 
 // NewListener creates a Listener which accepts connections from an inner
 // Listener and wraps each connection with Server.
-// The configuration config must be non-nil and must have
-// at least one certificate.
+// The configuration config must be non-nil and must include
+// at least one certificate or else set GetCertificate.
 func NewListener(inner net.Listener, config *Config) net.Listener {
        l := new(listener)
        l.Listener = inner
@@ -64,8 +64,8 @@ func NewListener(inner net.Listener, config *Config) net.Listener {
 
 // Listen creates a TLS listener accepting connections on the
 // given network address using net.Listen.
-// The configuration config must be non-nil and must have
-// at least one certificate.
+// The configuration config must be non-nil and must include
+// at least one certificate or else set GetCertificate.
 func Listen(network, laddr string, config *Config) (net.Listener, error) {
        if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) {
                return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config")