waf

package
v1.35.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackMetadata

type AttackMetadata []struct {
	RetCode int    `json:"ret_code"`
	Flow    string `json:"flow"`
	Step    string `json:"step"`
	Rule    string `json:"rule"`
	Filter  []struct {
		Operator        string        `json:"operator"`
		OperatorValue   string        `json:"operator_value"`
		BindingAccessor string        `json:"binding_accessor"`
		ManifestKey     string        `json:"manifest_key"`
		KeyPath         []interface{} `json:"key_path"`
		ResolvedValue   string        `json:"resolved_value"`
		MatchStatus     string        `json:"match_status"`
	} `json:"filter"`
}

AttackMetadata is the JSON metadata returned the WAF when it matches.

type Context

type Context struct{}

Context is a WAF execution context.

func NewContext

func NewContext(*Handle) *Context

NewContext a new WAF context and increase the number of references to the WAF handle. A nil value is returned when the WAF handle can no longer be used or the WAF context couldn't be created.

func (*Context) Close

func (*Context) Close()

Close the WAF context by releasing its C memory and decreasing the number of references to the WAF handle.

func (*Context) Run

func (*Context) Run(map[string]interface{}, time.Duration) ([]byte, error)

Run the WAF with the given Go values and timeout.

type Handle

type Handle struct{}

Handle represents an instance of the WAF for a given ruleset.

func NewHandle

func NewHandle([]byte) (*Handle, error)

NewHandle creates a new instance of the WAF with the given JSON rule.

func (*Handle) Addresses

func (*Handle) Addresses() []string

Addresses returns the list of addresses the WAF rule is expecting.

func (*Handle) Close

func (*Handle) Close()

Close the WAF and release the underlying C memory as soon as there are no more WAF contexts using the rule.

type RunError

type RunError int

RunError the WAF can return when running it.

const (
	ErrInternal RunError = iota + 1
	ErrInvalidObject
	ErrInvalidArgument
	ErrTimeout
	ErrOutOfMemory
	ErrEmptyRuleAddresses
)

Errors the WAF can return when running it.

func (RunError) Error

func (e RunError) Error() string

Error returns the string representation of the RunError.

type Version

type Version struct{}

Version of the WAF.

func Health

func Health() (*Version, error)

Health allows knowing if the WAF can be used. It returns the current WAF version and a nil error when the WAF library is healthy. Otherwise, it returns a nil version and an error describing the issue.

func (*Version) String

func (*Version) String() string

String returns the string representation of the version.

Directories

Path Synopsis
Package include is required to help go tools support vendoring.
Package include is required to help go tools support vendoring.
lib
darwin-amd64
Package vendor is required to help go tools support vendoring.
Package vendor is required to help go tools support vendoring.
linux-amd64
Package vendor is required to help go tools support vendoring.
Package vendor is required to help go tools support vendoring.

Jump to

Keyboard shortcuts

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