rules

package
v1.10.7 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREATED   ruleState = 0
	TO_CREATE ruleState = 1
	TO_DELETE ruleState = 2
)

Variables

View Source
var HTTPACLVar = "txn.path_match"

HTTPACLVar used to match against RuleID in haproxy http frontend

View Source
var TCPACLVar = "txn.sni_match"

TCPACLVar used to match against RuleID in haproxy ssl frontend

Functions

This section is empty.

Types

type List

type List []Rule

func (*List) Add

func (rules *List) Add(rule Rule)

type ReqAcceptContent

type ReqAcceptContent struct{}

func (ReqAcceptContent) Create

func (r ReqAcceptContent) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqAcceptContent) GetType

func (r ReqAcceptContent) GetType() Type

type ReqBasicAuth

type ReqBasicAuth struct {
	Credentials map[string][]byte
	AuthGroup   string
	AuthRealm   string
}

func (ReqBasicAuth) Create

func (r ReqBasicAuth) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) (err error)

func (ReqBasicAuth) GetType

func (r ReqBasicAuth) GetType() Type

type ReqCapture

type ReqCapture struct {
	Expression string
	CaptureLen int64
}

func (ReqCapture) Create

func (r ReqCapture) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqCapture) GetType

func (r ReqCapture) GetType() Type

type ReqDeny

type ReqDeny struct {
	SrcIPsMap maps.Path
	Whitelist bool
}

func (ReqDeny) Create

func (r ReqDeny) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqDeny) GetType

func (r ReqDeny) GetType() Type

type ReqInspectDelay

type ReqInspectDelay struct {
	Timeout *int64
}

func (ReqInspectDelay) Create

func (r ReqInspectDelay) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqInspectDelay) GetType

func (r ReqInspectDelay) GetType() Type

type ReqPathRewrite

type ReqPathRewrite struct {
	PathMatch string
	PathFmt   string
}

func (ReqPathRewrite) Create

func (r ReqPathRewrite) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqPathRewrite) GetType

func (r ReqPathRewrite) GetType() Type

type ReqProxyProtocol

type ReqProxyProtocol struct {
	SrcIPsMap maps.Path
}

func (ReqProxyProtocol) Create

func (r ReqProxyProtocol) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqProxyProtocol) GetType

func (r ReqProxyProtocol) GetType() Type

type ReqRateLimit

type ReqRateLimit struct {
	TableName      string
	ReqsLimit      int64
	DenyStatusCode int64
}

func (ReqRateLimit) Create

func (r ReqRateLimit) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqRateLimit) GetType

func (r ReqRateLimit) GetType() Type

type ReqSetSrc

type ReqSetSrc struct {
	HeaderName string
}

func (ReqSetSrc) Create

func (r ReqSetSrc) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqSetSrc) GetType

func (r ReqSetSrc) GetType() Type

type ReqSetVar

type ReqSetVar struct {
	Name       string
	Scope      string
	Expression string
	CondTest   string
}

func (ReqSetVar) Create

func (r ReqSetVar) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqSetVar) GetType

func (r ReqSetVar) GetType() Type

type ReqTrack

type ReqTrack struct {
	TableName   string
	TablePeriod *int64
	TableSize   *int64
	TrackKey    string
}

func (ReqTrack) Create

func (r ReqTrack) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (ReqTrack) GetType

func (r ReqTrack) GetType() Type

type RequestRedirect

type RequestRedirect struct {
	Host         string
	RedirectCode int64
	RedirectPort int
	SSLRequest   bool
	SSLRedirect  bool
}

func (RequestRedirect) Create

func (r RequestRedirect) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (RequestRedirect) GetType

func (r RequestRedirect) GetType() Type

type Rule

type Rule interface {
	Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error
	GetType() Type
}

type RuleID

type RuleID string

RuleID uniquely identify a HAProxy Rule

func GetID

func GetID(rule Rule) RuleID

type Rules

type Rules interface {
	AddRule(frontend string, rule Rule, ingressRule bool) error
	DeleteFTRules(frontend string)
	CleanRules()
	RefreshRules(client api.HAProxyClient) (reload bool)
}

type SectionRules

type SectionRules map[string]*ruleset

func New

func New() *SectionRules

func (SectionRules) AddRule

func (r SectionRules) AddRule(frontend string, rule Rule, ingressRule bool) error

func (SectionRules) CleanRules

func (r SectionRules) CleanRules()

func (SectionRules) DeleteFTRules

func (r SectionRules) DeleteFTRules(frontend string)

func (SectionRules) RefreshRules

func (r SectionRules) RefreshRules(client api.HAProxyClient) (reload bool)

type SetHdr

type SetHdr struct {
	HdrName        string
	HdrFormat      string
	CondTest       string
	Cond           string
	Type           Type
	Response       bool
	ForwardedProto bool
}

func (SetHdr) Create

func (r SetHdr) Create(client api.HAProxyClient, frontend *models.Frontend, ingressACL string) error

func (SetHdr) GetType

func (r SetHdr) GetType() Type

type Type

type Type int

Order matters ! Rules will be evaluated by HAProxy in the defined order.

const (
	REQ_ACCEPT_CONTENT Type = iota
	REQ_INSPECT_DELAY
	REQ_PROXY_PROTOCOL
	REQ_SET_VAR
	REQ_SET_SRC
	REQ_DENY
	REQ_TRACK
	REQ_AUTH
	REQ_RATELIMIT
	REQ_CAPTURE
	REQ_REDIRECT
	REQ_FORWARDED_PROTO
	REQ_SET_HEADER
	REQ_SET_HOST
	REQ_PATH_REWRITE
	RES_SET_HEADER
)

Jump to

Keyboard shortcuts

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