Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Scanner interface as an abstraction for Clamd struct #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion clamd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ const (
RES_PARSE_ERROR = "PARSE ERROR"
)

type Scanner interface {
Ping() error
Version() (chan *ScanResult, error)
Stats() (*Stats, error)
Reload() error
Shutdown() error
ScanFile(path string) (chan *ScanResult, error)
RawScanFile(path string) (chan *ScanResult, error)
MultiScanFile(path string) (chan *ScanResult, error)
ContScanFile(path string) (chan *ScanResult, error)
AllMatchScanFile(path string) (chan *ScanResult, error)
ScanStream(r io.Reader, abort chan bool) (chan *ScanResult, error)
}

type Clamd struct {
address string
}
Expand Down Expand Up @@ -305,7 +319,7 @@ func (c *Clamd) ScanStream(r io.Reader, abort chan bool) (chan *ScanResult, erro
return ch, nil
}

func NewClamd(address string) *Clamd {
func NewClamd(address string) Scanner {
clamd := &Clamd{address: address}
return clamd
}