Skip to content

Commit

Permalink
small tweak for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDoanRivian committed Nov 26, 2024
1 parent 13f2971 commit 11648f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cert/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ func NewCAPool() *NebulaCAPool {
// returned along with the pool. The caller must handle any such errors.
func NewCAPoolFromBytes(caPEMs []byte) (*NebulaCAPool, []error, error) {
pool := NewCAPool()
var err error
var warnings []error
var expired bool
for {
var err error
caPEMs, err = pool.AddCACertificate(caPEMs)
if errors.Is(err, ErrExpired) {
expired = true
err = nil
} else if errors.Is(err, ErrInvalidPEMCertificateUnsupported) {
warnings = append(warnings, err)
err = nil
}
if err != nil {
} else if err != nil {
return nil, warnings, err
}

if len(caPEMs) == 0 || strings.TrimSpace(string(caPEMs)) == "" {
break
}
}

if len(pool.CAs) == 0 {
return nil, warnings, errors.New("no valid CA certificates present")
}
Expand Down

0 comments on commit 11648f8

Please sign in to comment.