refactor: nettests is now an internal package (#165)
I'm moving everything into internal packages since this ain't a library. While there, remove typo that was causing a build breakage.
This commit is contained in:
parent
fb2ca32004
commit
a58dff3050
15 changed files with 2 additions and 3 deletions
|
|
@ -1,48 +0,0 @@
|
|||
package nettests
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// HTTPHeaderFieldManipulation test implementation
|
||||
type HTTPHeaderFieldManipulation struct {
|
||||
}
|
||||
|
||||
// Run starts the test
|
||||
func (h HTTPHeaderFieldManipulation) Run(ctl *Controller) error {
|
||||
builder, err := ctl.Session.NewExperimentBuilder(
|
||||
"http_header_field_manipulation",
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctl.Run(builder, []string{""})
|
||||
}
|
||||
|
||||
// HTTPHeaderFieldManipulationTestKeys for the test
|
||||
type HTTPHeaderFieldManipulationTestKeys struct {
|
||||
IsAnomaly bool `json:"-"`
|
||||
}
|
||||
|
||||
// GetTestKeys returns a projection of the tests keys needed for the views
|
||||
func (h HTTPHeaderFieldManipulation) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
|
||||
testKeys := HTTPHeaderFieldManipulationTestKeys{IsAnomaly: false}
|
||||
tampering, ok := tk["tampering"].(map[string]interface{})
|
||||
if !ok {
|
||||
return testKeys, errors.New("tampering testkey is invalid")
|
||||
}
|
||||
for _, v := range tampering {
|
||||
t, ok := v.(bool)
|
||||
// Ignore non booleans in the tampering map
|
||||
if ok && t == true {
|
||||
testKeys.IsAnomaly = true
|
||||
}
|
||||
}
|
||||
|
||||
return testKeys, nil
|
||||
}
|
||||
|
||||
// LogSummary writes the summary to the standard output
|
||||
func (h HTTPHeaderFieldManipulation) LogSummary(s string) error {
|
||||
return nil
|
||||
}
|
||||
Loading…
Reference in a new issue