mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
reworked loading, checking and storing interims.
This commit is contained in:
parent
892a0b941b
commit
ef829131e1
2 changed files with 88 additions and 75 deletions
|
|
@ -16,6 +16,7 @@ import (
|
|||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
|
|
@ -85,6 +86,16 @@ type config struct {
|
|||
keyErr error
|
||||
}
|
||||
|
||||
// TooOldForInterims returns a function that tells if a given
|
||||
// time is too old for the configured interims interval.
|
||||
func (c *config) TooOldForInterims() func(time.Time) bool {
|
||||
if c.InterimYears <= 0 {
|
||||
return func(time.Time) bool { return false }
|
||||
}
|
||||
from := time.Now().AddDate(-c.InterimYears, 0, 0)
|
||||
return func(t time.Time) bool { return t.Before(from) }
|
||||
}
|
||||
|
||||
// serviceDocument tells if we should generate a service document for a
|
||||
// given provider.
|
||||
func (p *provider) serviceDocument(c *config) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue