ooni-probe-cli/nettests/middlebox/http_invalid_request_line.go

43 lines
1022 B
Go
Raw Normal View History

package middlebox
import (
"errors"
"github.com/measurement-kit/go-measurement-kit"
"github.com/ooni/probe-cli/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()
}
2018-09-10 12:41:28 +02:00
// HTTPInvalidRequestLineTestKeys for the test
type HTTPInvalidRequestLineTestKeys struct {
IsAnomaly bool `json:"-"`
}
2018-09-10 12:41:28 +02:00
// GetTestKeys generates a summary for a test run
func (h HTTPInvalidRequestLine) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
testKeys := HTTPInvalidRequestLineTestKeys{IsAnomaly: false}
tampering, ok := tk["tampering"].(bool)
if !ok {
return testKeys, errors.New("tampering is not bool")
}
testKeys.IsAnomaly = tampering
return testKeys, nil
}
// LogSummary writes the summary to the standard output
func (h HTTPInvalidRequestLine) LogSummary(s string) error {
return nil
}