mirror of
https://github.com/wwhai/mqtt-benchmark.git
synced 2025-10-09 01:20:10 +08:00
Adds tls command line parameters validation
This commit is contained in:
8
main.go
8
main.go
@@ -83,6 +83,14 @@ func main() {
|
||||
log.Fatalf("Invalid arguments: messages count should be > 1, given: %v", *count)
|
||||
}
|
||||
|
||||
if *cert != "" && *key == "" {
|
||||
log.Fatal("Invalid arguments: private key path missing")
|
||||
}
|
||||
|
||||
if *cert == "" && *key != "" {
|
||||
log.Fatalf("Invalid arguments: certificate path missing")
|
||||
}
|
||||
|
||||
var tlsConfig *tls.Config
|
||||
if *cert != "" && *key != "" {
|
||||
tlsConfig = generateTlsConfig(*cert, *key)
|
||||
|
Reference in New Issue
Block a user