ip

package
v1.8.86 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(r *http.Request) string

GetClientIP 获取客户端的 IP 地址

func GetLocalPrivateIP

func GetLocalPrivateIP() string

GetLocalPrivateIP 获取本机第一个私有环回地址

func GetLocalPublicIP

func GetLocalPublicIP() (string, error)

GetLocalPublicIP 获取本机的公网IP地址

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

IsPrivateIP 判断给定的 IP 地址是否是私有IP(包括环回IP和局域网IP)

func IsValidPublicIP

func IsValidPublicIP(ip string) bool

IsValidPublicIP 验证一个 IP 地址是否是有效的公网 IP 和ip_address文件里面的检测是否私有地址是不同的

func ToUniqueStr

func ToUniqueStr(ipStr string) string

ToUniqueStr 将IP变成一个唯一字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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