x

package module
v0.0.0-...-6f68aba Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 16 Imported by: 45

README

x

GoDoc

My util library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BP12 = NewBytesPool(12)
View Source
var BP16 = NewBytesPool(16)
View Source
var BP2 = NewBytesPool(2)
View Source
var BP20 = NewBytesPool(20)
View Source
var BP2048 = NewBytesPool(2048)
View Source
var BP32 = NewBytesPool(32)
View Source
var BP4 = NewBytesPool(4)
View Source
var BP40 = NewBytesPool(40)
View Source
var BP65507 = NewBytesPool(65507)

Functions

func CryptoRandom

func CryptoRandom(min, max int64) (int64, error)

func Decimal2IP

func Decimal2IP(n int64) string

Decimal2IP transform a decimal IP to x.x.x.x format.

func Decimal2IP0

func Decimal2IP0(n int64) (ip string, err error)

Decimal2IP0 transform a decimal IP to x.x.x.x format. ref: https://zh.wikipedia.org/wiki/IPv4

func Decimal2IP1

func Decimal2IP1(n int64) string

Decimal2IP1 transform a decimal IP to x.x.x.x format.

func Distance

func Distance(lng1, lat1, lng2, lat2 float64) float64

return m

func IP2Decimal

func IP2Decimal(ipstr string) (int64, error)

IP2Decimal transform ip format like x.x.x.x to decimal.

func IP2Decimal0

func IP2Decimal0(ip string) (n int64, err error)

IP2Decimal0 transform ip format like x.x.x.x to decimal. ref: https://zh.wikipedia.org/wiki/IPv4

func IP2Decimal1

func IP2Decimal1(ipstr string) (int64, error)

IP2Decimal1 transform ip format like x.x.x.x to decimal.

func IsBankCard

func IsBankCard(n int64) (ok bool, err error)

IsBankCard determine whether it is bankcard number

func IsChineseID

func IsChineseID(s string) (ok bool, err error)

IsChineseID determine whether it is Chinese ID Card Number

func IsChineseWords

func IsChineseWords(words string) (ok bool, err error)

IsChineseWords determine whether it is Chinese words Notice: NOT ALL

func IsEmail

func IsEmail(email string) (ok bool, err error)

IsEmail determine whether it is email address

func JSON

func JSON(w http.ResponseWriter, v interface{})

func NewBytesPool

func NewBytesPool(n int) sync.Pool

func Random

func Random(min, max int64) int64

Random used to get a random number between [min, max)

func RandomNumber

func RandomNumber() (i int64)

RandomNumber used to get a random number

func ReadJSON

func ReadJSON(r *http.Request, o interface{}) error

Types

type CIDRInfo

type CIDRInfo struct {
	First   string
	Last    string
	Block   int64
	Network string
	Count   int64
}

CIDRInfo is the struct of CIDR

func CIDR

func CIDR(cidr string) (c *CIDRInfo, err error)

CIDR return *CIDRInfo from like this x.x.x.x/x ref: http://goo.gl/AEUIi8

Jump to

Keyboard shortcuts

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