Documentation ¶
Index ¶
- func EncodePassword[PK any](original []byte, key PK) (success bool, result []byte)
- func EncodeRandomSalt[PK any](key PK) []byte
- func Error(chan error)
- func GenerateHash[Key any](key Key) (hash uint)
- func GenerateHashWithOpts[Key any, Hash UintLike](key Key) (hash Hash)
- func GenerateMD5(source string) (md5CheckSum string)
- func GeneratePackageID[ID UintLike](packageName string) (id ID)
- func GeneratePrefixHash[Key any](key Key, offset uintptr) (hash uint)
- func GeneratePrefixHashWithOpts[Key any, Hash UintLike](key Key, offset uintptr) (hash Hash)
- func GenerateRealID(uid uint64, sub uint16) (realID uint64)
- func GenerateTypeID[T any](entity T) (uid string)
- func GenerateUID(mac uint64, timeStamp time.Time) (uid uint64)
- func GenerateUUID() string
- func GetMacAddresses() (macAddr []net.Interface, err error)
- func GetUintMacAddress(mac net.Interface) (addr uint64, err error)
- func GetZeroTimeStamp() time.Time
- func Info(chan interface{})
- func Trace(chan interface{})
- type ErrorHandler
- type InfoLogger
- type SystemBits
- type TraceLogger
- type UintLike
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodePassword ¶
EncodePassword 使用crypto/scrypt密钥库对密码进行单向加密
func EncodeRandomSalt ¶
EncodeRandomSalt 对任意类型的key进行编码生成一个长度为8的[]byte结果
func GenerateHash ¶
GenerateHash 将任意结构进行哈希,使用SDBM算法作为实现
func GenerateHashWithOpts ¶
GenerateHashWithOpts 将任意结构进行哈希,生成一个指定类型(无符号整形)的哈希值,使用SDBM算法作为实现
func GenerateMD5 ¶
GenerateMD5 将给定的字符串使用MD5摘要算法生成摘要
func GeneratePackageID ¶
GeneratePackageID 根据给定的包名,生成其Hash,不保证不会冲突
func GeneratePrefixHash ¶
GeneratePrefixHash 将任意结构的前offset字节的内容进行哈希,越界部份不会被计算,使用SDBM算法作为实现
func GeneratePrefixHashWithOpts ¶
GeneratePrefixHashWithOpts 将任意结构的前offset字节的内容进行哈希,生成一个指定类型(无符号整形)的哈希值,越界部份不会被计算,使用SDBM算法作为实现
func GenerateRealID ¶
GenerateRealID 根据MOD的ID和MOD中的ID,拼接出真实ID
func GenerateTypeID ¶
GenerateTypeID 根据entity的包和结构名,生成类型ID
func GenerateUID ¶
GenerateUID 根据时间戳生成一个UID,毫秒级,48位,其中前6位为设备序列号,后42位为毫秒时间戳,可使用138年
func GetMacAddresses ¶
GetMacAddresses 使用net包获取本机mac地址
func GetUintMacAddress ¶
GetUintMacAddress 从net.Interface中获取一个uint64类型的地址,长度为48位
Types ¶
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
func (*ErrorHandler) Handle ¶
func (e *ErrorHandler) Handle(err error)
type InfoLogger ¶
type InfoLogger struct{}
type SystemBits ¶
type SystemBits byte
const ( BitsUnknown SystemBits = 0 Bits32 SystemBits = 32 Bits64 SystemBits = 64 )
type TraceLogger ¶
type TraceLogger struct{}