INNER CODE UNIT · Go

tlsConfigs

go-kratos/gateway · client/factory.go:44

	tlsConfigs := make(map[string]*tls.Config, len(cfg.TlsStore))
	for k, v := range cfg.TlsStore {
		cfg := &tls.Config{
			InsecureSkipVerify: v.Insecure,
			ServerName:         v.ServerName,
		}
		cert, err := tls.X509KeyPair([]byte(v.Cert), []byte(v.Key))
		if err != nil {
			LOG.Warnf("failed to load tls cert: %q: %v", k, err)
			continue
		}
		cfg.Certificates = []tls.Certificate{cert}
		if v.Cacert != "" {
			roots := x509.NewCertPool()
			if ok := roots.AppendCertsFromPEM([]byte(v.Cacert)); !ok {
				LOG.Warnf("failed to load tls cacert: %q", k)
				continue
			}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…