func RunWithManager(r http.Handler, m *autocert.Manager) error {
	s := &http.Server{
		Addr:      ":https",
		TLSConfig: m.TLSConfig(),
		Handler:   r,
	}
	go http.ListenAndServe(":http", m.HTTPHandler(http.HandlerFunc(redirect)))
	return s.ListenAndServeTLS("", "")
}
RunWithManager support custom autocert manager
package autotls
import (
	"net/http"
	"golang.org/x/crypto/acme/autocert"
)
func Run(r http.Handler, domain ...string) error {
	return http.Serve(autocert.NewListener(domain...), r)
}