utils

package
v0.0.0-...-94f2022 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XForwardedFor = "X-Forwarded-For"
	XRealIP       = "X-Real-IP"
)

Variables

This section is empty.

Functions

func ConstructByteOfQuarters

func ConstructByteOfQuarters(first, second, third, fourth byte) byte

ConstructByteOfQuarters constructs a byte of it's four quarters given

func ConstructByteOfQuartersAsSlice

func ConstructByteOfQuartersAsSlice(b []byte) byte

ConstructByteOfQuartersAsSlice constructs a byte of it's four quarters given as byte slice

func GetConfAbPath

func GetConfAbPath() string

GetConfAbPath 获取conf文件夹绝对路径

func GetCpuInfo

func GetCpuInfo() (*cpu.InfoStat, error)

GetCpuInfo 获取CPU详细信息

func GetCpuPercent

func GetCpuPercent() (float64, error)

GetCpuPercent 获取CPU使用率

func GetCurrentAbPath

func GetCurrentAbPath() string

GetCurrentAbPath 最终方案-全兼容

func GetExtractedFilename

func GetExtractedFilename(origin string) string

GetExtractedFilename 获取被提取文件名

func GetFileHash

func GetFileHash(path string) (string, error)

GetFileHash 计算文件Hash(md5)

func GetLastTwoBits

func GetLastTwoBits(b byte) byte

GetLastTwoBits returns byte containing only last two bits of given byte

func GetMediaAbPath

func GetMediaAbPath() string

GetMediaAbPath 获取media文件夹绝对路径

func GetMemInfo

func GetMemInfo() (*mem.VirtualMemoryStat, error)

func IsImageType

func IsImageType(p string) (bool, error)

IsImageType returns the type of Image

func IsNum

func IsNum(s string) bool

IsNum 判断字符串是否是数字

func QuartersOfByte

func QuartersOfByte(b byte) [4]byte

QuartersOfByte returns a byte's four quarters of bits

func RemoteIp

func RemoteIp(c *app.RequestContext) string

RemoteIp 返回远程客户端的 IP,如 192.168.1.1

func ResponseError

func ResponseError(c *app.RequestContext, msg string, err error)

ResponseError 错误响应体

func ResponseOK

func ResponseOK(c *app.RequestContext, msg string, data interface{})

ResponseOK 成功响应体

func SetLastTwoBits

func SetLastTwoBits(b byte, value byte) byte

SetLastTwoBits modifies last two bits of given byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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