func RunHTTPRedirectServer() (s *http.Server) {
	s = &http.Server{
		ReadTimeout:  5 * time.Second,
		WriteTimeout: 5 * time.Second,
		Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
			w.Header().Set("Connection", "close")
			url := "https://" + req.Host + req.URL.String()
			http.Redirect(w, req, url, http.StatusMovedPermanently)
		}),
	}
	go func() { log.Fatal(s.ListenAndServe()) }()
	return s
}
RunHTTPRedirectServer to send all HTTP traffic to HTTPS
package secureserver
import (
	"crypto/tls"
	"log"
	"net/http"
	"time"
	"golang.org/x/crypto/acme/autocert"
)
var CipherSuites = []uint16{
	tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
	tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
	tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
	tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
	tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
	tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
}
var Curves = []tls.CurveID{
	tls.CurveP256,
}
func TLSConfig(domain string) *tls.Config {
	certManager := GetCertificate(domain)
	return &tls.Config{
		MinVersion:               tls.VersionTLS12,
		PreferServerCipherSuites: true,
		GetCertificate:           certManager.GetCertificate,
		CurvePreferences:         Curves,
		CipherSuites:             CipherSuites,
	}
}
func GetCertificate(domain string) autocert.Manager {
	return autocert.Manager{
		Prompt:     autocert.AcceptTOS,
		HostPolicy: autocert.HostWhitelist(domain),
	}
}
func GetHTTPSServer(domain string) (s *http.Server) {
	s = &http.Server{
		ReadTimeout:  5 * time.Second,
		WriteTimeout: 10 * time.Second,
		Addr:      ":443",
		TLSConfig: TLSConfig(domain),
		TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
	}
	return s
}