Commit 34695c47 authored by aubble's avatar aubble Committed by Adam Langley

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/13800Reviewed-by: default avatarAdam Langley <agl@golang.org>
parent efeeee38
...@@ -255,7 +255,8 @@ type Config struct { ...@@ -255,7 +255,8 @@ type Config struct {
// Certificates contains one or more certificate chains // Certificates contains one or more certificate chains
// to present to the other side of the connection. // 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 Certificates []Certificate
// NameToCertificate maps from a certificate name to an element of // NameToCertificate maps from a certificate name to an element of
......
...@@ -20,8 +20,8 @@ import ( ...@@ -20,8 +20,8 @@ import (
// Server returns a new TLS server side connection // Server returns a new TLS server side connection
// using conn as the underlying transport. // using conn as the underlying transport.
// The configuration config must be non-nil and must have // The configuration config must be non-nil and must include
// at least one certificate. // at least one certificate or else set GetCertificate.
func Server(conn net.Conn, config *Config) *Conn { func Server(conn net.Conn, config *Config) *Conn {
return &Conn{conn: conn, config: config} return &Conn{conn: conn, config: config}
} }
...@@ -53,8 +53,8 @@ func (l *listener) Accept() (c net.Conn, err error) { ...@@ -53,8 +53,8 @@ func (l *listener) Accept() (c net.Conn, err error) {
// NewListener creates a Listener which accepts connections from an inner // NewListener creates a Listener which accepts connections from an inner
// Listener and wraps each connection with Server. // Listener and wraps each connection with Server.
// The configuration config must be non-nil and must have // The configuration config must be non-nil and must include
// at least one certificate. // at least one certificate or else set GetCertificate.
func NewListener(inner net.Listener, config *Config) net.Listener { func NewListener(inner net.Listener, config *Config) net.Listener {
l := new(listener) l := new(listener)
l.Listener = inner l.Listener = inner
...@@ -64,8 +64,8 @@ func NewListener(inner net.Listener, config *Config) net.Listener { ...@@ -64,8 +64,8 @@ func NewListener(inner net.Listener, config *Config) net.Listener {
// Listen creates a TLS listener accepting connections on the // Listen creates a TLS listener accepting connections on the
// given network address using net.Listen. // given network address using net.Listen.
// The configuration config must be non-nil and must have // The configuration config must be non-nil and must include
// at least one certificate. // at least one certificate or else set GetCertificate.
func Listen(network, laddr string, config *Config) (net.Listener, error) { func Listen(network, laddr string, config *Config) (net.Listener, error) {
if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) { if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) {
return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config") return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment