remoteconfig

package
v2.0.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2023 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotStarted = errors.New("remote config client not started")

ErrClientNotStarted is returned when the remote config client is not started.

Functions

func HasCapability

func HasCapability(cap Capability) (bool, error)

HasCapability returns whether a given capability was registered

func HasProduct

func HasProduct(p string) (bool, error)

HasProduct returns whether a given product was registered

func RegisterCallback

func RegisterCallback(f Callback) error

RegisterCallback allows registering a callback that will be invoked when the client receives configuration updates. It is up to that callback to then decide what to do depending on the product related to the configuration update.

func RegisterCapability

func RegisterCapability(cap Capability) error

RegisterCapability adds a capability to the list of capabilities exposed by the client when requesting configuration updates

func RegisterProduct

func RegisterProduct(p string) error

RegisterProduct adds a product to the list of products listened by the client

func Reset

func Reset()

Reset destroys the client instance. To be used only in tests to reset the state of the client.

func Start

func Start(config ClientConfig) error

Start starts the client's update poll loop in a fresh goroutine. Noop if the client has already started.

func Stop

func Stop()

Stop stops the client's update poll loop. Noop if the client has already been stopped. The remote config client is supposed to have the same lifecycle as the tracer. It can't be restarted after a call to Stop() unless explicitly calling Reset().

func UnregisterCallback

func UnregisterCallback(f Callback) error

UnregisterCallback removes a previously registered callback from the active callbacks list This remove operation preserves ordering

func UnregisterCapability

func UnregisterCapability(cap Capability) error

UnregisterCapability removes a capability from the list of capabilities exposed by the client when requesting configuration updates

func UnregisterProduct

func UnregisterProduct(p string) error

UnregisterProduct removes a product from the list of products listened by the client

Types

type Callback

type Callback func(updates map[string]ProductUpdate) map[string]rc.ApplyStatus

Callback represents a function that can process a remote config update. A Callback function can be registered to a remote config client to automatically react upon receiving updates. This function returns the configuration processing status for each config file received through the update.

type Capability

type Capability uint

Capability represents a bit index to be set in clientData.Capabilites in order to register a client for a specific capability

const (

	// ASMActivation represents the capability to activate ASM through remote configuration
	ASMActivation Capability
	// ASMIPBlocking represents the capability for ASM to block requests based on user IP
	ASMIPBlocking
	// ASMDDRules represents the capability to update the rules used by the ASM WAF for threat detection
	ASMDDRules
	// ASMExclusions represents the capability for ASM to exclude traffic from its protections
	ASMExclusions
	// ASMRequestBlocking represents the capability for ASM to block requests based on the HTTP request related WAF addresses
	ASMRequestBlocking
	// ASMResponseBlocking represents the capability for ASM to block requests based on the HTTP response related WAF addresses
	ASMResponseBlocking
	// ASMUserBlocking represents the capability for ASM to block requests based on user ID
	ASMUserBlocking
	// ASMCustomRules represents the capability for ASM to receive and use user-defined security rules
	ASMCustomRules
	// ASMCustomRules represents the capability for ASM to receive and use user-defined blocking responses
	ASMCustomBlockingResponse
)

type Client

type Client struct {
	sync.RWMutex
	ClientConfig
	// contains filtered or unexported fields
}

A Client interacts with an Agent to update and track the state of remote configuration

type ClientConfig

type ClientConfig struct {
	// The address at which the agent is listening for remoteconfig update requests on
	AgentURL string
	// The semantic version of the user's application
	AppVersion string
	// The env this tracer is running in
	Env string
	// The time interval between two client polls to the agent for updates
	PollInterval time.Duration
	// The tracer's runtime id
	RuntimeID string
	// The name of the user's application
	ServiceName string
	// The semantic version of the tracer
	TracerVersion string
	// The base TUF root metadata file
	TUFRoot string
	// HTTP is the HTTP client used to receive config updates
	HTTP *http.Client
}

ClientConfig contains the required values to configure a remoteconfig client

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

DefaultClientConfig returns the default remote config client configuration

type ProductUpdate

type ProductUpdate map[string][]byte

ProductUpdate represents an update for a specific product. It is a map of file path to raw file content

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL