fiorix / go-diameter

Diameter stack and Base Protocol (RFC 6733) for the Go programming language
Other
252 stars 143 forks source link

Do not load certificates if GetCertificate is provided #173

Open AlexanderMescheryakov opened 2 years ago

AlexanderMescheryakov commented 2 years ago

Addresses #172

paulrozhkin commented 5 days ago

I think this check should be like in the net/http/server.go. It contains:

configHasCert := len(config.Certificates) > 0 || config.GetCertificate != nil
if !configHasCert || certFile != "" || keyFile != "" {
    var err error
    config.Certificates = make([]tls.Certificate, 1)
    config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
    if err != nil {
        return err
    }
}