Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(dest string, src string)
- func DecodeBase64(s string) string
- func EnsureFileFolderExists(path string)
- func FileExist(path string) bool
- func FilterField(field string) bool
- func FilterQuery(urlString string, blackList []string) string
- func FloatsToStrings(floatArray []float64) []string
- func GenerateId() string
- func GetCurrentTime() string
- func GetCurrentTimeEx(timestamp string) string
- func GetCurrentTimeWithMilli() string
- func GetDescFromIP(ip string) string
- func GetDescFromUserAgent(userAgent string) string
- func GetIPFromRequest(req *http.Request) string
- func GetIPInfo(clientIP string) string
- func GetId(owner, name string) string
- func GetIdFromOwnerAndName(owner string, name string) string
- func GetOwnerAndNameFromId(id string) (string, string)
- func GetOwnerAndNameFromId3(id string) (string, string, string)
- func GetOwnerAndNameFromId3New(id string) (string, string, string)
- func GetPath(path string) string
- func GetRandomColor() string
- func GetRandomName() string
- func GetUploadCsvPath(fileId string) string
- func GetUploadFilePath(fileId string) string
- func GetUploadXlsxPath(fileId string) string
- func IndexAt(s, sep string, n int) int
- func Init(dataFile string) (err error)
- func InitIpDb()
- func InitParser()
- func InitWithData(data []byte)
- func JsonToStruct(data string, v interface{}) error
- func ListFiles(path string) []string
- func LoadCsvFile(path string, rows *[][]string)
- func LoadFactorFileByCsv(path string) ([]string, [][]float64)
- func LoadFactorFileByCsv2(path string) ([]string, [][]float64)
- func LoadFactorFileBySpace(path string) ([]string, [][]float64)
- func MixColor(c1 color.RGBA, c2 color.RGBA, t float64) color.RGBA
- func ParseFloat(s string) float64
- func ParseInt(s string) int
- func ParseIntWithError(s string) (int, error)
- func ReadBytesFromPath(path string) []byte
- func ReadStringFromPath(path string) string
- func RemoveExt(filename string) string
- func SafeGoroutine(fn func())
- func SnakeString(s string) string
- func StringsToFloats(stringArray []string) []float64
- func StructToJson(v interface{}) string
- func StructToJsonNoIndent(v interface{}) string
- func WriteBytesToPath(b []byte, path string)
- func WriteCsvFile(path string, rows *[][]string)
- func WriteStringToPath(s string, path string)
- type LocationInfo
- type Locator
Constants ¶
View Source
const Null = "N/A"
Variables ¶
View Source
var (
ErrInvalidIp = errors.New("invalid IP format")
)
View Source
var Parser *uaparser.Parser
View Source
var ReFieldWhiteList *regexp.Regexp
Functions ¶
func DecodeBase64 ¶
func EnsureFileFolderExists ¶
func EnsureFileFolderExists(path string)
func FilterField ¶ added in v1.162.0
func FilterQuery ¶
func FloatsToStrings ¶
func GenerateId ¶
func GenerateId() string
func GetCurrentTime ¶
func GetCurrentTime() string
func GetCurrentTimeEx ¶
func GetCurrentTimeWithMilli ¶ added in v1.33.0
func GetCurrentTimeWithMilli() string
func GetDescFromIP ¶ added in v1.28.0
func GetDescFromUserAgent ¶ added in v1.28.0
func GetIPFromRequest ¶
func GetIdFromOwnerAndName ¶
func GetOwnerAndNameFromId ¶
func GetRandomColor ¶
func GetRandomColor() string
func GetRandomName ¶
func GetRandomName() string
func GetUploadCsvPath ¶
func GetUploadFilePath ¶
func GetUploadXlsxPath ¶
func InitParser ¶ added in v1.28.0
func InitParser()
func JsonToStruct ¶
func LoadCsvFile ¶
func LoadFactorFileByCsv ¶
func LoadFactorFileByCsv2 ¶
func LoadFactorFileBySpace ¶
func ParseFloat ¶
func ParseIntWithError ¶
func ReadBytesFromPath ¶
func ReadStringFromPath ¶
func SafeGoroutine ¶
func SafeGoroutine(fn func())
func SnakeString ¶ added in v1.162.0
SnakeString transform XxYy to xx_yy
func StringsToFloats ¶
func StructToJson ¶
func StructToJson(v interface{}) string
func StructToJsonNoIndent ¶ added in v1.73.0
func StructToJsonNoIndent(v interface{}) string
func WriteBytesToPath ¶
func WriteCsvFile ¶
func WriteStringToPath ¶
Types ¶
type LocationInfo ¶ added in v1.28.0
func Find ¶ added in v1.28.0
func Find(ipstr string) (*LocationInfo, error)
Find locationInfo by ip string It will return err when ipstr is not a valid format
func FindByUint ¶ added in v1.28.0
func FindByUint(ip uint32) *LocationInfo
Find locationInfo by uint32
type Locator ¶ added in v1.28.0
type Locator struct {
// contains filtered or unexported fields
}
func NewLocator ¶ added in v1.28.0
New locator with dataFile
func NewLocatorWithData ¶ added in v1.28.0
New locator with data
func (*Locator) Find ¶ added in v1.28.0
func (loc *Locator) Find(ipstr string) (info *LocationInfo, err error)
Find locationInfo by ip string It will return err when ipstr is not a valid format
func (*Locator) FindByUint ¶ added in v1.28.0
func (loc *Locator) FindByUint(ip uint32) (info *LocationInfo)
Find locationInfo by uint32
Click to show internal directories.
Click to hide internal directories.