V2bX/node/lego_test.go

42 lines
629 B
Go
Raw Normal View History

2023-08-16 12:21:15 -04:00
package node
2023-01-12 01:27:06 -05:00
import (
"log"
"os"
"testing"
2023-07-29 07:27:15 -04:00
"github.com/InazumaV/V2bX/conf"
2023-01-12 01:27:06 -05:00
)
var l *Lego
func init() {
var err error
2023-08-16 12:21:15 -04:00
l, err = NewLego(&conf.CertConfig{
2023-01-12 01:27:06 -05:00
CertMode: "dns",
Email: "test@test.com",
CertDomain: "test.test.com",
Provider: "cloudflare",
DNSEnv: map[string]string{
"CF_DNS_API_TOKEN": "123",
},
CertFile: "./cert/1.pem",
KeyFile: "./cert/1.key",
})
if err != nil {
log.Println(err)
os.Exit(1)
}
}
func TestLego_CreateCertByDns(t *testing.T) {
err := l.CreateCert()
if err != nil {
t.Error(err)
}
}
func TestLego_RenewCert(t *testing.T) {
log.Println(l.RenewCert())
}