Files
clio/tools/requests_gun/requests_gun.go
Sergey Kuznetsov ff4bc5b0aa Load tool (#1421)
Simple tool to put a specific load on clio.
2024-05-24 13:01:36 +01:00

32 lines
641 B
Go

package main
import (
"fmt"
"os"
"requests_gun/internal/ammo_provider"
"requests_gun/internal/parse_args"
"requests_gun/internal/trigger"
)
func main() {
args, err := parse_args.Parse()
if err != nil {
fmt.Fprintln(os.Stderr, "Error: ", err)
parse_args.PrintUsage()
os.Exit(1)
}
fmt.Print("Loading ammo... ")
f, err := os.Open(args.Ammo)
if err != nil {
fmt.Println("Error opening file '", args.Ammo, "': ", err)
os.Exit(1)
}
ammoProvider := ammo_provider.New(f)
f.Close()
fmt.Println("Done")
fmt.Println("Firing requests...")
trigger.Fire(ammoProvider, args)
}