make CLI configurable

This commit is contained in:
m5r
2024-07-26 12:16:23 +02:00
parent c3220327e1
commit c7989fa736
15 changed files with 468 additions and 251 deletions

30
main.go
View File

@@ -1,35 +1,9 @@
package main
import (
"flag"
"time"
"local-ip.sh/certs"
"local-ip.sh/http"
"local-ip.sh/xip"
"local-ip.sh/cmd"
)
func main() {
port := flag.Int("port", 53, "port the DNS server should bind to")
flag.Parse()
n := xip.NewXip(*port)
go func() {
account := certs.LoadAccount()
certsClient := certs.NewCertsClient(n, account)
time.Sleep(5 * time.Second)
certsClient.RequestCertificates()
for {
// try to renew certificate every day
time.Sleep(24 * time.Hour)
certsClient.RequestCertificates()
}
}()
go http.ServeHttp()
n.StartServer()
cmd.Execute()
}