MCPcopy Create free account
hub / github.com/pion/dtls / validateConfig

Function validateConfig

config.go:282–314  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

280)
281
282func validateConfig(config *Config) error { //nolint:cyclop
283 switch {
284 case config == nil:
285 return errNoConfigProvided
286 case config.PSKIdentityHint != nil && config.PSK == nil:
287 return errIdentityNoPSK
288 }
289
290 for _, cert := range config.Certificates {
291 if cert.Certificate == nil {
292 return errInvalidCertificate
293 }
294 if cert.PrivateKey != nil {
295 signer, ok := cert.PrivateKey.(crypto.Signer)
296 if !ok {
297 return errInvalidPrivateKey
298 }
299 switch signer.Public().(type) {
300 case ed25519.PublicKey:
301 case *ecdsa.PublicKey:
302 case *rsa.PublicKey:
303 default:
304 return errInvalidPrivateKey
305 }
306 }
307 }
308
309 _, err := parseCipherSuites(
310 config.CipherSuites, config.CustomCipherSuites, config.includeCertificateSuites(), config.PSK != nil,
311 )
312
313 return err
314}

Callers 6

TestValidateConfigFunction · 0.85
ListenFunction · 0.85
NewListenerFunction · 0.85
ResumeFunction · 0.85
ClientFunction · 0.85
ServerFunction · 0.85

Calls 2

parseCipherSuitesFunction · 0.85

Tested by 1

TestValidateConfigFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…