requestfilter

package
v0.0.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptRule

type AcceptRule struct{}

AcceptRule - always returns nil as a result for Verify

func (AcceptRule) Update

func (a AcceptRule) Update(config FilterConfig) error

func (AcceptRule) Verify

func (a AcceptRule) Verify(request *comm.Request) error

type FilterConfig

type FilterConfig interface {
	GetRequestMaxBytes() uint64
	GetClientSignatureVerificationRequired() bool
}

FilterConfig is an interface that gives the necessary information to verify rules.

type MaxSizeFilter

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

func NewMaxSizeFilter

func NewMaxSizeFilter(config FilterConfig) *MaxSizeFilter

func (*MaxSizeFilter) Update

func (ms *MaxSizeFilter) Update(config FilterConfig) error

func (*MaxSizeFilter) Verify

func (ms *MaxSizeFilter) Verify(request *comm.Request) error

Verify checks that the size of the request does not exceeds the maximal size in bytes.

type PayloadNotEmptyRule

type PayloadNotEmptyRule struct{}

PayloadNotEmptyRule - checks that the payload in the request is not nil.

func (PayloadNotEmptyRule) Update

func (r PayloadNotEmptyRule) Update(config FilterConfig) error

func (PayloadNotEmptyRule) Verify

func (r PayloadNotEmptyRule) Verify(request *comm.Request) error

type Rule

type Rule interface {
	Verify(request *comm.Request) error
	Update(config FilterConfig) error
}

type RulesVerifier

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

Verifier is a struct that holds a slice of rules, used to verify a request.

func NewRulesVerifier

func NewRulesVerifier(rules []Rule) *RulesVerifier

NewRulesVerifier creates a RulesVerifier using the provided ordered list of Rules.

func (*RulesVerifier) AddRule

func (rv *RulesVerifier) AddRule(rule Rule)

func (*RulesVerifier) Update

func (rv *RulesVerifier) Update(config FilterConfig) error

Update the rules in the RulesVerifier with the FilterConfig

func (*RulesVerifier) Verify

func (rv *RulesVerifier) Verify(request *comm.Request) error

Verify checks the request against the rules in order. It returns nil if all rules pass, or an error if any rule fails.

type SigFilter

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

func NewSigFilter

func NewSigFilter(config FilterConfig) *SigFilter

func (*SigFilter) Update

func (sf *SigFilter) Update(config FilterConfig) error

func (*SigFilter) Verify

func (sf *SigFilter) Verify(request *comm.Request) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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