Documentation ¶
Index ¶
- Constants
- func AesDecrypt(encryptedData []byte, key []byte) (string, error)
- func AesEncrypt(origData []byte, key []byte) ([]byte, error)
- func Base64ToImage(imageBase64 string) ([]byte, error)
- func CheckExist(src string) bool
- func CheckPermission(src string) bool
- func ClientIpAddr(r *http.Request) string
- func CompareSignature(signature, message, accessSecret string) bool
- func Copy(dst, src interface{}) error
- func DivisibleBy2(x float64) int
- func FastSimpleUUID() string
- func Gcd(x, y int) int
- func GenerateRandomCode(num int) string
- func GenerateRandomString(num int) string
- func GetCurrentTimeStamp() int64
- func GetDirFiles(dir string) ([]string, error)
- func GetDistance(lon1, lat1, lon2, lat2 float64) float64
- func GetExt(fileName string) string
- func GetGcd(times []int) int
- func GetIP() string
- func GetIPWithPrefix(prefix string) string
- func GetImgType(p string) (string, error)
- func GetLcm(times []int) int
- func GetSize(f multipart.File) (int, error)
- func GetType(p string) (string, error)
- func GetUUID() string
- func HashFile(filename string) (string, error)
- func HashString(content string) string
- func Hmac(data string) string
- func HmacSignature(message, accessSecret string) []byte
- func HttpGet(url string) ([]byte, error)
- func HttpPost(url, content string) ([]byte, error)
- func IsNotExistMkDir(src string) error
- func IsStringEmpty(str string) bool
- func Lcm(x, y int) int
- func MkDir(src string) error
- func Open(name string, flag int, perm os.FileMode) (*os.File, error)
- func PasswordCheck(ps string, minLength, maxLength int, level int) error
- func PathExists(path string) bool
- func Pos(haystack, needle string, startOffset ...int) int
- func RemoveRepByMap(slc []string) []string
- func ReplaceI(origin, search, replace string, count ...int) string
- func ResolveIPFromHostsFile() (string, error)
- func Round(x float64) int
- func Sha1String(content string) string
- func StringIsEmpty(text string) bool
- func StringIsNotEmpty(text string) bool
- func UniqueId(prefix string) string
- func UserAgentToOsBrowser(userAgent string) (os string, browser string)
- type APIException
- type JSONTime
- type VerifierAuth
Constants ¶
View Source
const EarthRadius float64 = 6378137
EarthRadius 赤道半径
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶ added in v1.3.30
AesDecrypt 实现解密
func AesEncrypt ¶ added in v1.3.30
AesEncrypt 实现加密
func Base64ToImage ¶
func ClientIpAddr ¶ added in v1.3.30
func CompareSignature ¶ added in v1.3.30
func DivisibleBy2 ¶ added in v1.3.30
func FastSimpleUUID ¶ added in v1.3.30
func FastSimpleUUID() string
func GenerateRandomCode ¶ added in v1.3.30
func GenerateRandomString ¶ added in v1.3.30
func GetCurrentTimeStamp ¶
func GetCurrentTimeStamp() int64
func GetDirFiles ¶
func GetDistance ¶ added in v1.3.30
func GetIPWithPrefix ¶ added in v1.3.30
func HashString ¶ added in v1.3.30
func HmacSignature ¶ added in v1.3.30
func IsStringEmpty ¶
func PasswordCheck ¶ added in v1.3.30
func PathExists ¶
func ResolveIPFromHostsFile ¶ added in v1.3.30
func Sha1String ¶ added in v1.3.30
func StringIsEmpty ¶ added in v1.3.30
func StringIsNotEmpty ¶ added in v1.3.30
func UserAgentToOsBrowser ¶ added in v1.3.30
Types ¶
type APIException ¶
type APIException struct { Code int `json:"code"` Success bool `json:"success"` Msg string `json:"msg"` Timestamp int64 `json:"timestamp"` Result interface{} `json:"result"` }
api结构体
func ResponseJson ¶
func ResponseJson(message string, data interface{}, success bool) *APIException
200
type JSONTime ¶
JSONTime format json time field by myself
func (JSONTime) MarshalJSON ¶
MarshalJSON on JSONTime format Time field with %Y-%m-%d %H:%M:%S
type VerifierAuth ¶ added in v1.4.0
type VerifierAuth struct { }
func NewVerifierAuth ¶ added in v1.4.0
func NewVerifierAuth() *VerifierAuth
func (*VerifierAuth) GetCode ¶ added in v1.4.0
func (v *VerifierAuth) GetCode(secret string) (string, error)
GetCode 获取动态码
func (*VerifierAuth) GetQrcode ¶ added in v1.4.0
func (v *VerifierAuth) GetQrcode(user, secret string) string
GetQrcode 获取动态码二维码内容
func (*VerifierAuth) GetQrcodeUrl ¶ added in v1.4.0
func (v *VerifierAuth) GetQrcodeUrl(user, secret string) string
GetQrcodeUrl 获取动态码二维码图片地址,这里是第三方二维码api
func (*VerifierAuth) GetSecret ¶ added in v1.4.0
func (v *VerifierAuth) GetSecret() string
GetSecret 获取秘钥
func (*VerifierAuth) VerifyCode ¶ added in v1.4.0
func (v *VerifierAuth) VerifyCode(secret, code string) (bool, error)
VerifyCode 验证动态码
Click to show internal directories.
Click to hide internal directories.