forked from epociask/tx-traffic-poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
83 lines (74 loc) · 2.29 KB
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package main
import (
"time"
"github.com/Layr-Labs/eigenda/common"
"github.com/urfave/cli"
)
const (
FlagPrefix = "traffic-generator"
envPrefix = "TRAFFIC_GENERATOR"
)
var (
/* Required Flags */
HostnameFlag = cli.StringFlag{
Name: common.PrefixFlag(FlagPrefix, "disperser-hostname"),
Usage: "Hostname at which disperser service is available",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "HOSTNAME"),
}
TimeoutFlag = cli.DurationFlag{
Name: common.PrefixFlag(FlagPrefix, "timeout"),
Usage: "Amount of time to wait for GPRC",
Required: false,
EnvVar: common.PrefixEnvVar(envPrefix, "TIMEOUT"),
Value: 10 * time.Second,
}
NumInstancesFlag = cli.UintFlag{
Name: common.PrefixFlag(FlagPrefix, "num-instances"),
Usage: "Number of generator instances to run in parallel",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "NUM_INSTANCES"),
}
PadSizeFlag = cli.UintFlag{
Name: common.PrefixFlag(FlagPrefix, "data-size"),
Usage: "Data size in the extra field",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "PAD_SIZE"),
}
RequestIntervalFlag = cli.DurationFlag{
Name: common.PrefixFlag(FlagPrefix, "request-interval"),
Usage: "Duration between requests",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "REQUEST_INTERVAL"),
Value: 2 * time.Second,
}
SignerPrivateKeysFlag = cli.StringSliceFlag{
Name: common.PrefixFlag(FlagPrefix, "signer-private-keys-hex"),
Usage: "List of Private key to use for signing requests",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "SIGNER_PRIVATE_KEYS_HEX"),
}
AddressesFlag = cli.StringSliceFlag{
Name: common.PrefixFlag(FlagPrefix, "signer-addresses-hex"),
Usage: "List of Address to use for signing requests",
Required: true,
EnvVar: common.PrefixEnvVar(envPrefix, "SIGNER_ADDRESSES"),
}
)
var requiredFlags = []cli.Flag{
NumInstancesFlag,
RequestIntervalFlag,
SignerPrivateKeysFlag,
AddressesFlag,
PadSizeFlag,
}
var optionalFlags = []cli.Flag{
HostnameFlag,
TimeoutFlag,
}
// Flags contains the list of configuration options available to the binary.
var Flags []cli.Flag
func init() {
Flags = append(requiredFlags, optionalFlags...)
Flags = append(Flags, common.LoggerCLIFlags(envPrefix, FlagPrefix)...)
}