add tls version control flags
@@ -79,6 +79,8 @@ var formats = [][2]string{
{"event", "protocol buffer messages as a timestamped list of tags and values"},
{"proto", "protocol buffer messages in binary wire format"},
}
+var tlsVersions = []string{"1.3", "1.2", "1.1", "1.0"}
+
var cfgFile string
var f io.WriteCloser
var logger *log.Logger
@@ -184,6 +186,9 @@ func init() {
rootCmd.PersistentFlags().StringP("prometheus-address", "", "", "prometheus server address")
rootCmd.PersistentFlags().BoolP("print-request", "", false, "print request as well as the response(s)")
rootCmd.PersistentFlags().DurationP("retry", "", defaultRetryTimer, "retry timer for RPCs")
+ rootCmd.PersistentFlags().StringP("tls-min-version", "", "", fmt.Sprintf("minium TLS supported version, one of %v", tlsVersions))
+ rootCmd.PersistentFlags().StringP("tls-max-version", "", "", fmt.Sprintf("maximum TLS supported version, one of %v", tlsVersions))
+ rootCmd.PersistentFlags().StringP("tls-version", "", "", fmt.Sprintf("set TLS version, one of %v", tlsVersions))
//
viper.BindPFlag("address", rootCmd.PersistentFlags().Lookup("address"))
viper.BindPFlag("username", rootCmd.PersistentFlags().Lookup("username"))
@@ -206,6 +211,9 @@ func init() {
viper.BindPFlag("prometheus-address", rootCmd.PersistentFlags().Lookup("prometheus-address"))
viper.BindPFlag("print-request", rootCmd.PersistentFlags().Lookup("print-request"))
viper.BindPFlag("retry", rootCmd.PersistentFlags().Lookup("retry"))
+ viper.BindPFlag("tls-min-version", rootCmd.PersistentFlags().Lookup("tls-min-version"))
+ viper.BindPFlag("tls-max-version", rootCmd.PersistentFlags().Lookup("tls-max-version"))
+ viper.BindPFlag("tls-version", rootCmd.PersistentFlags().Lookup("tls-version"))
}
// initConfig reads in config file and ENV variables if set.
