1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Add time interval filtering to downloader.

This commit is contained in:
Sascha L. Teichmann 2023-07-26 03:22:33 +02:00
parent 0e297fc616
commit de0599ebe3
4 changed files with 36 additions and 12 deletions

View file

@ -14,6 +14,7 @@ import (
"net/http"
"net/url"
"strings"
"time"
"github.com/csaf-poc/csaf_distribution/v2/util"
)
@ -71,11 +72,12 @@ func (haf HashedAdvisoryFile) SignURL() string { return haf.name(3, ".asc") }
// AdvisoryFileProcessor implements the extraction of
// advisory file names from a given provider metadata.
type AdvisoryFileProcessor struct {
client util.Client
expr *util.PathEval
doc any
base *url.URL
log func(format string, args ...any)
AgeAccept func(time.Time) bool
client util.Client
expr *util.PathEval
doc any
base *url.URL
log func(format string, args ...any)
}
// NewAdvisoryFileProcessor constructs an filename extractor
@ -287,6 +289,13 @@ func (afp *AdvisoryFileProcessor) processROLIE(
rfeed.Entries(func(entry *Entry) {
// Filter if we have date checking.
if afp.AgeAccept != nil {
if pub := time.Time(entry.Published); !pub.IsZero() && !afp.AgeAccept(pub) {
return
}
}
var self, sha256, sha512, sign string
for i := range entry.Link {