Massive refactor!
This commit is contained in:
25
internal/licensecheck/checker.go
Normal file
25
internal/licensecheck/checker.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LicenseChecker struct {
|
||||
LicenseAPIURL string
|
||||
APIKey string
|
||||
PollInterval time.Duration
|
||||
|
||||
mu sync.RWMutex
|
||||
lastGood time.Time
|
||||
valid bool
|
||||
}
|
||||
|
||||
func (lc *LicenseChecker) setValid(ok bool) {
|
||||
lc.mu.Lock()
|
||||
defer lc.mu.Unlock()
|
||||
lc.valid = ok
|
||||
if ok {
|
||||
lc.lastGood = time.Now()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user