2a51cb64dc
* backport of commit 558a8677ce0bd7ae01abda9652952a51f43a7c0c * backport of commit 5cd06e00cc30eff34f88ab7992437b783ddaeeea --------- Co-authored-by: R.B. Boyer <rb@hashicorp.com>
26 lines
737 B
Go
26 lines
737 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package proxycfgglue
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/consul/agent/leafcert"
|
|
"github.com/hashicorp/consul/agent/proxycfg"
|
|
)
|
|
|
|
// LocalLeafCerts satisfies the proxycfg.LeafCertificate interface by sourcing data from
|
|
// the given leafcert.Manager.
|
|
func LocalLeafCerts(m *leafcert.Manager) proxycfg.LeafCertificate {
|
|
return &localLeafCerts{m}
|
|
}
|
|
|
|
type localLeafCerts struct {
|
|
leafCertManager *leafcert.Manager
|
|
}
|
|
|
|
func (c *localLeafCerts) Notify(ctx context.Context, req *leafcert.ConnectCALeafRequest, correlationID string, ch chan<- proxycfg.UpdateEvent) error {
|
|
return c.leafCertManager.NotifyCallback(ctx, req, correlationID, dispatchCacheUpdate(ch))
|
|
}
|