got the certificate request working

This commit is contained in:
m5r
2023-02-26 14:06:15 +01:00
parent d6bc349e73
commit bd5bd0e7a1
5 changed files with 96 additions and 20 deletions

19
main.go
View File

@@ -2,8 +2,11 @@ package main
import (
"flag"
"log"
"strings"
"time"
"local-ip.sh/certs"
"local-ip.sh/xip"
)
@@ -18,16 +21,20 @@ func main() {
n := xip.NewXip(zone, strings.Split(nameservers, ","), *port)
// not functional yet
/* go func() {
go func() {
account := certs.LoadAccount()
log.Println(account.Registration.Body.Contact)
ddd := certs.NewCertsClient(n, account)
certsClient := certs.NewCertsClient(n, account)
time.Sleep(5 * time.Second)
fmt.Println("requesting certs")
ddd.RequestCertificate()
}() */
certsClient.RequestCertificate()
for {
// renew certificate every month
time.Sleep(30 * 24 * time.Hour)
certsClient.RenewCertificate()
}
}()
n.StartServer()
}