utils

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Direct = direct{}

Direct is a direct proxy: one that makes network connections directly.

Functions

func CanonicalHash

func CanonicalHash(in []byte) (string, error)

func ClientIdentifierFromContext added in v0.0.17

func ClientIdentifierFromContext(ctx context.Context) domain.ClientIdentifier

func CompareJson

func CompareJson(a, b []byte) bool

func ContextFromGeneric

func ContextFromGeneric(parent context.Context, generic domain.Generic) context.Context

func ContextFromIdentifiers added in v0.0.5

func ContextFromIdentifiers(parent context.Context, id domain.ClientIdentifier) context.Context

func DeptMsgIdFromContext added in v0.0.59

func DeptMsgIdFromContext(ctx context.Context) (int, string)

func FileContent added in v0.0.65

func FileContent(path string) []byte

func FileToUnstructured added in v0.0.65

func FileToUnstructured(path string) *unstructured.Unstructured

func GetDialer added in v0.0.32

func GetDialer() func(context.Context, string, string) (net.Conn, error)

GetDialer returns a net.DialContext function that uses a proxy if necessary. HTTP_PROXY and HTTPS_PROXY are used to determine the proxy to use. NO_PROXY is currently ignored.

func GreaterOrEqualVersion added in v0.0.63

func GreaterOrEqualVersion(a string, b string) bool

GreaterOrEqualVersion returns true if a version is greater or equal to b

func IsBatchMessageSupported added in v0.0.63

func IsBatchMessageSupported(version string) bool

func NewBackOff added in v0.0.32

func NewBackOff() backoff.BackOff

func NewClient

func NewClient() (dynamic.Interface, error)

func NewMsgId added in v0.0.59

func NewMsgId() string

func PulsarMessageIDtoString

func PulsarMessageIDtoString(msgID pulsar.MessageID) string

PulsarMessageIDtoString is taken from github.com/kubescape/event-ingester-service/utils/common.go:func PulsarMessageIDtoString

func RemoveManagedFields added in v0.0.26

func RemoveManagedFields(d *unstructured.Unstructured)

func RemoveSpecificFields added in v0.0.65

func RemoveSpecificFields(d *unstructured.Unstructured, fields [][]string) error

func ServePprof added in v0.0.36

func ServePprof()

func StartLivenessProbe added in v0.0.17

func StartLivenessProbe()

func StringValueBigger added in v0.0.17

func StringValueBigger(s1, s2 string) bool

Types

type CooldownQueue added in v0.0.8

type CooldownQueue struct {

	// public channel for reading events
	ResultChan <-chan watch.Event
	// contains filtered or unexported fields
}

CooldownQueue is a queue that lets clients put events into it with a cooldown

When a client puts an event into a queue, it waits for a cooldown period before the event is forwarded to the consumer. If and event for the same key is put into the queue again before the cooldown period is over, the event is overridden and the cooldown period is reset.

func NewCooldownQueue added in v0.0.8

func NewCooldownQueue() *CooldownQueue

NewCooldownQueue returns a new Cooldown Queue

func (*CooldownQueue) Closed added in v0.0.25

func (q *CooldownQueue) Closed() bool

func (*CooldownQueue) Enqueue added in v0.0.8

func (q *CooldownQueue) Enqueue(e watch.Event)

Enqueue enqueues an event in the Cooldown Queue

func (*CooldownQueue) Stop added in v0.0.8

func (q *CooldownQueue) Stop()

Jump to

Keyboard shortcuts

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