exprhelpers

package
v1.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CTIApiEnabled = true

this is set for non-recoverable errors, such as 403 when querying API or empty API key

View Source
var CTIApiKey = ""
View Source
var CTIBackOffDuration time.Duration = 5 * time.Minute
View Source
var CTIBackOffUntil time.Time

when hitting quotas or auth errors, we temporarily disable the API

View Source
var CTICache gcache.Cache

Cache for responses

View Source
var CTIUrl = "https://cti.api.crowdsec.net"
View Source
var CTIUrlSuffix = "/v2/smoke/"
View Source
var CacheExpiration time.Duration

Functions

func Atof

func Atof(x string) float64

func CrowdsecCTI added in v1.5.0

func CrowdsecCTI(ip string) (*cticlient.SmokeItem, error)

func CrowdsecCTIInitCache added in v1.5.0

func CrowdsecCTIInitCache(size int, ttl time.Duration)

func File added in v0.1.0

func File(filename string) []string

func FileInit added in v0.1.0

func FileInit(fileFolder string, filename string, fileType string) error

func Get added in v1.5.0

func Get(arr []string, index int) string

func GetDecisionsCount added in v1.4.0

func GetDecisionsCount(value string) int

func GetDecisionsSinceCount added in v1.4.0

func GetDecisionsSinceCount(value string, since string) int

func GetExprEnv

func GetExprEnv(ctx map[string]interface{}) map[string]interface{}

func Init added in v0.1.0

func Init(databaseClient *database.Client) error

func InitCrowdsecCTI added in v1.5.0

func InitCrowdsecCTI(Key *string, TTL *time.Duration, Size *int, LogLevel *log.Level) error

func IpInRange added in v0.2.3

func IpInRange(ip string, ipRange string) bool

func IpToRange added in v1.3.1

func IpToRange(ip string, cidr string) string

func IsIP added in v1.5.0

func IsIP(ip string) bool

func IsIPV4 added in v1.5.0

func IsIPV4(ip string) bool

func IsIPV6 added in v1.4.0

func IsIPV6(ip string) bool

func JsonExtract added in v0.0.3

func JsonExtract(jsblob string, target string) string

func JsonExtractLib added in v0.0.3

func JsonExtractLib(jsblob string, target ...string) string

func JsonExtractObject added in v1.4.0

func JsonExtractObject(jsblob string, target string) map[string]interface{}

func JsonExtractSlice added in v1.4.0

func JsonExtractSlice(jsblob string, target string) []interface{}

func JsonExtractUnescape added in v1.2.0

func JsonExtractUnescape(jsblob string, target ...string) string

func KeyExists added in v1.2.1

func KeyExists(key string, dict map[string]interface{}) bool

func LookupHost added in v1.4.2

func LookupHost(value string) []string

func Lower added in v1.2.2

func Lower(s string) string

func ParseUnix added in v1.5.0

func ParseUnix(value string) string

func ParseUnixTime added in v1.5.0

func ParseUnixTime(value string) (time.Time, error)

func ParseUri added in v1.2.1

func ParseUri(uri string) map[string][]string

func PathEscape added in v1.2.2

func PathEscape(s string) string

func PathUnescape added in v1.2.2

func PathUnescape(s string) string

func QueryEscape added in v1.2.2

func QueryEscape(s string) string

func QueryUnescape added in v1.2.2

func QueryUnescape(s string) string

func RegexpInFile added in v0.1.0

func RegexpInFile(data string, filename string) bool

func ShutdownCrowdsecCTI added in v1.5.0

func ShutdownCrowdsecCTI()

func TimeNow added in v1.0.13

func TimeNow() string

func ToJson added in v1.4.0

func ToJson(obj interface{}) string

func Upper added in v0.1.0

func Upper(s string) string

func XMLGetAttributeValue added in v1.4.0

func XMLGetAttributeValue(xmlString string, path string, attributeName string) string

func XMLGetNodeValue added in v1.4.0

func XMLGetNodeValue(xmlString string, path string) string

Types

type ExprDebugger added in v0.3.1

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

ExprDebugger contains the list of expression to be run when debugging an expression filter

func NewDebugger added in v0.3.1

func NewDebugger(filter string, exprEnv expr.Option) (*ExprDebugger, error)

NewDebugger is the exported function that build the debuggers expressions

func (*ExprDebugger) Run added in v0.3.1

func (e *ExprDebugger) Run(logger *logrus.Entry, filterResult bool, exprEnv map[string]interface{})

Run display the content of each variable of a filter by evaluating them with expr, again the expr environment given in parameter

Jump to

Keyboard shortcuts

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