feat: support not-only Let's Encrypt service #16

This commit is contained in:
Jacky 2024-04-30 17:16:14 +08:00
parent 3e90b838fd
commit 49b41d6eb7
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
6 changed files with 60 additions and 57 deletions

View file

@ -5,9 +5,11 @@ import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/tls"
"github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/registration"
"math/big"
"net/http"
)
type PrivateKey struct {
@ -55,6 +57,16 @@ func (u *AcmeUser) Register() error {
}
config := lego.NewConfig(u)
config.CADirURL = u.CADir
u.Registration = registration.Resource{}
// Skip TLS check
if config.HTTPClient != nil {
config.HTTPClient.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
}
client, err := lego.NewClient(config)
if err != nil {
return err