tools

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Variables

This section is empty.

Functions

func CWD

func CWD() string

func Compress

func Compress(b []byte) []byte

func Copy

func Copy(src, dest string) error

Copy copies src to dest, doesn't matter if src is a directory or a file

func Decompress

func Decompress(data []byte) []byte

func DeepCopy

func DeepCopy(dst, src interface{}) error

func EnsureDir

func EnsureDir(dir string) (err error)

func ExpandHomeDir

func ExpandHomeDir(path string) string

func FileCheckMD5

func FileCheckMD5(fullpath string, checksum string) (ok bool)

func FileGetMD5

func FileGetMD5(path string) (checksum string, err error)

func FileMove

func FileMove(src, dst string) error

func GetBytesChecksum

func GetBytesChecksum(bs []byte, m string) string

func GetBytesMD5

func GetBytesMD5(bs []byte) string

func GetStringChecksum

func GetStringChecksum(str string, m string) string

func GetStringMD5

func GetStringMD5(str string) string

func GzipToBase64

func GzipToBase64(bs []byte) (b64 string, err error)

func HomeDir

func HomeDir() string

func InterfaceExpand

func InterfaceExpand(msg []interface{}) string

func IsPortInUse

func IsPortInUse(port int) bool

func LineBuilder

func LineBuilder(width int, char string) string

LineBuilder Build a string line with char given

func LoadYaml

func LoadYaml(path string, i interface{}) error

func LocalIP

func LocalIP() string

func MediaSorter

func MediaSorter(m map[int]interface{}) mapSorter

func PauseExit

func PauseExit()

func RandString0f

func RandString0f(len int) string

func RandStringFromAlphabet

func RandStringFromAlphabet(length int, alphabet string) string

func RemoveDuplicateInt

func RemoveDuplicateInt(a []int) []int

func RemoveElementInt

func RemoveElementInt(a []int, ele int) []int

func RsaGenKeypair

func RsaGenKeypair() (priKey string, pubKey string)

func RsaGetPublicKey

func RsaGetPublicKey() string

func RsaLoadPrivateKey

func RsaLoadPrivateKey(path string) error

func RsaSavePrivateKey

func RsaSavePrivateKey(priKey *rsa.PrivateKey, filepath string) error

func RsaSha256Sign

func RsaSha256Sign(i interface{}) (signature, pubKey string, err error)

func RsaSha256SignHash

func RsaSha256SignHash(hash string) (signature, pubKey string, err error)

func RsaSha256Verify

func RsaSha256Verify(i interface{}, signature, pubKey string) bool

func RsaSha256VerifyHash

func RsaSha256VerifyHash(hash, signature, pubKey string) bool

func SaveYaml

func SaveYaml(path string, i interface{}) error

func ScreenClear

func ScreenClear()

func StringsCompress

func StringsCompress(strs []string) (str string, err error)

StringsCompress Strings to json string

func StringsDecompress

func StringsDecompress(str string) (strs []string, err error)

StringsDecompress Json string to strings

func StringsDedup

func StringsDedup(slice []string) []string

func StringsDedupWithSort

func StringsDedupWithSort(a []string) (ret []string)

func StringsExcept

func StringsExcept(a []string, b []string) (ret []string)

StringsExcept sort(a-b)

Types

type ClientPool

type ClientPool struct {
	// contains filtered or unexported fields
}

func NewClientPool

func NewClientPool(maxClients int) *ClientPool

func (*ClientPool) GetClient

func (p *ClientPool) GetClient() (client *http.Client)

func (*ClientPool) Init

func (p *ClientPool) Init(maxClients int)

func (*ClientPool) Recycle

func (p *ClientPool) Recycle(client *http.Client)

type ConnectData

type ConnectData struct {
	Code    int         `json:"code"`
	Data    interface{} `json:"data"`
	Message string      `json:"msg"`
}

func HttpGet

func HttpGet(url string) (data ConnectData, bs []byte, err error)

func HttpPost

func HttpPost(url string, data interface{}, contentType string) (rdata ConnectData, bs []byte, err error)

type MapItem

type MapItem struct {
	Mid   int
	Value interface{}
}

Jump to

Keyboard shortcuts

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