implementation of custom Exporter/Tracker

- RegisterTracker to allow for custom trackers to be implemented beyond Jira/Github/Gitlab
- RegisterExporter to allow for custom exporters to be implemented beyond Sarif/Disk
dev
TheSecEng 2021-07-24 22:39:59 -07:00
parent 62a957d812
commit e9fa301e4f
No known key found for this signature in database
GPG Key ID: 4D98046FE19FF417
1 changed files with 15 additions and 0 deletions

View File

@ -98,6 +98,10 @@ type Client struct {
// New creates a new nuclei issue tracker reporting client
func New(options *Options, db string) (*Client, error) {
if options == nil {
return nil, errors.New("no options passed")
}
if options.AllowList != nil {
options.AllowList.Compile()
}
@ -141,6 +145,7 @@ func New(options *Options, db string) (*Client, error) {
}
client.exporters = append(client.exporters, exporter)
}
storage, err := dedupe.New(db)
if err != nil {
return nil, err
@ -149,6 +154,16 @@ func New(options *Options, db string) (*Client, error) {
return client, nil
}
// RegisterTracker registers a custom tracker to the reporter
func (c *Client) RegisterTracker(tracker Tracker) {
c.trackers = append(c.trackers, tracker)
}
// RegisterExporter registers a custom exporter to the reporter
func (c *Client) RegisterExporter(exporter Exporter) {
c.exporters = append(c.exporters, exporter)
}
// Close closes the issue tracker reporting client
func (c *Client) Close() {
c.dedupe.Close()