MCPcopy
hub / github.com/grafana/dskit / GetGRPCDialOptions

Method GetGRPCDialOptions

crypto/tls/tls.go:179–190  ·  view source on GitHub ↗

GetGRPCDialOptions creates GRPC DialOptions for TLS

(enabled bool)

Source from the content-addressed store, hash-verified

177
178// GetGRPCDialOptions creates GRPC DialOptions for TLS
179func (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
192func mapCipherNamesToIDs(cipherSuiteNames []string) ([]uint16, error) {
193 cipherSuites := []uint16{}

Callers 2

DialOptionMethod · 0.80
DialOptionMethod · 0.80

Calls 2

GetTLSConfigMethod · 0.95
WrapMethod · 0.65

Tested by 1

DialOptionMethod · 0.64