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

Add ModuleSet object #247

Merged
merged 1 commit into from
Feb 18, 2020
Merged

Add ModuleSet object #247

merged 1 commit into from
Feb 18, 2020

Conversation

dadrian
Copy link
Member

@dadrian dadrian commented Feb 17, 2020

Eventually this can be used to replace AddCommand, allowing the use of a
non-global config object.

How to Test

Add brief instructions on how to test your changes.

Notes & Caveats

If necessary, explain the motivation for this PR, and note any caveats that apply to your changes or future work that will be needed.

Issue Tracking

Add a link to the relevant GitHub issue(s) if the pull request resolves it.

Eventually this can be used to replace AddCommand, allowing the use of a
non-global config object.
@dadrian dadrian marked this pull request as ready for review February 17, 2020 22:22
@dadrian dadrian requested a review from codyprime February 17, 2020 22:22

// ModuleSet is a container holding named scan modules. It is a wrapper around a
// map.
type ModuleSet map[string]ScanModule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is ever going to be a possible writer and reader that access the map concurrently, ModuleSet should be a struct that contains async.Mutex to guard the map. e.g.,

type ModuleSet struct {
    lock sync.Mutex // protects Modules
    Modules map[string]ScanModule
}

And then of course the methods can all do s.Lock() / s.Unlock() as appropriate.

Copy link
Member

@codyprime codyprime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the caveat that ModuleSet may need a sync.Mutex in the future, for its methods: lgtm

@dadrian dadrian merged commit 320f7aa into master Feb 18, 2020
@dadrian dadrian deleted the dadrian/module-set branch February 18, 2020 15:23
AnthraX1 pushed a commit to AnthraX1/zgrab2 that referenced this pull request Jul 21, 2020
Eventually this can be used to replace AddCommand, allowing the use of a
non-global config object.

zmap#247
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants