helpers

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 16 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 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 NewLogger

func NewLogger(level int) *logger.Logger

func ReadJSON

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

func ReadYAML

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

Types

type Asset

type Asset struct {
	Name            string   `yaml:"name"`
	Hostnames       []string `yaml:"hostnames"`
	IPs             []string `yaml:"ips"`
	Confidentiality int      `yaml:"confidentiality"`
	Availability    int      `yaml:"availability"`
	Integrity       int      `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 {
	Groks         []Grok                            `yaml:"groks,omitempty"`
	Trims         []Trim                            `yaml:"trims,omitempty"`
	Renames       []Rename                          `yaml:"renames,omitempty"`
	Casts         []Cast                            `yaml:"casts,omitempty"`
	Reformats     []Reformat                        `yaml:"reformats,omitempty"`
	Deletes       []Delete                          `yaml:"deletes,omitempty"`
	Tenants       []Tenant                          `yaml:"tenants,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 Delete

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

type Env

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

type Grok

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

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"`
	Format    string   `yaml:"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"`
	Type      string   `yaml:"type"`
	Substring string   `yaml:"substring"`
	Fields    []string `yaml:"fields"`
}

Jump to

Keyboard shortcuts

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