ipx

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Browser        = "Unknown"
	BrowserVersion = "Unknown"
	Os             = "Unknown"
	Device         = "Unknown"
)
View Source
const (
	IPLocation = "IPLocation"
	IPInfos    = "IPInfos"
)

Variables

This section is empty.

Functions

func ExpandIPv6 added in v0.4.5

func ExpandIPv6(ip string) string

ExpandIPv6 from 2a09:bac2:a919:8c::e:2d2 to 2a09:bac2:a919:008c:0000:0000:000e:02d2

func ExpandIPv6Ptr added in v0.4.5

func ExpandIPv6Ptr(ip *string) string

func IsIPv6 added in v0.4.5

func IsIPv6(ip string) bool

func IsValidIP added in v0.4.5

func IsValidIP(ip string) bool

IsValidIP checks if the provided string is a valid IPv4 address.

func ParseAgent

func ParseAgent(userAgent string) (browser string, browserVersion string, os string, device string)

ParseAgent Function to extract detailed information from User-Agent

Types

type IPInfo

type IPInfo struct {
	IP          string  `json:"ip"`
	CountryCode string  `json:"country_code"`
	CountryName string  `json:"country_name"`
	RegionName  string  `json:"region_name"`
	CityName    string  `json:"city_name"`
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
	ZipCode     string  `json:"zip_code"`
	TimeZone    string  `json:"time_zone"`
	Asn         string  `json:"asn"`
	As          string  `json:"as"`
	IsProxy     bool    `json:"is_proxy"`
}

func Query

func Query(ip string, key string, vendors ...string) (*IPInfo, error)

func QueryByIPInfo added in v0.4.5

func QueryByIPInfo(ip string, key string) (*IPInfo, error)

func QueryFree

func QueryFree(ip string) (*IPInfo, error)

func QueryWithKey

func QueryWithKey(ip string, key string) (*IPInfo, error)

type IPInfoS added in v0.4.5

type IPInfoS struct {
	IP       string `json:"ip"`
	City     string `json:"city"`
	Region   string `json:"region"`
	Country  string `json:"country"`
	Loc      string `json:"loc"`
	Org      string `json:"org"`
	Postal   string `json:"postal"`
	Timezone string `json:"timezone"`
}

Jump to

Keyboard shortcuts

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