File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 4
4
"errors"
5
5
"flag"
6
6
"log"
7
+ "math/rand"
8
+ "time"
7
9
)
8
10
9
11
var (
@@ -16,17 +18,24 @@ var (
16
18
fileName string
17
19
trafficType string
18
20
timeout int
21
+ seed int64
19
22
ErrInvalidTrafficType = errors .New ("Invalid traffic type" )
20
23
)
21
24
22
25
func init () {
26
+ // Parse the arguments
23
27
flag .IntVar (& nbOfClients , "clients" , 10 , "number of clients making requests" )
24
28
flag .IntVar (& nbOfRequests , "requests" , 10 , "number of requests to be made by each clients" )
25
29
flag .IntVar (& avgMillisecondsToWait , "wait" , 1000 , "milliseconds to wait between each requests" )
26
30
flag .IntVar (& timeout , "timeout" , 3 , "HTTP timeout in seconds" )
31
+ flag .Int64Var (& seed , "seed" , time .Now ().UTC ().UnixNano (), "seed for the random" )
27
32
flag .StringVar (& trafficType , "type" , "http" , "type of requests http/dns" )
28
33
flag .StringVar (& fileName , "urlSource" , "" , "optional filepath where to find the URLs" )
29
34
flag .Parse ()
35
+
36
+ log .SetFlags (0 )
37
+ log .Println ("Random URLs using seed" , seed )
38
+ rand .Seed (seed )
30
39
}
31
40
32
41
func main () {
You can’t perform that action at this time.
0 commit comments