helpers

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastBool

func CastBool(value interface{}) bool

func CastFloat64

func CastFloat64(value interface{}) float64

func CastInt64

func CastInt64(value interface{}) int64

func CastString

func CastString(value interface{}) string

func DoReq

func DoReq[response any](url string,
	data []byte, method string,
	headers map[string]string) (response, int, *logger.Error)

func Download added in v0.3.0

func Download(url, file string) *logger.Error

func GetCelType added in v0.6.4

func GetCelType(t string) *cel.Type

func GetMainIP

func GetMainIP() (string, *logger.Error)

func GetValueOf

func GetValueOf(value gjson.Result) interface{}

func ListFiles

func ListFiles(route string, filter string) []string

func Logger

func Logger() *logger.Logger

func PluginCfg added in v0.2.8

func PluginCfg[t any](name string) (*t, *logger.Error)

func ReadCSV added in v0.4.0

func ReadCSV(url string) ([][]string, *logger.Error)

func ReadJSON

func ReadJSON[t any](f string) (*t, *logger.Error)

func ReadYAML

func ReadYAML[t any](f string) (*t, *logger.Error)

func ToObject added in v0.6.5

func ToObject(str *string, object protoreflect.ProtoMessage) *logger.Error

func ToString added in v0.6.5

func ToString(object protoreflect.ProtoMessage) (*string, *logger.Error)

Types

type Add added in v0.6.0

type Add struct {
	DataTypes []string               `yaml:"data_types"`
	Function  string                 `yaml:"function"`
	Params    map[string]interface{} `yaml:"params"`
	Where     Where                  `yaml:"where"`
}

type Asset

type Asset struct {
	Name            string   `yaml:"name"`
	Hostnames       []string `yaml:"hostnames"`
	IPs             []string `yaml:"ips"`
	Confidentiality int32    `yaml:"confidentiality"`
	Availability    int32    `yaml:"availability"`
	Integrity       int32    `yaml:"integrity"`
}

type Cast

type Cast struct {
	DataTypes []string `yaml:"data_types"`
	To        string   `yaml:"to"`
	Fields    []string `yaml:"fields"`
}

type Config

type Config struct {
	Kv            []Kv                              `yaml:"kv,omitempty"`
	Grok          []Grok                            `yaml:"grok,omitempty"`
	Trim          []Trim                            `yaml:"trim,omitempty"`
	Json          []Json                            `yaml:"json,omitempty"`
	Csv           []Csv                             `yaml:"csv,omitempty"`
	Rename        []Rename                          `yaml:"rename,omitempty"`
	Cast          []Cast                            `yaml:"cast,omitempty"`
	Reformat      []Reformat                        `yaml:"reformat,omitempty"`
	Delete        []Delete                          `yaml:"delete,omitempty"`
	Tenants       []Tenant                          `yaml:"tenants,omitempty"`
	Drop          []Drop                            `yaml:"drop,omitempty"`
	Add           []Add                             `yaml:"add,omitempty"`
	Patterns      map[string]string                 `yaml:"patterns,omitempty"`
	DisabledRules []int64                           `yaml:"disabled_rules,omitempty"`
	Plugins       map[string]map[string]interface{} `yaml:"plugins,omitempty"`
	Env           Env                               `yaml:"-"`
}

func GetCfg

func GetCfg() *Config

type Csv added in v0.7.0

type Csv struct {
	DataTypes []string `yaml:"data_types"`
	Source    string   `yaml:"source"`
	Separator string   `yaml:"separator"`
	Headers   []string `yaml:"headers"`
}

type Delete

type Delete struct {
	DataTypes []string `yaml:"data_types"`
	Fields    []string `yaml:"fields"`
}

type Drop added in v0.6.0

type Drop struct {
	DataTypes []string `yaml:"data_types"`
	Where     Where    `yaml:"where"`
}

type Env

type Env struct {
	NodeName   string
	NodeGroups []string
	Workdir    string
	LogLevel   int
}

type Grok

type Grok struct {
	DataTypes []string  `yaml:"data_types"`
	Patterns  []Pattern `yaml:"patterns"`
}

type Json added in v0.7.0

type Json struct {
	DataTypes []string `yaml:"data_types"`
	Source    string   `yaml:"source"`
}

type Kv added in v0.4.8

type Kv struct {
	DataTypes  []string `yaml:"data_types"`
	FieldSplit string   `yaml:"field_split"`
	ValueSplit string   `yaml:"value_split"`
}

type Pattern

type Pattern struct {
	FieldName string `yaml:"field_name"`
	Pattern   string `yaml:"pattern"`
}

type Reformat added in v0.0.18

type Reformat struct {
	DataTypes  []string `yaml:"data_types"`
	Fields     []string `yaml:"fields"`
	Function   string   `yaml:"function"`
	FromFormat string   `yaml:"from_format"`
	ToFormat   string   `yaml:"to_format"`
}

type Rename

type Rename struct {
	DataTypes []string `yaml:"data_types"`
	To        string   `yaml:"to"`
	From      []string `yaml:"from"`
}

type Tenant

type Tenant struct {
	Name          string  `yaml:"name"`
	Id            string  `yaml:"id"`
	Assets        []Asset `yaml:"assets"`
	DisabledRules []int64 `yaml:"disabled_rules"`
}

type Trim

type Trim struct {
	DataTypes []string `yaml:"data_types"`
	Function  string   `yaml:"function"`
	Substring string   `yaml:"substring"`
	Fields    []string `yaml:"fields"`
}

type Variable added in v0.6.0

type Variable struct {
	Get    string `yaml:"get"`
	As     string `yaml:"as"`
	OfType string `yaml:"of_type"`
}

type Where added in v0.6.0

type Where struct {
	Variables  []Variable `yaml:"variables"`
	Expression string     `yaml:"expression"`
}

func (*Where) Evaluate added in v0.6.6

func (def *Where) Evaluate(event *string) bool

Jump to

Keyboard shortcuts

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