mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/tls: improve documentation for ServerName.
Users of the low-level, Client function are frequenctly missing the fact that, unless they pass a ServerName to the TLS connection then it cannot verify the certificates against any name. This change makes it clear that at least one of InsecureSkipVerify and ServerName should always be set. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/65440043
This commit is contained in:
parent
ae38b03f6c
commit
80692a3f81
2 changed files with 5 additions and 5 deletions
|
|
@ -231,8 +231,9 @@ type Config struct {
|
||||||
// NextProtos is a list of supported, application level protocols.
|
// NextProtos is a list of supported, application level protocols.
|
||||||
NextProtos []string
|
NextProtos []string
|
||||||
|
|
||||||
// ServerName is included in the client's handshake to support virtual
|
// ServerName is used to verify the hostname on the returned
|
||||||
// hosting.
|
// certificates unless InsecureSkipVerify is given. It is also included
|
||||||
|
// in the client's handshake to support virtual hosting.
|
||||||
ServerName string
|
ServerName string
|
||||||
|
|
||||||
// ClientAuth determines the server's policy for
|
// ClientAuth determines the server's policy for
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,8 @@ func Server(conn net.Conn, config *Config) *Conn {
|
||||||
|
|
||||||
// Client returns a new TLS client side connection
|
// Client returns a new TLS client side connection
|
||||||
// using conn as the underlying transport.
|
// using conn as the underlying transport.
|
||||||
// Client interprets a nil configuration as equivalent to
|
// The config cannot be nil: users must set either ServerHostname or
|
||||||
// the zero configuration; see the documentation of Config
|
// InsecureSkipVerify in the config.
|
||||||
// for the defaults.
|
|
||||||
func Client(conn net.Conn, config *Config) *Conn {
|
func Client(conn net.Conn, config *Config) *Conn {
|
||||||
return &Conn{conn: conn, config: config, isClient: true}
|
return &Conn{conn: conn, config: config, isClient: true}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue