ip

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GET_PUBLIC_IP_URL 查询公网IP的URL
	GET_PUBLIC_IP_URL = "http://myexternalip.com/raw"
)
View Source
const (
	// TIME_OUT 第三方接口请求超时时间
	TIME_OUT = 3 * time.Second
)

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(r *http.Request) (ip string)

GetClientIP *

  • @Description: 获取用户真实IP
  • @param r
  • @return ip

func GetGPSByIpAmap added in v0.1.2

func GetGPSByIpAmap(ip string) (data map[string]interface{}, err error)

GetGPSByIpAmap *

  • @Description: 获取IP对应得GPS坐标(内网地址则匹配当前地址所对应得公网地址)
  • @param ip ip地址
  • @return data
  • @return err 错误信息

func GetLocalIp

func GetLocalIp() (ips []string, err error)

GetLocalIp *

  • @Description: 查询本机内网IP
  • @return ips ip列表
  • @return err 错误

func GetPublicIP

func GetPublicIP() (ip string, err error)

GetPublicIP *

  • @Description: 获取本机公网ip
  • @return ip
  • @return err

func IsIPv4

func IsIPv4(ip string) (ok bool)

IsIPv4 *

  • @Description: 判断是否为合法的ipv4地址
  • @param ip ip地址
  • @return ok 是否合法

func IsIPv6

func IsIPv6(ip string) (ok bool)

IsIPv6 *

  • @Description: 判断是否为合法的ipv6地址
  • @param ip ip地址
  • @return ok 是否合法

func IsIpAddress

func IsIpAddress(ip string) (ok bool)

IsIpAddress *

  • @Description: 判断是否为合法的ip地址
  • @param ip ip地址
  • @return ok 是否合法

Types

This section is empty.

Jump to

Keyboard shortcuts

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