common

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LITTLE_LETTERS = 36
	FULL_LETTERS   = 62
)

Variables

View Source
var Black = color.RGBA{0, 0, 0, 0}
View Source
var Blue = color.RGBA{0, 0, 255, 0}
View Source
var Cyan = color.RGBA{0, 255, 255, 0}
View Source
var Gray = color.RGBA{128, 128, 128, 0}
View Source
var Green = color.RGBA{0, 128, 0, 0}
View Source
var Lime = color.RGBA{0, 255, 0, 0}
View Source
var Magenta = color.RGBA{255, 0, 255, 0}
View Source
var Maroon = color.RGBA{128, 0, 0, 0}
View Source
var Navy = color.RGBA{0, 0, 128, 0}
View Source
var Olive = color.RGBA{128, 128, 0, 0}
View Source
var Purple = color.RGBA{128, 0, 128, 0}
View Source
var Red = color.RGBA{255, 0, 0, 0}
View Source
var Silver = color.RGBA{192, 192, 192, 0}
View Source
var Teal = color.RGBA{0, 128, 128, 0}
View Source
var White = color.RGBA{255, 255, 255, 0}
View Source
var Yellow = color.RGBA{255, 255, 0, 0}

Functions

func AbsInt

func AbsInt(v int) int

func AbsInt32

func AbsInt32(v int32) int32

func AbsInt64

func AbsInt64(v int64) int64

func ArrayContainInt

func ArrayContainInt(a []int, f int) bool

func ArrayContainString

func ArrayContainString(a []string, f string) bool

func ColorDistance

func ColorDistance(c1 color.RGBA, c2 color.RGBA) float64

func CompressData

func CompressData(src []byte) []byte

func Copy

func Copy(src, dst string) error

func CrashLog

func CrashLog()

func DeCompressData

func DeCompressData(src []byte) ([]byte, error)

func DumpStacks

func DumpStacks() string

func Elapsed

func Elapsed(f func(d time.Duration)) func()

func FileExists

func FileExists(filename string) bool

func FileFind

func FileFind(filename string, dst string) int

func FileLineCount

func FileLineCount(filename string) int

func FileMd5

func FileMd5(filename string) (string, error)

func FileReplace

func FileReplace(filename string, from string, to string) error

func GenerateTLSConfig

func GenerateTLSConfig(name string) (*tls.Config, error)

Setup a bare-bones TLS config for the server

func GetCrc32

func GetCrc32(data []byte) string

func GetCrc32String

func GetCrc32String(s string) string

func GetDataDir

func GetDataDir() string

func GetEngineDir

func GetEngineDir() string

func GetMd5String

func GetMd5String(s string) string

func GetNodeDir

func GetNodeDir() string

func GetNowUpdateInSecond

func GetNowUpdateInSecond() time.Time

func GetOutboundIP

func GetOutboundIP() (net.IP, error)

func GetSrcDir

func GetSrcDir() string

func GetXXHashString

func GetXXHashString(s string) string

func Guid

func Guid() string

func GunzipString

func GunzipString(data string) string

func GzipString

func GzipString(data string) string

func GzipStringBestCompression

func GzipStringBestCompression(data string) string

func GzipStringBestSpeed

func GzipStringBestSpeed(data string) string

func HIINT16

func HIINT16(I int32) int16

func HIINT32

func HIINT32(I int64) int32

func HasInt

func HasInt(data []int, dst int) bool

func HasString

func HasString(data []string, dst string) bool

func HashString

func HashString(s string) uint32

func Hex2Num

func Hex2Num(str string, n int) int

func Ini

func Ini()

引擎全局的初始化 如:引擎各个目录的实际地址 如:执行引擎初始化脚本 如:解压引擎数据文件 其他各个模块的初始化代码放到各自模块init中

func Int32ArrayToString

func Int32ArrayToString(a []int32, delim string) string

func Int64ArrayToString

func Int64ArrayToString(a []int64, delim string) string

func IntArrayToString

func IntArrayToString(a []int, delim string) string

func IsInt

func IsInt(r float64) bool
func IsSymlink(filename string) bool

func LOINT16

func LOINT16(l int32) int16

func LOINT32

func LOINT32(l int64) int32

func LoadJson

func LoadJson(filename string, conf interface{}) error

func LoadProtobuf

func LoadProtobuf(filename string) (error, []protoreflect.FileDescriptor)

func LoadProtobufMethods

func LoadProtobufMethods(filename string) (error, []protoreflect.MethodDescriptor)

func MAKEINT32

func MAKEINT32(high int16, low int16) int32

func MAKEINT64

func MAKEINT64(high int32, low int32) int64

func MaxOfInt

func MaxOfInt(vars ...int) int

func MaxOfInt64

func MaxOfInt64(vars ...int64) int64

func MessageToFullJson

func MessageToFullJson(mi protoreflect.MessageDescriptor) (error, string)

func MinOfInt

func MinOfInt(vars ...int) int

func MinOfInt64

func MinOfInt64(vars ...int64) int64

func NearlyEqual

func NearlyEqual(a int, b int) bool

func NumToHex

func NumToHex(num, n int) string

func RandInt

func RandInt() int32

func RandInt31n

func RandInt31n(n int) int32

func RandStr

func RandStr(l int) string

func Rc4

func Rc4(key string, src []byte) ([]byte, error)

func SafeDivide

func SafeDivide(a int64, b int64) int64

func SaveJson

func SaveJson(filename string, conf interface{}) error

func Shuffle

func Shuffle(n int, swap func(i, j int))

func Sleep

func Sleep(sec int)

func StructToTable

func StructToTable(v interface{}) string

func UniqueId

func UniqueId() string

func Walk

func Walk(path string, walkFn filepath.WalkFunc) error

Walk extends filepath.Walk to also follow symlinks

func WrapString

func WrapString(s string, n int) string

Types

type Channel

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

func NewChannel

func NewChannel(len int) *Channel

func (*Channel) Ch

func (c *Channel) Ch() <-chan interface{}

func (*Channel) Close

func (c *Channel) Close()

func (*Channel) Write

func (c *Channel) Write(v interface{})

func (*Channel) WriteTimeout

func (c *Channel) WriteTimeout(v interface{}, timeoutms int) bool

type EngineConfiguration

type EngineConfiguration struct {
	Extract []string
	Init    []string
}

type StrTable

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

func (*StrTable) AddHeader

func (s *StrTable) AddHeader(h string)

func (*StrTable) AddLine

func (s *StrTable) AddLine(l StrTableLine)

func (*StrTable) FromStruct

func (s *StrTable) FromStruct(v interface{}, use func(name string) bool)

func (*StrTable) String

func (s *StrTable) String(prefix string) string

type StrTableLine

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

func (*StrTableLine) AddData

func (s *StrTableLine) AddData(d string)

func (*StrTableLine) FromStruct

func (s *StrTableLine) FromStruct(st *StrTable, v interface{}, trans func(name string, v interface{}) interface{})

Jump to

Keyboard shortcuts

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