RFC 6066 says:
If the server understood the ClientHello extension but does not recognize the server name, the server SHOULD take one of two actions: either abort the handshake by sending a fatal-level unrecognized_name(112) alert or continue the handshake.
Currently returning an error from the GetCertificate hook results in a generic internal_error fatal alert. To implement the first action in the RFC, there should be a way to return an unrecognized_name fatal alert to the client when a GetCertificate hook is unable to find a certificate for the server name specified in the ClientHello. I propose the addition of a special error variable to the crypto/tls package that triggers this alert:
// ErrUnrecognizedName sends an unrecognized_name fatal alert to the client
// when returned from a GetCertificate hook function call.
var ErrUnrecognizedName = errors.New("crypto/tls: unrecognized server name")
RFC 6066 says:
Currently returning an error from the
GetCertificatehook results in a genericinternal_errorfatal alert. To implement the first action in the RFC, there should be a way to return anunrecognized_namefatal alert to the client when aGetCertificatehook is unable to find a certificate for the server name specified in the ClientHello. I propose the addition of a special error variable to thecrypto/tlspackage that triggers this alert: