utils

package
v0.0.0-...-5562d03 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string
	Commit    string
	BuildTime string
)

Functions

func GetConfigFileFromRegistry

func GetConfigFileFromRegistry(ctx context.Context, registryID string) (string, regCreds, error)

func GetCredentialsFromRegistry

func GetCredentialsFromRegistry(ctx context.Context, registryID string) (regCreds, error)

func GetEntityIdFromScanID

func GetEntityIdFromScanID(ctx context.Context, scanId, scanType string, tx neo4j.ExplicitTransaction) (string, error)

func GetVulnerabilityNodeID

func GetVulnerabilityNodeID(packageName, cveID, entityID string) string

func Recoverer

func Recoverer(h asynq.Handler) asynq.Handler

Recoverer recovers from any panic in the handler and appends RecoveredPanicError with the stacktrace to any error returned from the handler.

func RunCommand

func RunCommand(cmd *exec.Cmd) (*bytes.Buffer, error)

func TimeRangeFilter

func TimeRangeFilter(key string, start, end time.Time) []reporters.CompareFilter

func UpdateRules

func UpdateRules(ctx context.Context, path string, rulesPath string) error

Types

type Config

type Config struct {
	Debug                 bool     `default:"false"`
	Mode                  string   `default:"worker" required:"true"`
	MetricsPort           string   `default:"8181" split_words:"true"`
	KafkaBrokers          []string `default:"deepfence-kafka-broker:9092" required:"true" split_words:"true"`
	KafkaTopicPartitions  int32    `default:"1" split_words:"true"`
	KafkaTopicReplicas    int16    `default:"1" split_words:"true"`
	KafkaTopicRetentionMs string   `default:"86400000" split_words:"true"`
	RedisHost             string   `default:"deepfence-redis" required:"true" split_words:"true"`
	RedisDbNumber         int      `default:"0" split_words:"true"`
	RedisPort             string   `default:"6379" split_words:"true"`
	RedisPassword         string   `default:"" split_words:"true"`
	TasksConcurrency      int      `default:"50" split_words:"true"`
	ProcessQueues         []string `split_words:"true"`
	MaxScanWorkload       int      `default:"5" split_words:"true"`
}

type RecoveredPanicError

type RecoveredPanicError struct {
	V          interface{}
	Stacktrace string
}

RecoveredPanicError holds the recovered panic's error along with the stacktrace.

func (RecoveredPanicError) Error

func (p RecoveredPanicError) Error() string

type WorkerHandler

type WorkerHandler func(ctx context.Context, t *asynq.Task) error

Jump to

Keyboard shortcuts

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