ip

package
v1.8.81 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 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 added in v1.8.68

func GetClientIP(r *http.Request) string

GetClientIP 获取客户端的 IP 地址

func GetLocalPrivateIP added in v1.8.68

func GetLocalPrivateIP() string

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

func GetLocalPublicIP added in v1.8.68

func GetLocalPublicIP() (string, error)

GetLocalPublicIP 获取本机的公网IP地址

func IsPrivateIP added in v1.8.68

func IsPrivateIP(ip net.IP) bool

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

func IsValidPublicIP added in v1.8.68

func IsValidPublicIP(ip string) bool

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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