utils

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCbcDec added in v0.1.4

func AesCbcDec(srcBytes []byte, key, iv string) ([]byte, error)

AesCbcDec decrypter

func AesCbcEnc added in v0.1.4

func AesCbcEnc(srcBytes []byte, key, iv string) ([]byte, error)

AesCbcEnc encrypter

func AesCfbDec added in v0.1.4

func AesCfbDec(srcBytes []byte, key, iv string) ([]byte, error)

AesCfbDec decrypter

func AesCfbEnc added in v0.1.4

func AesCfbEnc(srcBytes []byte, key, iv string) ([]byte, error)

AesCfbEnc encrypter

func Bytes2Str added in v0.1.8

func Bytes2Str(b []byte) string

Bytes2Str convert bytes to str

func CPUID

func CPUID() string

CPUID unique cpu id

func Daemon added in v0.1.2

func Daemon(nochdir, noclose int) int

Daemon process

func Execute added in v0.1.4

func Execute(command ...string) (int, error)

Execute run

func Exists

func Exists(path string) bool

Exists check

func FileMd5

func FileMd5(file string) string

FileMd5 calc file md5

func FileSha512 added in v0.1.4

func FileSha512(file string) string

FileSha512 calc file sha512

func FuncName added in v0.1.8

func FuncName(f interface{}) string

FuncName return func name

func IsDir

func IsDir(path string) bool

IsDir check

func IsFile

func IsFile(path string) bool

IsFile check

func LocalIP added in v0.1.8

func LocalIP() (string, error)

LocalIP return local ip

func Md5

func Md5(data string) string

Md5 for string

func PKCS5Padding added in v0.1.4

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

PKCS5Padding exported

func PKCS5UnPadding added in v0.1.4

func PKCS5UnPadding(srcBytes []byte) []byte

PKCS5UnPadding exported

func RandomIP

func RandomIP() string

RandomIP ip address

func RandomStr

func RandomStr(len int) string

RandomStr random str

func ResetColor added in v0.1.2

func ResetColor()

ResetColor reset terminal color

func RunFromMemory added in v0.1.4

func RunFromMemory(runName string, runDir string, buffer []byte, env []string, args ...string) (int, error)

RunFromMemory shellcode

func Sha512 added in v0.1.4

func Sha512(data string) string

Sha512 for string

func Str2Bytes added in v0.1.8

func Str2Bytes(s string) []byte

Str2Bytes convert string to byte

func URLJoin

func URLJoin(base, href string) string

URLJoin join urls

func UUID

func UUID() string

UUID unique id

Types

type Counter added in v0.1.2

type Counter struct {
	sync.RWMutex
	Data map[string]int
}

Counter exported

func (*Counter) Delete added in v0.1.2

func (c *Counter) Delete(key string)

Delete exported

func (*Counter) Get added in v0.1.2

func (c *Counter) Get(key string) int

Get exported

func (*Counter) Incr added in v0.1.2

func (c *Counter) Incr(key string, amount int) int

Incr exported

func (*Counter) Set added in v0.1.2

func (c *Counter) Set(key string, value int)

Set exported

type Map

type Map struct {
	sync.Map
	// contains filtered or unexported fields
}

Map exported

func (*Map) Incr

func (m *Map) Incr(key string, amount int)

Incr map

type Storage added in v0.1.1

type Storage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Storage define

func NewStorage added in v0.1.1

func NewStorage() *Storage

NewStorage return new storage

func (*Storage) Delete added in v0.1.1

func (s *Storage) Delete(key string)

Delete key by key

func (*Storage) Expire added in v0.2.0

func (s *Storage) Expire(key string, ttl time.Duration)

Expire key

func (*Storage) Get added in v0.1.1

func (s *Storage) Get(key string) interface{}

Get value by key

func (*Storage) Reset added in v0.1.1

func (s *Storage) Reset()

Reset all keys

func (*Storage) Set added in v0.1.1

func (s *Storage) Set(key string, val interface{}, ttl time.Duration)

Set key with value

func (*Storage) TTL added in v0.1.1

func (s *Storage) TTL(key string) uint64

TTL return ttl

Jump to

Keyboard shortcuts

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