validators

package
v0.1.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package validators provides zero-allocation OpenAPI validation for HAProxy models.

This package contains generated validators that work directly on client-native structs, avoiding the ~25GB allocation overhead of JSON marshal/unmarshal cycles that occurs when using the generic kin-openapi validator.

The validators are generated from OpenAPI specs in pkg/generated/dataplaneapi/ and support HAProxy versions 3.0, 3.1, and 3.2.

Usage:

cache := validators.NewCache()
validatorSet := validators.ForVersion(3, 2)

// Validate with caching
err := cache.ValidateServer(server, validatorSet)

// Or validate without caching
err := validatorSet.ValidateServer(server)

Package validators provides zero-allocation OpenAPI validation for HAProxy models.

Index

Constants

View Source
const (
	// NumShards is the number of cache shards for reduced lock contention.
	NumShards = 64
	// ShardSize is the maximum entries per shard (64 * 1024 = 65536 total).
	ShardSize = 1024
)

Variables

This section is empty.

Functions

func HashAclV30

func HashAclV30(m *models.ACL) uint64

HashAclV30 computes a content hash for cache lookup.

func HashAclV31

func HashAclV31(m *models.ACL) uint64

HashAclV31 computes a content hash for cache lookup.

func HashAclV32

func HashAclV32(m *models.ACL) uint64

HashAclV32 computes a content hash for cache lookup.

func HashAclV33

func HashAclV33(m *models.ACL) uint64

HashAclV33 computes a content hash for cache lookup.

func HashBackendSwitchingRuleV30

func HashBackendSwitchingRuleV30(m *models.BackendSwitchingRule) uint64

HashBackendSwitchingRuleV30 computes a content hash for cache lookup.

func HashBackendSwitchingRuleV31

func HashBackendSwitchingRuleV31(m *models.BackendSwitchingRule) uint64

HashBackendSwitchingRuleV31 computes a content hash for cache lookup.

func HashBackendSwitchingRuleV32

func HashBackendSwitchingRuleV32(m *models.BackendSwitchingRule) uint64

HashBackendSwitchingRuleV32 computes a content hash for cache lookup.

func HashBackendSwitchingRuleV33

func HashBackendSwitchingRuleV33(m *models.BackendSwitchingRule) uint64

HashBackendSwitchingRuleV33 computes a content hash for cache lookup.

func HashBindV30

func HashBindV30(m *models.Bind) uint64

HashBindV30 computes a content hash for cache lookup.

func HashBindV31

func HashBindV31(m *models.Bind) uint64

HashBindV31 computes a content hash for cache lookup.

func HashBindV32

func HashBindV32(m *models.Bind) uint64

HashBindV32 computes a content hash for cache lookup.

func HashBindV33

func HashBindV33(m *models.Bind) uint64

HashBindV33 computes a content hash for cache lookup.

func HashCaptureV30

func HashCaptureV30(m *models.Capture) uint64

HashCaptureV30 computes a content hash for cache lookup.

func HashCaptureV31

func HashCaptureV31(m *models.Capture) uint64

HashCaptureV31 computes a content hash for cache lookup.

func HashCaptureV32

func HashCaptureV32(m *models.Capture) uint64

HashCaptureV32 computes a content hash for cache lookup.

func HashCaptureV33

func HashCaptureV33(m *models.Capture) uint64

HashCaptureV33 computes a content hash for cache lookup.

func HashFilterV30

func HashFilterV30(m *models.Filter) uint64

HashFilterV30 computes a content hash for cache lookup.

func HashFilterV31

func HashFilterV31(m *models.Filter) uint64

HashFilterV31 computes a content hash for cache lookup.

func HashFilterV32

func HashFilterV32(m *models.Filter) uint64

HashFilterV32 computes a content hash for cache lookup.

func HashFilterV33

func HashFilterV33(m *models.Filter) uint64

HashFilterV33 computes a content hash for cache lookup.

func HashHttpAfterResponseRuleV30

func HashHttpAfterResponseRuleV30(m *models.HTTPAfterResponseRule) uint64

HashHttpAfterResponseRuleV30 computes a content hash for cache lookup.

func HashHttpAfterResponseRuleV31

func HashHttpAfterResponseRuleV31(m *models.HTTPAfterResponseRule) uint64

HashHttpAfterResponseRuleV31 computes a content hash for cache lookup.

func HashHttpAfterResponseRuleV32

func HashHttpAfterResponseRuleV32(m *models.HTTPAfterResponseRule) uint64

HashHttpAfterResponseRuleV32 computes a content hash for cache lookup.

func HashHttpAfterResponseRuleV33

func HashHttpAfterResponseRuleV33(m *models.HTTPAfterResponseRule) uint64

HashHttpAfterResponseRuleV33 computes a content hash for cache lookup.

func HashHttpCheckV30

func HashHttpCheckV30(m *models.HTTPCheck) uint64

HashHttpCheckV30 computes a content hash for cache lookup.

func HashHttpCheckV31

func HashHttpCheckV31(m *models.HTTPCheck) uint64

HashHttpCheckV31 computes a content hash for cache lookup.

func HashHttpCheckV32

func HashHttpCheckV32(m *models.HTTPCheck) uint64

HashHttpCheckV32 computes a content hash for cache lookup.

func HashHttpCheckV33

func HashHttpCheckV33(m *models.HTTPCheck) uint64

HashHttpCheckV33 computes a content hash for cache lookup.

func HashHttpErrorRuleV30

func HashHttpErrorRuleV30(m *models.HTTPErrorRule) uint64

HashHttpErrorRuleV30 computes a content hash for cache lookup.

func HashHttpErrorRuleV31

func HashHttpErrorRuleV31(m *models.HTTPErrorRule) uint64

HashHttpErrorRuleV31 computes a content hash for cache lookup.

func HashHttpErrorRuleV32

func HashHttpErrorRuleV32(m *models.HTTPErrorRule) uint64

HashHttpErrorRuleV32 computes a content hash for cache lookup.

func HashHttpErrorRuleV33

func HashHttpErrorRuleV33(m *models.HTTPErrorRule) uint64

HashHttpErrorRuleV33 computes a content hash for cache lookup.

func HashHttpRequestRuleV30

func HashHttpRequestRuleV30(m *models.HTTPRequestRule) uint64

HashHttpRequestRuleV30 computes a content hash for cache lookup.

func HashHttpRequestRuleV31

func HashHttpRequestRuleV31(m *models.HTTPRequestRule) uint64

HashHttpRequestRuleV31 computes a content hash for cache lookup.

func HashHttpRequestRuleV32

func HashHttpRequestRuleV32(m *models.HTTPRequestRule) uint64

HashHttpRequestRuleV32 computes a content hash for cache lookup.

func HashHttpRequestRuleV33

func HashHttpRequestRuleV33(m *models.HTTPRequestRule) uint64

HashHttpRequestRuleV33 computes a content hash for cache lookup.

func HashHttpResponseRuleV30

func HashHttpResponseRuleV30(m *models.HTTPResponseRule) uint64

HashHttpResponseRuleV30 computes a content hash for cache lookup.

func HashHttpResponseRuleV31

func HashHttpResponseRuleV31(m *models.HTTPResponseRule) uint64

HashHttpResponseRuleV31 computes a content hash for cache lookup.

func HashHttpResponseRuleV32

func HashHttpResponseRuleV32(m *models.HTTPResponseRule) uint64

HashHttpResponseRuleV32 computes a content hash for cache lookup.

func HashHttpResponseRuleV33

func HashHttpResponseRuleV33(m *models.HTTPResponseRule) uint64

HashHttpResponseRuleV33 computes a content hash for cache lookup.

func HashLogTargetV30

func HashLogTargetV30(m *models.LogTarget) uint64

HashLogTargetV30 computes a content hash for cache lookup.

func HashLogTargetV31

func HashLogTargetV31(m *models.LogTarget) uint64

HashLogTargetV31 computes a content hash for cache lookup.

func HashLogTargetV32

func HashLogTargetV32(m *models.LogTarget) uint64

HashLogTargetV32 computes a content hash for cache lookup.

func HashLogTargetV33

func HashLogTargetV33(m *models.LogTarget) uint64

HashLogTargetV33 computes a content hash for cache lookup.

func HashServerSwitchingRuleV30

func HashServerSwitchingRuleV30(m *models.ServerSwitchingRule) uint64

HashServerSwitchingRuleV30 computes a content hash for cache lookup.

func HashServerSwitchingRuleV31

func HashServerSwitchingRuleV31(m *models.ServerSwitchingRule) uint64

HashServerSwitchingRuleV31 computes a content hash for cache lookup.

func HashServerSwitchingRuleV32

func HashServerSwitchingRuleV32(m *models.ServerSwitchingRule) uint64

HashServerSwitchingRuleV32 computes a content hash for cache lookup.

func HashServerSwitchingRuleV33

func HashServerSwitchingRuleV33(m *models.ServerSwitchingRule) uint64

HashServerSwitchingRuleV33 computes a content hash for cache lookup.

func HashServerTemplateV30

func HashServerTemplateV30(m *models.ServerTemplate) uint64

HashServerTemplateV30 computes a content hash for cache lookup.

func HashServerTemplateV31

func HashServerTemplateV31(m *models.ServerTemplate) uint64

HashServerTemplateV31 computes a content hash for cache lookup.

func HashServerTemplateV32

func HashServerTemplateV32(m *models.ServerTemplate) uint64

HashServerTemplateV32 computes a content hash for cache lookup.

func HashServerTemplateV33

func HashServerTemplateV33(m *models.ServerTemplate) uint64

HashServerTemplateV33 computes a content hash for cache lookup.

func HashServerV30

func HashServerV30(m *models.Server) uint64

HashServerV30 computes a content hash for cache lookup.

func HashServerV31

func HashServerV31(m *models.Server) uint64

HashServerV31 computes a content hash for cache lookup.

func HashServerV32

func HashServerV32(m *models.Server) uint64

HashServerV32 computes a content hash for cache lookup.

func HashServerV33

func HashServerV33(m *models.Server) uint64

HashServerV33 computes a content hash for cache lookup.

func HashStickRuleV30

func HashStickRuleV30(m *models.StickRule) uint64

HashStickRuleV30 computes a content hash for cache lookup.

func HashStickRuleV31

func HashStickRuleV31(m *models.StickRule) uint64

HashStickRuleV31 computes a content hash for cache lookup.

func HashStickRuleV32

func HashStickRuleV32(m *models.StickRule) uint64

HashStickRuleV32 computes a content hash for cache lookup.

func HashStickRuleV33

func HashStickRuleV33(m *models.StickRule) uint64

HashStickRuleV33 computes a content hash for cache lookup.

func HashTcpCheckV30

func HashTcpCheckV30(m *models.TCPCheck) uint64

HashTcpCheckV30 computes a content hash for cache lookup.

func HashTcpCheckV31

func HashTcpCheckV31(m *models.TCPCheck) uint64

HashTcpCheckV31 computes a content hash for cache lookup.

func HashTcpCheckV32

func HashTcpCheckV32(m *models.TCPCheck) uint64

HashTcpCheckV32 computes a content hash for cache lookup.

func HashTcpCheckV33

func HashTcpCheckV33(m *models.TCPCheck) uint64

HashTcpCheckV33 computes a content hash for cache lookup.

func HashTcpRequestRuleV30

func HashTcpRequestRuleV30(m *models.TCPRequestRule) uint64

HashTcpRequestRuleV30 computes a content hash for cache lookup.

func HashTcpRequestRuleV31

func HashTcpRequestRuleV31(m *models.TCPRequestRule) uint64

HashTcpRequestRuleV31 computes a content hash for cache lookup.

func HashTcpRequestRuleV32

func HashTcpRequestRuleV32(m *models.TCPRequestRule) uint64

HashTcpRequestRuleV32 computes a content hash for cache lookup.

func HashTcpRequestRuleV33

func HashTcpRequestRuleV33(m *models.TCPRequestRule) uint64

HashTcpRequestRuleV33 computes a content hash for cache lookup.

func HashTcpResponseRuleV30

func HashTcpResponseRuleV30(m *models.TCPResponseRule) uint64

HashTcpResponseRuleV30 computes a content hash for cache lookup.

func HashTcpResponseRuleV31

func HashTcpResponseRuleV31(m *models.TCPResponseRule) uint64

HashTcpResponseRuleV31 computes a content hash for cache lookup.

func HashTcpResponseRuleV32

func HashTcpResponseRuleV32(m *models.TCPResponseRule) uint64

HashTcpResponseRuleV32 computes a content hash for cache lookup.

func HashTcpResponseRuleV33

func HashTcpResponseRuleV33(m *models.TCPResponseRule) uint64

HashTcpResponseRuleV33 computes a content hash for cache lookup.

func ValidateAclV30

func ValidateAclV30(m *models.ACL) error

ValidateAclV30 validates a acl model.

func ValidateAclV31

func ValidateAclV31(m *models.ACL) error

ValidateAclV31 validates a acl model.

func ValidateAclV32

func ValidateAclV32(m *models.ACL) error

ValidateAclV32 validates a acl model.

func ValidateAclV33

func ValidateAclV33(m *models.ACL) error

ValidateAclV33 validates a acl model.

func ValidateBackendSwitchingRuleV30

func ValidateBackendSwitchingRuleV30(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRuleV30 validates a backend_switching_rule model.

func ValidateBackendSwitchingRuleV31

func ValidateBackendSwitchingRuleV31(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRuleV31 validates a backend_switching_rule model.

func ValidateBackendSwitchingRuleV32

func ValidateBackendSwitchingRuleV32(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRuleV32 validates a backend_switching_rule model.

func ValidateBackendSwitchingRuleV33

func ValidateBackendSwitchingRuleV33(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRuleV33 validates a backend_switching_rule model.

func ValidateBindV30

func ValidateBindV30(m *models.Bind) error

ValidateBindV30 validates a bind model.

func ValidateBindV31

func ValidateBindV31(m *models.Bind) error

ValidateBindV31 validates a bind model.

func ValidateBindV32

func ValidateBindV32(m *models.Bind) error

ValidateBindV32 validates a bind model.

func ValidateBindV33

func ValidateBindV33(m *models.Bind) error

ValidateBindV33 validates a bind model.

func ValidateCaptureV30

func ValidateCaptureV30(m *models.Capture) error

ValidateCaptureV30 validates a capture model.

func ValidateCaptureV31

func ValidateCaptureV31(m *models.Capture) error

ValidateCaptureV31 validates a capture model.

func ValidateCaptureV32

func ValidateCaptureV32(m *models.Capture) error

ValidateCaptureV32 validates a capture model.

func ValidateCaptureV33

func ValidateCaptureV33(m *models.Capture) error

ValidateCaptureV33 validates a capture model.

func ValidateFilterV30

func ValidateFilterV30(m *models.Filter) error

ValidateFilterV30 validates a filter model.

func ValidateFilterV31

func ValidateFilterV31(m *models.Filter) error

ValidateFilterV31 validates a filter model.

func ValidateFilterV32

func ValidateFilterV32(m *models.Filter) error

ValidateFilterV32 validates a filter model.

func ValidateFilterV33

func ValidateFilterV33(m *models.Filter) error

ValidateFilterV33 validates a filter model.

func ValidateHttpAfterResponseRuleV30

func ValidateHttpAfterResponseRuleV30(m *models.HTTPAfterResponseRule) error

ValidateHttpAfterResponseRuleV30 validates a http_after_response_rule model.

func ValidateHttpAfterResponseRuleV31

func ValidateHttpAfterResponseRuleV31(m *models.HTTPAfterResponseRule) error

ValidateHttpAfterResponseRuleV31 validates a http_after_response_rule model.

func ValidateHttpAfterResponseRuleV32

func ValidateHttpAfterResponseRuleV32(m *models.HTTPAfterResponseRule) error

ValidateHttpAfterResponseRuleV32 validates a http_after_response_rule model.

func ValidateHttpAfterResponseRuleV33

func ValidateHttpAfterResponseRuleV33(m *models.HTTPAfterResponseRule) error

ValidateHttpAfterResponseRuleV33 validates a http_after_response_rule model.

func ValidateHttpCheckV30

func ValidateHttpCheckV30(m *models.HTTPCheck) error

ValidateHttpCheckV30 validates a http_check model.

func ValidateHttpCheckV31

func ValidateHttpCheckV31(m *models.HTTPCheck) error

ValidateHttpCheckV31 validates a http_check model.

func ValidateHttpCheckV32

func ValidateHttpCheckV32(m *models.HTTPCheck) error

ValidateHttpCheckV32 validates a http_check model.

func ValidateHttpCheckV33

func ValidateHttpCheckV33(m *models.HTTPCheck) error

ValidateHttpCheckV33 validates a http_check model.

func ValidateHttpErrorRuleV30

func ValidateHttpErrorRuleV30(m *models.HTTPErrorRule) error

ValidateHttpErrorRuleV30 validates a http_error_rule model.

func ValidateHttpErrorRuleV31

func ValidateHttpErrorRuleV31(m *models.HTTPErrorRule) error

ValidateHttpErrorRuleV31 validates a http_error_rule model.

func ValidateHttpErrorRuleV32

func ValidateHttpErrorRuleV32(m *models.HTTPErrorRule) error

ValidateHttpErrorRuleV32 validates a http_error_rule model.

func ValidateHttpErrorRuleV33

func ValidateHttpErrorRuleV33(m *models.HTTPErrorRule) error

ValidateHttpErrorRuleV33 validates a http_error_rule model.

func ValidateHttpRequestRuleV30

func ValidateHttpRequestRuleV30(m *models.HTTPRequestRule) error

ValidateHttpRequestRuleV30 validates a http_request_rule model.

func ValidateHttpRequestRuleV31

func ValidateHttpRequestRuleV31(m *models.HTTPRequestRule) error

ValidateHttpRequestRuleV31 validates a http_request_rule model.

func ValidateHttpRequestRuleV32

func ValidateHttpRequestRuleV32(m *models.HTTPRequestRule) error

ValidateHttpRequestRuleV32 validates a http_request_rule model.

func ValidateHttpRequestRuleV33

func ValidateHttpRequestRuleV33(m *models.HTTPRequestRule) error

ValidateHttpRequestRuleV33 validates a http_request_rule model.

func ValidateHttpResponseRuleV30

func ValidateHttpResponseRuleV30(m *models.HTTPResponseRule) error

ValidateHttpResponseRuleV30 validates a http_response_rule model.

func ValidateHttpResponseRuleV31

func ValidateHttpResponseRuleV31(m *models.HTTPResponseRule) error

ValidateHttpResponseRuleV31 validates a http_response_rule model.

func ValidateHttpResponseRuleV32

func ValidateHttpResponseRuleV32(m *models.HTTPResponseRule) error

ValidateHttpResponseRuleV32 validates a http_response_rule model.

func ValidateHttpResponseRuleV33

func ValidateHttpResponseRuleV33(m *models.HTTPResponseRule) error

ValidateHttpResponseRuleV33 validates a http_response_rule model.

func ValidateLogTargetV30

func ValidateLogTargetV30(m *models.LogTarget) error

ValidateLogTargetV30 validates a log_target model.

func ValidateLogTargetV31

func ValidateLogTargetV31(m *models.LogTarget) error

ValidateLogTargetV31 validates a log_target model.

func ValidateLogTargetV32

func ValidateLogTargetV32(m *models.LogTarget) error

ValidateLogTargetV32 validates a log_target model.

func ValidateLogTargetV33

func ValidateLogTargetV33(m *models.LogTarget) error

ValidateLogTargetV33 validates a log_target model.

func ValidateServerSwitchingRuleV30

func ValidateServerSwitchingRuleV30(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRuleV30 validates a server_switching_rule model.

func ValidateServerSwitchingRuleV31

func ValidateServerSwitchingRuleV31(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRuleV31 validates a server_switching_rule model.

func ValidateServerSwitchingRuleV32

func ValidateServerSwitchingRuleV32(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRuleV32 validates a server_switching_rule model.

func ValidateServerSwitchingRuleV33

func ValidateServerSwitchingRuleV33(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRuleV33 validates a server_switching_rule model.

func ValidateServerTemplateV30

func ValidateServerTemplateV30(m *models.ServerTemplate) error

ValidateServerTemplateV30 validates a server_template model.

func ValidateServerTemplateV31

func ValidateServerTemplateV31(m *models.ServerTemplate) error

ValidateServerTemplateV31 validates a server_template model.

func ValidateServerTemplateV32

func ValidateServerTemplateV32(m *models.ServerTemplate) error

ValidateServerTemplateV32 validates a server_template model.

func ValidateServerTemplateV33

func ValidateServerTemplateV33(m *models.ServerTemplate) error

ValidateServerTemplateV33 validates a server_template model.

func ValidateServerV30

func ValidateServerV30(m *models.Server) error

ValidateServerV30 validates a server model.

func ValidateServerV31

func ValidateServerV31(m *models.Server) error

ValidateServerV31 validates a server model.

func ValidateServerV32

func ValidateServerV32(m *models.Server) error

ValidateServerV32 validates a server model.

func ValidateServerV33

func ValidateServerV33(m *models.Server) error

ValidateServerV33 validates a server model.

func ValidateStickRuleV30

func ValidateStickRuleV30(m *models.StickRule) error

ValidateStickRuleV30 validates a stick_rule model.

func ValidateStickRuleV31

func ValidateStickRuleV31(m *models.StickRule) error

ValidateStickRuleV31 validates a stick_rule model.

func ValidateStickRuleV32

func ValidateStickRuleV32(m *models.StickRule) error

ValidateStickRuleV32 validates a stick_rule model.

func ValidateStickRuleV33

func ValidateStickRuleV33(m *models.StickRule) error

ValidateStickRuleV33 validates a stick_rule model.

func ValidateTcpCheckV30

func ValidateTcpCheckV30(m *models.TCPCheck) error

ValidateTcpCheckV30 validates a tcp_check model.

func ValidateTcpCheckV31

func ValidateTcpCheckV31(m *models.TCPCheck) error

ValidateTcpCheckV31 validates a tcp_check model.

func ValidateTcpCheckV32

func ValidateTcpCheckV32(m *models.TCPCheck) error

ValidateTcpCheckV32 validates a tcp_check model.

func ValidateTcpCheckV33

func ValidateTcpCheckV33(m *models.TCPCheck) error

ValidateTcpCheckV33 validates a tcp_check model.

func ValidateTcpRequestRuleV30

func ValidateTcpRequestRuleV30(m *models.TCPRequestRule) error

ValidateTcpRequestRuleV30 validates a tcp_request_rule model.

func ValidateTcpRequestRuleV31

func ValidateTcpRequestRuleV31(m *models.TCPRequestRule) error

ValidateTcpRequestRuleV31 validates a tcp_request_rule model.

func ValidateTcpRequestRuleV32

func ValidateTcpRequestRuleV32(m *models.TCPRequestRule) error

ValidateTcpRequestRuleV32 validates a tcp_request_rule model.

func ValidateTcpRequestRuleV33

func ValidateTcpRequestRuleV33(m *models.TCPRequestRule) error

ValidateTcpRequestRuleV33 validates a tcp_request_rule model.

func ValidateTcpResponseRuleV30

func ValidateTcpResponseRuleV30(m *models.TCPResponseRule) error

ValidateTcpResponseRuleV30 validates a tcp_response_rule model.

func ValidateTcpResponseRuleV31

func ValidateTcpResponseRuleV31(m *models.TCPResponseRule) error

ValidateTcpResponseRuleV31 validates a tcp_response_rule model.

func ValidateTcpResponseRuleV32

func ValidateTcpResponseRuleV32(m *models.TCPResponseRule) error

ValidateTcpResponseRuleV32 validates a tcp_response_rule model.

func ValidateTcpResponseRuleV33

func ValidateTcpResponseRuleV33(m *models.TCPResponseRule) error

ValidateTcpResponseRuleV33 validates a tcp_response_rule model.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache provides a sharded LRU cache for validation results. It uses content-based hashing to achieve high cache hit rates for template-driven configurations that produce repetitive models.

Thread-safe: hashicorp/golang-lru is internally synchronized.

func NewCache

func NewCache() *Cache

NewCache creates a new validation cache with sharded LRU caches.

func (*Cache) Add

func (c *Cache) Add(hash uint64, result error)

Add stores a validation result in the cache.

func (*Cache) Get

func (c *Cache) Get(hash uint64) (error, bool)

Get retrieves a cached validation result.

func (*Cache) Len

func (c *Cache) Len() int

Len returns the total number of cached entries across all shards.

func (*Cache) Purge

func (c *Cache) Purge()

Purge clears all entries from the cache.

func (*Cache) Stats

func (c *Cache) Stats() Stats

Stats returns current cache statistics.

type CachedValidator

type CachedValidator struct {
	// contains filtered or unexported fields
}

CachedValidator provides cached validation for HAProxy models. It combines a Cache with a ValidatorSet to provide high-performance validation with content-based caching.

func NewCachedValidator

func NewCachedValidator(major, minor int) *CachedValidator

NewCachedValidator creates a new cached validator for a specific HAProxy version.

func NewCachedValidatorWithCache

func NewCachedValidatorWithCache(cache *Cache, major, minor int) *CachedValidator

NewCachedValidatorWithCache creates a cached validator with a pre-existing cache. Use this to share a cache across multiple validator instances.

func (*CachedValidator) Cache

func (c *CachedValidator) Cache() *Cache

Cache returns the underlying cache.

func (*CachedValidator) ValidateACL

func (c *CachedValidator) ValidateACL(m *models.ACL) error

ValidateACL validates an ACL with caching.

func (*CachedValidator) ValidateBackendSwitchingRule

func (c *CachedValidator) ValidateBackendSwitchingRule(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRule validates a BackendSwitchingRule with caching.

func (*CachedValidator) ValidateBind

func (c *CachedValidator) ValidateBind(m *models.Bind) error

ValidateBind validates a Bind with caching.

func (*CachedValidator) ValidateCapture

func (c *CachedValidator) ValidateCapture(m *models.Capture) error

ValidateCapture validates a Capture with caching.

func (*CachedValidator) ValidateFilter

func (c *CachedValidator) ValidateFilter(m *models.Filter) error

ValidateFilter validates a Filter with caching.

func (*CachedValidator) ValidateHTTPAfterResponseRule

func (c *CachedValidator) ValidateHTTPAfterResponseRule(m *models.HTTPAfterResponseRule) error

ValidateHTTPAfterResponseRule validates an HTTPAfterResponseRule with caching.

func (*CachedValidator) ValidateHTTPCheck

func (c *CachedValidator) ValidateHTTPCheck(m *models.HTTPCheck) error

ValidateHTTPCheck validates an HTTPCheck with caching.

func (*CachedValidator) ValidateHTTPErrorRule

func (c *CachedValidator) ValidateHTTPErrorRule(m *models.HTTPErrorRule) error

ValidateHTTPErrorRule validates an HTTPErrorRule with caching.

func (*CachedValidator) ValidateHTTPRequestRule

func (c *CachedValidator) ValidateHTTPRequestRule(m *models.HTTPRequestRule) error

ValidateHTTPRequestRule validates an HTTPRequestRule with caching.

func (*CachedValidator) ValidateHTTPResponseRule

func (c *CachedValidator) ValidateHTTPResponseRule(m *models.HTTPResponseRule) error

ValidateHTTPResponseRule validates an HTTPResponseRule with caching.

func (*CachedValidator) ValidateLogTarget

func (c *CachedValidator) ValidateLogTarget(m *models.LogTarget) error

ValidateLogTarget validates a LogTarget with caching.

func (*CachedValidator) ValidateServer

func (c *CachedValidator) ValidateServer(m *models.Server) error

ValidateServer validates a Server with caching.

func (*CachedValidator) ValidateServerSwitchingRule

func (c *CachedValidator) ValidateServerSwitchingRule(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRule validates a ServerSwitchingRule with caching.

func (*CachedValidator) ValidateServerTemplate

func (c *CachedValidator) ValidateServerTemplate(m *models.ServerTemplate) error

ValidateServerTemplate validates a ServerTemplate with caching.

func (*CachedValidator) ValidateStickRule

func (c *CachedValidator) ValidateStickRule(m *models.StickRule) error

ValidateStickRule validates a StickRule with caching.

func (*CachedValidator) ValidateTCPCheck

func (c *CachedValidator) ValidateTCPCheck(m *models.TCPCheck) error

ValidateTCPCheck validates a TCPCheck with caching.

func (*CachedValidator) ValidateTCPRequestRule

func (c *CachedValidator) ValidateTCPRequestRule(m *models.TCPRequestRule) error

ValidateTCPRequestRule validates a TCPRequestRule with caching.

func (*CachedValidator) ValidateTCPResponseRule

func (c *CachedValidator) ValidateTCPResponseRule(m *models.TCPResponseRule) error

ValidateTCPResponseRule validates a TCPResponseRule with caching.

func (*CachedValidator) ValidatorSet

func (c *CachedValidator) ValidatorSet() *ValidatorSet

ValidatorSet returns the underlying validator set.

type Stats

type Stats struct {
	Entries int
	Shards  int
}

Stats returns cache statistics.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a validation failure for a specific field.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

type ValidatorSet

type ValidatorSet struct {
	// contains filtered or unexported fields
}

ValidatorSet provides type-specific validation functions for a HAProxy version. Each method validates a model directly without JSON conversion.

func ForVersion

func ForVersion(major, minor int) *ValidatorSet

ForVersion returns the ValidatorSet for a specific HAProxy version. Returns v33 for 3.3+, v32 for 3.2, v31 for 3.1, v30 for 3.0 and below.

func (*ValidatorSet) HashACL

func (v *ValidatorSet) HashACL(m *models.ACL) uint64

HashACL computes a content hash for an ACL model.

func (*ValidatorSet) HashBackendSwitchingRule

func (v *ValidatorSet) HashBackendSwitchingRule(m *models.BackendSwitchingRule) uint64

HashBackendSwitchingRule computes a content hash for a BackendSwitchingRule model.

func (*ValidatorSet) HashBind

func (v *ValidatorSet) HashBind(m *models.Bind) uint64

HashBind computes a content hash for a Bind model.

func (*ValidatorSet) HashCapture

func (v *ValidatorSet) HashCapture(m *models.Capture) uint64

HashCapture computes a content hash for a Capture model.

func (*ValidatorSet) HashFilter

func (v *ValidatorSet) HashFilter(m *models.Filter) uint64

HashFilter computes a content hash for a Filter model.

func (*ValidatorSet) HashHTTPAfterResponseRule

func (v *ValidatorSet) HashHTTPAfterResponseRule(m *models.HTTPAfterResponseRule) uint64

HashHTTPAfterResponseRule computes a content hash for an HTTPAfterResponseRule model.

func (*ValidatorSet) HashHTTPCheck

func (v *ValidatorSet) HashHTTPCheck(m *models.HTTPCheck) uint64

HashHTTPCheck computes a content hash for an HTTPCheck model.

func (*ValidatorSet) HashHTTPErrorRule

func (v *ValidatorSet) HashHTTPErrorRule(m *models.HTTPErrorRule) uint64

HashHTTPErrorRule computes a content hash for an HTTPErrorRule model.

func (*ValidatorSet) HashHTTPRequestRule

func (v *ValidatorSet) HashHTTPRequestRule(m *models.HTTPRequestRule) uint64

HashHTTPRequestRule computes a content hash for an HTTPRequestRule model.

func (*ValidatorSet) HashHTTPResponseRule

func (v *ValidatorSet) HashHTTPResponseRule(m *models.HTTPResponseRule) uint64

HashHTTPResponseRule computes a content hash for an HTTPResponseRule model.

func (*ValidatorSet) HashLogTarget

func (v *ValidatorSet) HashLogTarget(m *models.LogTarget) uint64

HashLogTarget computes a content hash for a LogTarget model.

func (*ValidatorSet) HashServer

func (v *ValidatorSet) HashServer(m *models.Server) uint64

HashServer computes a content hash for a Server model.

func (*ValidatorSet) HashServerSwitchingRule

func (v *ValidatorSet) HashServerSwitchingRule(m *models.ServerSwitchingRule) uint64

HashServerSwitchingRule computes a content hash for a ServerSwitchingRule model.

func (*ValidatorSet) HashServerTemplate

func (v *ValidatorSet) HashServerTemplate(m *models.ServerTemplate) uint64

HashServerTemplate computes a content hash for a ServerTemplate model.

func (*ValidatorSet) HashStickRule

func (v *ValidatorSet) HashStickRule(m *models.StickRule) uint64

HashStickRule computes a content hash for a StickRule model.

func (*ValidatorSet) HashTCPCheck

func (v *ValidatorSet) HashTCPCheck(m *models.TCPCheck) uint64

HashTCPCheck computes a content hash for a TCPCheck model.

func (*ValidatorSet) HashTCPRequestRule

func (v *ValidatorSet) HashTCPRequestRule(m *models.TCPRequestRule) uint64

HashTCPRequestRule computes a content hash for a TCPRequestRule model.

func (*ValidatorSet) HashTCPResponseRule

func (v *ValidatorSet) HashTCPResponseRule(m *models.TCPResponseRule) uint64

HashTCPResponseRule computes a content hash for a TCPResponseRule model.

func (*ValidatorSet) ValidateACL

func (v *ValidatorSet) ValidateACL(m *models.ACL) error

ValidateACL validates an ACL model.

func (*ValidatorSet) ValidateBackendSwitchingRule

func (v *ValidatorSet) ValidateBackendSwitchingRule(m *models.BackendSwitchingRule) error

ValidateBackendSwitchingRule validates a BackendSwitchingRule model.

func (*ValidatorSet) ValidateBind

func (v *ValidatorSet) ValidateBind(m *models.Bind) error

ValidateBind validates a Bind model.

func (*ValidatorSet) ValidateCapture

func (v *ValidatorSet) ValidateCapture(m *models.Capture) error

ValidateCapture validates a Capture model.

func (*ValidatorSet) ValidateFilter

func (v *ValidatorSet) ValidateFilter(m *models.Filter) error

ValidateFilter validates a Filter model.

func (*ValidatorSet) ValidateHTTPAfterResponseRule

func (v *ValidatorSet) ValidateHTTPAfterResponseRule(m *models.HTTPAfterResponseRule) error

ValidateHTTPAfterResponseRule validates an HTTPAfterResponseRule model.

func (*ValidatorSet) ValidateHTTPCheck

func (v *ValidatorSet) ValidateHTTPCheck(m *models.HTTPCheck) error

ValidateHTTPCheck validates an HTTPCheck model.

func (*ValidatorSet) ValidateHTTPErrorRule

func (v *ValidatorSet) ValidateHTTPErrorRule(m *models.HTTPErrorRule) error

ValidateHTTPErrorRule validates an HTTPErrorRule model.

func (*ValidatorSet) ValidateHTTPRequestRule

func (v *ValidatorSet) ValidateHTTPRequestRule(m *models.HTTPRequestRule) error

ValidateHTTPRequestRule validates an HTTPRequestRule model.

func (*ValidatorSet) ValidateHTTPResponseRule

func (v *ValidatorSet) ValidateHTTPResponseRule(m *models.HTTPResponseRule) error

ValidateHTTPResponseRule validates an HTTPResponseRule model.

func (*ValidatorSet) ValidateLogTarget

func (v *ValidatorSet) ValidateLogTarget(m *models.LogTarget) error

ValidateLogTarget validates a LogTarget model.

func (*ValidatorSet) ValidateServer

func (v *ValidatorSet) ValidateServer(m *models.Server) error

ValidateServer validates a Server model.

func (*ValidatorSet) ValidateServerSwitchingRule

func (v *ValidatorSet) ValidateServerSwitchingRule(m *models.ServerSwitchingRule) error

ValidateServerSwitchingRule validates a ServerSwitchingRule model.

func (*ValidatorSet) ValidateServerTemplate

func (v *ValidatorSet) ValidateServerTemplate(m *models.ServerTemplate) error

ValidateServerTemplate validates a ServerTemplate model.

func (*ValidatorSet) ValidateStickRule

func (v *ValidatorSet) ValidateStickRule(m *models.StickRule) error

ValidateStickRule validates a StickRule model.

func (*ValidatorSet) ValidateTCPCheck

func (v *ValidatorSet) ValidateTCPCheck(m *models.TCPCheck) error

ValidateTCPCheck validates a TCPCheck model.

func (*ValidatorSet) ValidateTCPRequestRule

func (v *ValidatorSet) ValidateTCPRequestRule(m *models.TCPRequestRule) error

ValidateTCPRequestRule validates a TCPRequestRule model.

func (*ValidatorSet) ValidateTCPResponseRule

func (v *ValidatorSet) ValidateTCPResponseRule(m *models.TCPResponseRule) error

ValidateTCPResponseRule validates a TCPResponseRule model.

func (*ValidatorSet) Version

func (v *ValidatorSet) Version() string

Version returns the HAProxy version string for this validator set.

Jump to

Keyboard shortcuts

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