func (s *Server) tlsListener(l net.Listener) (net.Listener, error) {
	certificate, err := tls.X509KeyPair([]byte(s.TLSCertPEM), []byte(s.TLSKeyPEM))
	if err != nil {
		return nil, err
	}
	cfg := tls.Config{
		NextProtos:   []string{"http/1.1"},
		Certificates: []tls.Certificate{certificate},
		MinVersion:   tls.VersionTLS13,
	}
	tlsListener := tls.NewListener(l, &cfg)
	return tlsListener, nil
}
// tlsListener creates a TLS listener, wrapping the base listener.
// TLSListener is derived from https://golang.org/src/net/http/server.go to create a TLS Listener using the key bytes rather than files.
tlsListener creates a TLS listener, wrapping the base listener.
// tlsListener creates a TLS listener wrapping the base listener . // TLSListener is derived from https : // golang . org / src / net / http / server . go to create a TLS Listener using the key bytes rather than files .
func (s *Server) tlsListener(l net.Listener) (net.Listener, error) {
	certificate, err := tls.X509KeyPair([]byte(s.TLSCertPEM), []byte(s.TLSKeyPEM))
	if err != nil {
		return nil, err
	}
	cfg := tls.Config{
		NextProtos:   []string{"http/1.1"},
		Certificates: []tls.Certificate{certificate},
		MinVersion:   tls.VersionTLS13,
	}
	tlsListener := tls.NewListener(l, &cfg)
	return tlsListener, nil
}
func ( s * Server ) tlsListener ( l net . Listener ) ( net . Listener , error ) { certificate , err := tls . X509KeyPair ( [ ] byte ( s . TLSCertPEM ) , [ ] byte ( s . TLSKeyPEM ) ) if err != nil { return nil , err } cfg := tls . Config { NextProtos : [ ] string { " " } , Certificates : [ ] tls . Certificate { certificate } , MinVersion : tls . VersionTLS13 , } tlsListener := tls . NewListener ( l , & cfg ) return tlsListener , nil }
tlsListener creates a TLS listener, wrapping the base listener.
tlsListener creates a TLS listener wrapping the base listener .