Documentation
¶
Overview ¶
Package consul contains types and utilities for updating data from Consul.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowlistUpdater ¶
type AllowlistUpdater struct {
// contains filtered or unexported fields
}
AllowlistUpdater is a wrapper that updates the allowlist on refresh. It should be initially refreshed before use.
func NewAllowlistUpdater ¶
func NewAllowlistUpdater(c *AllowlistUpdaterConfig) (upd *AllowlistUpdater)
NewAllowlistUpdater returns a properly initialized *AllowlistUpdater. c must not be nil.
func (*AllowlistUpdater) Refresh ¶
func (upd *AllowlistUpdater) Refresh(ctx context.Context) (err error)
Refresh implements the agdservice.Refresher interface for *AllowlistUpdater.
type AllowlistUpdaterConfig ¶
type AllowlistUpdaterConfig struct { // Logger is used for logging the operation of the allowlist updater. Logger *slog.Logger // Allowlist is the allowlist to update. Allowlist *ratelimit.DynamicAllowlist // ConsulURL is the URL from which to update Allowlist. ConsulURL *url.URL // ErrColl is used to collect errors during refreshes. ErrColl errcoll.Interface // Metrics is used to collect allowlist statistics. Metrics Metrics // Timeout is the timeout for Consul queries. Timeout time.Duration }
AllowlistUpdaterConfig is the configuration structure for the allowlist updater. All fields must not be nil.
type EmptyMetrics ¶
type EmptyMetrics struct{}
EmptyMetrics is the implementation of the Metrics interface that does nothing.
type Metrics ¶
type Metrics interface { // SetSize sets the number of received subnets. SetSize(ctx context.Context, n int) // SetStatus sets the status and time of the allowlist refresh attempt. SetStatus(ctx context.Context, err error) }
Metrics is an interface that is used for the collection of the allowlist statistics.