Add support for more tests
- Implement middlebox tests & summary generator - Implement IM tests (summary generator missing)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package middlebox
|
||||
|
||||
import (
|
||||
"github.com/measurement-kit/go-measurement-kit"
|
||||
"github.com/openobservatory/gooni/nettests"
|
||||
)
|
||||
|
||||
// HTTPHeaderFieldManipulation test implementation
|
||||
type HTTPHeaderFieldManipulation struct {
|
||||
}
|
||||
|
||||
// Run starts the test
|
||||
func (h HTTPHeaderFieldManipulation) Run(ctl *nettests.Controller) error {
|
||||
mknt := mk.NewNettest("HttpHeaderFieldManipulation")
|
||||
ctl.Init(mknt)
|
||||
return mknt.Run()
|
||||
}
|
||||
|
||||
// HTTPHeaderFieldManipulationSummary for the test
|
||||
type HTTPHeaderFieldManipulationSummary struct {
|
||||
Tampering bool
|
||||
}
|
||||
|
||||
// Summary generates a summary for a test run
|
||||
func (h HTTPHeaderFieldManipulation) Summary(tk map[string]interface{}) interface{} {
|
||||
tampering := false
|
||||
for _, v := range tk["tampering"].(map[string]interface{}) {
|
||||
t, ok := v.(bool)
|
||||
// Ignore non booleans in the tampering map
|
||||
if ok && t == true {
|
||||
tampering = true
|
||||
}
|
||||
}
|
||||
|
||||
return HTTPHeaderFieldManipulationSummary{
|
||||
Tampering: tampering,
|
||||
}
|
||||
}
|
||||
|
||||
// LogSummary writes the summary to the standard output
|
||||
func (h HTTPHeaderFieldManipulation) LogSummary(s string) error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package middlebox
|
||||
|
||||
import (
|
||||
"github.com/measurement-kit/go-measurement-kit"
|
||||
"github.com/openobservatory/gooni/nettests"
|
||||
)
|
||||
|
||||
// HTTPInvalidRequestLine test implementation
|
||||
type HTTPInvalidRequestLine struct {
|
||||
}
|
||||
|
||||
// Run starts the test
|
||||
func (h HTTPInvalidRequestLine) Run(ctl *nettests.Controller) error {
|
||||
mknt := mk.NewNettest("HttpInvalidRequestLine")
|
||||
ctl.Init(mknt)
|
||||
return mknt.Run()
|
||||
}
|
||||
|
||||
// HTTPInvalidRequestLineSummary for the test
|
||||
type HTTPInvalidRequestLineSummary struct {
|
||||
Tampering bool
|
||||
}
|
||||
|
||||
// Summary generates a summary for a test run
|
||||
func (h HTTPInvalidRequestLine) Summary(tk map[string]interface{}) interface{} {
|
||||
tampering := tk["tampering"].(bool)
|
||||
|
||||
return HTTPInvalidRequestLineSummary{
|
||||
Tampering: tampering,
|
||||
}
|
||||
}
|
||||
|
||||
// LogSummary writes the summary to the standard output
|
||||
func (h HTTPInvalidRequestLine) LogSummary(s string) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user