Skip to content

Commit

Permalink
unneeded if removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jandelgado committed Mar 28, 2021
1 parent a5c9b45 commit d688539
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/rabtap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,15 @@ func getTLSConfig(insecureTLS bool, certFile string, keyFile string, caFile stri
if certFile != "" && keyFile != "" {
// Load client cert
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
failOnError(err, "invalid client tls cert/key file", os.Exit)
}
failOnError(err, "invalid client tls cert/key file", os.Exit)
tlsConfig.Certificates = []tls.Certificate{cert}
tlsConfig.BuildNameToCertificate()
}

if caFile != "" {
// Load CA cert
caCert, err := ioutil.ReadFile(caFile)
if err != nil {
failOnError(err, "invalid tls ca file", os.Exit)
}
failOnError(err, "invalid tls ca file", os.Exit)
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
tlsConfig.RootCAs = caCertPool
Expand Down

0 comments on commit d688539

Please sign in to comment.