fix updates

This commit is contained in:
stryan 2024-06-26 22:20:45 -04:00
parent a34b4849dd
commit 5d94c40399
3 changed files with 8 additions and 4 deletions

View File

@ -61,19 +61,22 @@ func main() {
domain: domain, domain: domain,
conf: conf, conf: conf,
} }
count := 0
for _, v := range watchconf.Users { for _, v := range watchconf.Users {
err := a.Add(&v) err := a.Add(&v)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err, "reg", count)
} }
count++
} }
count = 0
for _, v := range watchconf.Hosts { for _, v := range watchconf.Hosts {
err := a.Add(&v) err := a.Add(&v)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err, "reg", count)
} }
count++
} }
log.Info(a)
server := &http.Server{Addr: fmt.Sprintf("0.0.0.0:%v", port), Handler: a.server()} server := &http.Server{Addr: fmt.Sprintf("0.0.0.0:%v", port), Handler: a.server()}
var wg sync.WaitGroup var wg sync.WaitGroup
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)

View File

@ -57,7 +57,7 @@ func (h HostRegistration) Valid() bool {
} }
func (h *HostRegistration) Update(_ config.Config) (string, error) { func (h *HostRegistration) Update(_ config.Config) (string, error) {
resp, err := http.Get("icanhazip.com") resp, err := http.Get("https://icanhazip.com")
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -48,6 +48,7 @@ func (t *Tilde) UpdateReg(secret string, ip string) error {
return errors.New("error getting user reg") return errors.New("error getting user reg")
} }
reg.ip = ip reg.ip = ip
reg.update = true
return nil return nil
} }