Skip to content

Commit

Permalink
Changed casing issues to fit with idiomatic go standards
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCooney committed Sep 2, 2017
1 parent c01722b commit eccf0ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions monkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
)

var MAX_TIME_BETWEEN_ATTACKS = 60
var MaxTimeBetweenAttacks = 60

var ATTACKS_STRATEGY = map[string](func(endpointConfig EndpointConfig, attackConfig AttackConfig, responseChannel chan Response) error){"HTTP_SPAM": RunHTTPSpam,"CORRUPT_HTTP": RunCorruptHTTP,"URL_QUERY_SPAM": RunURLQuery}
var AttacksStrategy = map[string](func(endpointConfig EndpointConfig, attackConfig AttackConfig, responseChannel chan Response) error){"HTTP_SPAM": RunHTTPSpam,"CORRUPT_HTTP": RunCorruptHTTP,"URL_QUERY_SPAM": RunURLQuery}

func main() {
config := GetConfigFromCli()
Expand Down Expand Up @@ -100,7 +100,7 @@ func executeAttackSync(endpoint EndpointConfig, attack AttackConfig) Response {
}

func getAttackFunction(attack AttackConfig) (func(endpointConfig EndpointConfig, attackConfig AttackConfig, responseChannel chan Response) error) {
attackFunc, present := ATTACKS_STRATEGY[attack.Type]
attackFunc, present := AttacksStrategy[attack.Type]

if !present {
panic(errors.New(fmt.Sprintf("Unknown attack type %s", attack.Type)))
Expand All @@ -110,5 +110,5 @@ func getAttackFunction(attack AttackConfig) (func(endpointConfig EndpointConfig,
}

func pauseForRandomDuration() {
time.Sleep(time.Duration(rand.Intn(MAX_TIME_BETWEEN_ATTACKS)) * time.Second)
time.Sleep(time.Duration(rand.Intn(MaxTimeBetweenAttacks)) * time.Second)
}
2 changes: 1 addition & 1 deletion monkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func TestSetupAttackThreads(t *testing.T) {
t.Run("Test that the monkey correctly reports failing attacks", func(t *testing.T) {
MAX_TIME_BETWEEN_ATTACKS = 20
MaxTimeBetweenAttacks = 20
responseChannel := make(chan Response)
config := CreateFullTestConfiguration("200", "HTTP_SPAM")

Expand Down

0 comments on commit eccf0ee

Please sign in to comment.