utils

package
v0.0.0-...-0651e20 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenCommonName

func GenCommonName(flag string, index int) string

instance name must meet DNS-1123 standard for keep the container name global unique attach a string

func GenLabelsKey

func GenLabelsKey(prefix, resource string) string

func GenWorkloadInstanceName

func GenWorkloadInstanceName(appName string, index int) string

func GetNormalizedGroupNameVersion

func GetNormalizedGroupNameVersion(group, name, version string) string

func InstallgoroutineDumpGenerator

func InstallgoroutineDumpGenerator()

func IntToLetter

func IntToLetter(i int) string

func InterfaceToString

func InterfaceToString(v interface{}) string

func IsFromSameSubnet

func IsFromSameSubnet(remoteAddr, podIP string) bool

super hack way do subnet match

func IsNumeric

func IsNumeric(s string) bool

func IsURL

func IsURL(url string) bool

func IsValidUUID

func IsValidUUID(u string) error

func JoinStr

func JoinStr(flag string, index int) string

func JoinURL

func JoinURL(base string, paths ...string) string

func NanoTime

func NanoTime() string

func NormalizeString

func NormalizeString(str string) string

func PKCS5Padding

func PKCS5Padding(src []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(src []byte) []byte

func SendHttpRequest

func SendHttpRequest(method, url string, header map[string]string, bodyData []byte, maxRetry int) ([]byte, error)

func ShuffleStrings

func ShuffleStrings(list []string)

func SplitMultiString

func SplitMultiString(s string) []string

func StackTrace

func StackTrace(all bool) string

func UUID

func UUID() string

func ValidateDomainName

func ValidateDomainName(domain string) bool

Types

type AESCipher

type AESCipher struct{}

func (AESCipher) Decrypt

func (ac AESCipher) Decrypt(ciphertext []byte, key []byte) ([]byte, error)

func (AESCipher) Encrypt

func (ac AESCipher) Encrypt(plaintext []byte, key []byte) ([]byte, error)

func (AESCipher) RandomKey

func (ac AESCipher) RandomKey() ([]byte, error)

type LabelTool

type LabelTool struct {
}

func (LabelTool) CheckLabelExist

func (lt LabelTool) CheckLabelExist(curLabelsMap, appendLabelMap map[string]string) bool

func (LabelTool) GenLabelIndexes

func (lt LabelTool) GenLabelIndexes(labels map[string]string) string

func (LabelTool) GenLabelSearchValue

func (lt LabelTool) GenLabelSearchValue(labels map[string]string) string

func (LabelTool) GetDigestMd5

func (lt LabelTool) GetDigestMd5(key string) string

func (LabelTool) MergeLabels

func (lt LabelTool) MergeLabels(curLabelsMap map[string]string, appendLabelMap map[string]string) (string, map[string]string, error)

func (LabelTool) ParseQueryParams2Labels

func (lt LabelTool) ParseQueryParams2Labels(labels string) (map[string]string, error)

func (LabelTool) ParseStrLabels

func (lt LabelTool) ParseStrLabels(labels string) (map[string]string, error)

type RSACipher

type RSACipher struct {
}

func (RSACipher) Decrypt

func (rc RSACipher) Decrypt(cipherText []byte, priKey []byte) ([]byte, error)

func (RSACipher) Encrypt

func (rc RSACipher) Encrypt(plainText []byte, pubKey []byte) ([]byte, error)

func (RSACipher) Signature

func (rc RSACipher) Signature(plainText []byte, priKey []byte) ([]byte, error)

func (RSACipher) VerifySignature

func (rc RSACipher) VerifySignature(plainText, pubKey, signature []byte) error

Jump to

Keyboard shortcuts

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