scanner: add scanoptions struct

This commit is contained in:
sentriz
2020-05-01 02:12:17 +01:00
parent 08e775c9dd
commit 24212af42e
5 changed files with 24 additions and 32 deletions

View File

@@ -22,9 +22,9 @@ func firstExisting(or string, strings ...string) string {
return or
}
func doScan(scanFunc func() error) {
func doScan(scanner *scanner.Scanner, opts scanner.ScanOptions) {
go func() {
if err := scanFunc(); err != nil {
if err := scanner.Start(opts); err != nil {
log.Printf("error while scanning: %v\n", err)
}
}()
@@ -278,7 +278,7 @@ func (c *Controller) ServeUpdateLastFMAPIKeyDo(r *http.Request) *Response {
}
func (c *Controller) ServeStartScanIncDo(r *http.Request) *Response {
defer doScan(c.Scanner.StartInc)
defer doScan(c.Scanner, scanner.ScanOptions{})
return &Response{
redirect: "/admin/home",
flashN: []string{"incremental scan started. refresh for results"},
@@ -286,7 +286,7 @@ func (c *Controller) ServeStartScanIncDo(r *http.Request) *Response {
}
func (c *Controller) ServeStartScanFullDo(r *http.Request) *Response {
defer doScan(c.Scanner.StartFull)
defer doScan(c.Scanner, scanner.ScanOptions{IsFull: true})
return &Response{
redirect: "/admin/home",
flashN: []string{"full scan started. refresh for results"},