summaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authoraubble <anmol@aubble.com>2015-08-20 14:26:56 -0400
committerAdam Langley <agl@golang.org>2015-08-29 22:23:04 +0000
commit34695c4742dd8055ed88b409014353e99288c43e (patch)
treefed2e8115723d435f03f55d36c73dbfdb14d8438 /src/crypto
parentefeeee38c9aa30d2bdcb9d150c6e76ada01c5145 (diff)
downloadgo-git-34695c4742dd8055ed88b409014353e99288c43e.tar.gz
crypto/tls: note in comments that setting GetCertificate is now sufficient.
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>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/tls/common.go3
-rw-r--r--src/crypto/tls/tls.go12
2 files changed, 8 insertions, 7 deletions
diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go
index a3d75d69cb..d47dc6182f 100644
--- a/src/crypto/tls/common.go
+++ b/src/crypto/tls/common.go
@@ -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
diff --git a/src/crypto/tls/tls.go b/src/crypto/tls/tls.go
index f6d5bb1b9a..fb399d001b 100644
--- a/src/crypto/tls/tls.go
+++ b/src/crypto/tls/tls.go
@@ -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")