MCPcopy
hub / github.com/IBM/sarama / createTLSConfiguration

Function createTLSConfiguration

examples/sasl_scram_client/main.go:37–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35)
36
37func createTLSConfiguration() (t *tls.Config) {
38 t = &tls.Config{
39 InsecureSkipVerify: *tlsSkipVerify,
40 }
41 if *certFile != "" && *keyFile != "" && *caFile != "" {
42 cert, err := tls.LoadX509KeyPair(*certFile, *keyFile)
43 if err != nil {
44 log.Fatal(err)
45 }
46
47 caCert, err := os.ReadFile(*caFile)
48 if err != nil {
49 log.Fatal(err)
50 }
51
52 caCertPool := x509.NewCertPool()
53 caCertPool.AppendCertsFromPEM(caCert)
54
55 t = &tls.Config{
56 Certificates: []tls.Certificate{cert},
57 RootCAs: caCertPool,
58 InsecureSkipVerify: *tlsSkipVerify,
59 }
60 }
61 return t
62}
63
64func main() {
65 flag.Parse()

Callers 1

mainFunction · 0.85

Calls 1

FatalMethod · 0.80

Tested by

no test coverage detected