Documentation ¶
Index ¶
- Variables
- func AesDecrypt(key []byte, data []byte, unpadding UnPaddingFunc) ([]byte, error)
- func AesEncrypt(key []byte, data []byte, padding PaddingFunc) ([]byte, error)
- func Assign(ptr interface{}, val interface{})
- func BeanCopy(src, dst interface{}) error
- func BeanCopyByJson(source, result interface{}) error
- func Bool2Int(b bool) int64
- func BytesToInt16(b []byte) int16
- func BytesToInt32(b []byte) int32
- func BytesToInt64(b []byte) int64
- func BytesToUint16(b []byte) uint16
- func BytesToUint32(b []byte) uint32
- func BytesToUint64(b []byte) uint64
- func CharCount(s string) int
- func Contain(array interface{}, val interface{}) bool
- func ContainsString(slice []string, s string) bool
- func Find(array interface{}, val interface{}) int
- func GetBase64Md5(raw []byte) string
- func GetDevice(req *http.Request, body url.Values) *model.Device
- func GetDeviceType(req *http.Request, body url.Values) string
- func GetMd5(raw []byte) string
- func GetRealBrowser(ua string) string
- func GetRealIP(r *http.Request) string
- func GetRealPlatform(ua string) string
- func GetVersion(ua string, keyword string) string
- func Int16ToBytes(u int16) []byte
- func Int2Bool(i int64) bool
- func Int32ToBytes(u int32) []byte
- func Int64ToBytes(u int64) []byte
- func IsCommonBrowser(browser string) bool
- func IsCommonPlatform(platform string) bool
- func IsEmail(email string) bool
- func IsValidCellPhone(phonenumber string) bool
- func Join(array interface{}, sep string) string
- func JoinInts(a []int64, sep string) string
- func Map(mapping func(interface{}) interface{}, strs ...interface{}) []interface{}
- func Map2Struct(vals map[string]interface{}, dst interface{}, structTag string) (err error)
- func NowMsec() int64
- func ParseCellPhone(phonenumber string) (region string, phone string)
- func Pkcs5Padding(data []byte) []byte
- func Pkcs5Unpadding(data []byte) ([]byte, error)
- func Remove(ptrArray interface{}, val interface{}) int
- func Reverse(array interface{})
- func Slice(s string) (b []byte)
- func SpIpInit()
- func SplitFilename(fname string) (base string, ext string)
- func String(b []byte) (s string)
- func Struct2Map(s interface{}) map[string]interface{}
- func Struct2MapByTag(s interface{}, tagName string) map[string]interface{}
- func ToExportBrowser(browser string) string
- func Uint16ToBytes(u uint16) []byte
- func Uint32ToBytes(u uint32) []byte
- func Uint64ToBytes(u uint64) []byte
- type PaddingFunc
- type UnPaddingFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var Browsers = []string{"chrome", "firefox", "safari", "opera", "edge", "ie", "wx", "qq", "theworld", "liebao", "baidu", "maxthon", "sogou", "miui", "uc", "360", "taobao", "2345"}
View Source
var (
ErrInvalidPadding = errors.New("aes invalid padding")
)
View Source
var IntranetIPs = append(LocalIPs, "10.0.0.0/8", "172.31.0.0/16", "172.16.0.0/16", "192.168.0.0/16")
View Source
var LocalIPs = []string{"127.0.0.1/32"}
////////////////////////////////////////////////////////////////////////////////////////////////////// coding by Shang Peng 使用GetRealIP前需要调用SpIpInit初始化内网IP库
View Source
var Platforms = []string{"Linux", "Unix", "Mac OS X", "Windows", "iOS", "Android", "Windows Phone"}
View Source
var SpecialIPs = make([]*net.IPNet, 0, len(IntranetIPs)) //内网IP库
Functions ¶
func AesDecrypt ¶
func AesDecrypt(key []byte, data []byte, unpadding UnPaddingFunc) ([]byte, error)
func AesEncrypt ¶
func AesEncrypt(key []byte, data []byte, padding PaddingFunc) ([]byte, error)
func Assign ¶
func Assign(ptr interface{}, val interface{})
Assign val to the address of ptr. And the type of val must be *ptr. You can think that it works like this:
v, ok := val.(type(*ptr)) if !ok { panic() } *ptr = v
func BeanCopyByJson ¶
func BeanCopyByJson(source, result interface{}) error
func BytesToInt16 ¶
func BytesToInt32 ¶
func BytesToInt64 ¶
func BytesToUint16 ¶
func BytesToUint32 ¶
func BytesToUint64 ¶
func ContainsString ¶
func GetBase64Md5 ¶
func GetRealBrowser ¶
func GetRealPlatform ¶
func GetVersion ¶
func Int16ToBytes ¶
func Int32ToBytes ¶
func Int64ToBytes ¶
func IsCommonBrowser ¶
func IsCommonPlatform ¶
func IsValidCellPhone ¶
func Map2Struct ¶
func ParseCellPhone ¶
func Pkcs5Padding ¶
func Pkcs5Unpadding ¶
func Remove ¶
func Remove(ptrArray interface{}, val interface{}) int
Remove all elems equals to Val in Array. Return the number of elems removed.
func SplitFilename ¶
return base name and ext with leading "."
func Struct2Map ¶
func Struct2Map(s interface{}) map[string]interface{}
func Struct2MapByTag ¶
func ToExportBrowser ¶
func Uint16ToBytes ¶
func Uint32ToBytes ¶
func Uint64ToBytes ¶
Types ¶
type PaddingFunc ¶
type UnPaddingFunc ¶
Click to show internal directories.
Click to hide internal directories.