GetGRPCDialOptions creates GRPC DialOptions for TLS
(enabled bool)
| 177 | |
| 178 | // GetGRPCDialOptions creates GRPC DialOptions for TLS |
| 179 | func (cfg *ClientConfig) GetGRPCDialOptions(enabled bool) ([]grpc.DialOption, error) { |
| 180 | if !enabled { |
| 181 | return []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}, nil |
| 182 | } |
| 183 | |
| 184 | tlsConfig, err := cfg.GetTLSConfig() |
| 185 | if err != nil { |
| 186 | return nil, errors.Wrap(err, "error creating grpc dial options") |
| 187 | } |
| 188 | |
| 189 | return []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))}, nil |
| 190 | } |
| 191 | |
| 192 | func mapCipherNamesToIDs(cipherSuiteNames []string) ([]uint16, error) { |
| 193 | cipherSuites := []uint16{} |