utls

package
Version: v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPath

func CleanPath(p string) string

CleanPath is the URL version of path.Clean, it returns a canonical URL path for p, eliminating . and .. elements.

The following rules are applied iteratively until no further processing can be done:

1. Replace multiple slashes with a single slash.
2. Eliminate each . path name element (the current directory).
3. Eliminate each inner .. path name element (the parent directory)
   along with the non-.. element that precedes it.
4. Eliminate .. elements that begin a rooted path:
   that is, replace "/.." by "/" at the beginning of a path.

If the result of this process is an empty string, "/" is returned

func DecodeMap

func DecodeMap(encoded []byte) (map[interface{}]interface{}, error)

DecodeMap decode data to map

func DecodeString

func DecodeString(source string) (string, error)

DecodeString deencode string use base64 StdEncoding

func DeepCopy

func DeepCopy(dst, src interface{}) error

func ECBDecrypt

func ECBDecrypt(crypted, key []byte) ([]byte, error)

ECB Des decrypt

func ECBEncrypt

func ECBEncrypt(origData, key []byte) ([]byte, error)

ECB Des encrypt

func EncodeMap

func EncodeMap(obj map[interface{}]interface{}) ([]byte, error)

EncodeMap encode the map to gob

func EncodeString

func EncodeString(source string) string

EncodeString encode string use base64 StdEncoding

func Exist

func Exist(filename string) bool

check filename exists

func GBKToUTF8

func GBKToUTF8(src string) string

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetExeFileName

func GetExeFileName() (filename string)

func GetExeFilePath

func GetExeFilePath() (execpath string)

func GetHashSeed

func GetHashSeed() int64

add mac and time.now() as seed

func GetMacAddrs

func GetMacAddrs() string

get current computer mac addr.

func GetMd5String

func GetMd5String(s string, upper bool, half bool) string

create 32bit md5 string

func GetMd5String_V2

func GetMd5String_V2(s string) string

GetMd5String compute the md5 sum as string

func GetRandString

func GetRandString(length int) string

GetRandString returns randominzed string with given length

func GetUUID

func GetUUID() string

get new uuid

func HashNonEncryption

func HashNonEncryption(s string) uint32

hash output uint32

func Int2String

func Int2String(val int) string

Int2String convert int to string

func Int642String

func Int642String(val int64) string

Int642String convert int64 to string

func IsLinux

func IsLinux() bool

func IsPathExisted

func IsPathExisted(path string) (bool, error)

func IsWindows

func IsWindows() bool

func Json2Pb

func Json2Pb(strjson string, pb proto.Message) error

func NSToTime

func NSToTime(ns int64) (time.Time, error)

NSToTime convert ns to time.Time

func NewInt64_v1

func NewInt64_v1() int64

func NewInt64_v3

func NewInt64_v3() (id int64)

func NewOnly_v1

func NewOnly_v1() (onlyid snowflake.ID, err error)

func NewOnly_v2

func NewOnly_v2() (id uint64, err error)

func NewOnly_v3

func NewOnly_v3() string

use rand number create Guid string

func NewString_v1

func NewString_v1() string

func NewString_v3

func NewString_v3() string

func PKCS5Padding

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

ECB PKCS5Padding

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

ECB PKCS5UnPadding

func Pb2Json

func Pb2Json(pb proto.Message, strjson string) (err error)

func RandByUInt32

func RandByUInt32(n int64) (result uint32)

create rand unsign 32 bit by single number

func RandByUInt64

func RandByUInt64(n int64) (result int64)

create rand unsign 64 bit by single number

func RandInt32

func RandInt32(n int32) (result int32)

rand int32 number space: [1,n] min: 1 max: n

func RandInt32FromZero

func RandInt32FromZero(n int32) (result int32)

rand int32 number space: [0,n) min: 1 max: n

func RandInt64

func RandInt64(n int64) (result int64)

rand int64 number space: [1,n] min: 1 max: n

func SizeVal

func SizeVal(data interface{}) int

func SliceByte2String

func SliceByte2String(b []byte) string

func SliceBytesLength

func SliceBytesLength(data []byte) int

func StrArray2Str

func StrArray2Str(src []string) string

string array data cover to string.

func String2Bytes

func String2Bytes(val string) []byte

String2Bytes convert string to []byte

func String2Int

func String2Int(val string) (int, error)

String2Int convert string to int

func String2Int64

func String2Int64(val string) (int64, error)

String2Int64 convert string to int64

func String2Slicebyte

func String2Slicebyte(s string) []byte

func String2UInt64

func String2UInt64(val string) (uint64, error)

String2UInt64 convert string to uint64

func TripleEcbDesDecrypt

func TripleEcbDesDecrypt(crypted, key []byte) ([]byte, error)

[golang ECB 3DES Decrypt]

func TripleEcbDesEncrypt

func TripleEcbDesEncrypt(origData, key []byte) ([]byte, error)

[golang ECB 3DES Encrypt]

func UInt642String

func UInt642String(val uint64) string

UInt642String convert uint64 to string

func UTF8ToGB18030

func UTF8ToGB18030(src string) string

for chinese encoding.

func UTF8ToGBK

func UTF8ToGBK(src string) string

func ZlibCompress

func ZlibCompress(src []byte) []byte

func ZlibUnCompress

func ZlibUnCompress(src []byte) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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