func (m *Manager) ServeHTTPS() error {
	srv := &http.Server{
		Addr: ":https",
		TLSConfig: &tls.Config{
			GetCertificate: m.GetCertificate,
		},
	}
	return srv.ListenAndServeTLS("", "")
}
ServeHTTPS runs an HTTPS web server using TLS certificates obtained by the manager.
The HTTPS server obtains TLS certificates as needed and responds to requests
by invoking http.DefaultServeMux.
ServeHTTPS does not return unitil the HTTPS server fails to start or else stops.
Either way, ServeHTTPS can only return a non-nil error, never nil.
package letsencrypt
import (
	"crypto"
	"crypto/ecdsa"
	"crypto/elliptic"
	"crypto/rand"
	"crypto/tls"
	"crypto/x509"
	"encoding/json"
	"encoding/pem"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"os"
	"strings"
	"sync"
	"time"
	"github.com/ossrs/go-oryx-lib/https/net/context"
	"github.com/ossrs/go-oryx-lib/https/time/rate"
	"github.com/ossrs/go-oryx-lib/https/acme"
)
const letsEncryptURL = "https://acme-v01.api.letsencrypt.org/directory"
const debug = false
type Manager struct {
	mu           sync.Mutex
	state        state
	rateLimit    *rate.Limiter
	newHostLimit *rate.Limiter
	certCache    map[string]*cacheEntry
	certTokens   map[string]*tls.Certificate
	watchChan    chan struct{}
}
func (m *Manager) Serve() error {
	l, err := net.Listen("tcp", ":http")
	if err != nil {
		return err
	}
	defer l.Close()
	go http.Serve(l, http.HandlerFunc(RedirectHTTP))
	return m.ServeHTTPS()
}