From 4188bbc5bde8455eb7b64ca62e0ad41517c17820 Mon Sep 17 00:00:00 2001 From: yusing Date: Sat, 30 Nov 2024 01:06:06 +0800 Subject: [PATCH] small changes --- internal/autocert/provider.go | 4 ++-- internal/net/types/cidr.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/autocert/provider.go b/internal/autocert/provider.go index 11dd275..1854142 100644 --- a/internal/autocert/provider.go +++ b/internal/autocert/provider.go @@ -155,11 +155,11 @@ func (p *Provider) ScheduleRenewal() { go func() { task := task.GlobalTask("cert renew scheduler") defer task.Finish("cert renew scheduler stopped") - + for { renewalTime := p.ShouldRenewOn() timer := time.NewTimer(time.Until(renewalTime)) - + select { case <-task.Context().Done(): timer.Stop() diff --git a/internal/net/types/cidr.go b/internal/net/types/cidr.go index 65fc269..0ee3c98 100644 --- a/internal/net/types/cidr.go +++ b/internal/net/types/cidr.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "net" "strings" @@ -40,5 +41,5 @@ func (cidr *CIDR) String() string { } func (cidr *CIDR) Equals(other *CIDR) bool { - return (*net.IPNet)(cidr).IP.Equal(other.IP) && cidr.Mask.String() == other.Mask.String() + return (*net.IPNet)(cidr).IP.Equal(other.IP) && bytes.Equal(cidr.Mask, other.Mask) }