netutil

package
v0.0.0-...-cdfbdfc Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UTF8     = "UTF-8"
	GB18030  = "GB18030"
	GBK      = "GBK"
	HZGB2312 = "HZGB2312"
)

Variables

View Source
var DefaultHTTPHeader = map[string]string{
	"Connection":                "keep-alive",
	"Cache-Control":             "max-age=0",
	"Upgrade-Insecure-Requests": "1",
	"User-Agent":                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
	"Accept":                    "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
	"Accept-Encoding":           "gzip, deflate",
	"Accept-Language":           "zh-CN,zh;q=0.9,en;q=0.8",
}

DefaultHTTPHeader default http header

Functions

func GetExternalIP

func GetExternalIP() (string, error)

GetExternalIP get external ip

func GetHTTP

func GetHTTP(url string, timeout time.Duration, header map[string]string) (string, error)

GetHTTP get http

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP get local ip

func GetLocalIPv4s

func GetLocalIPv4s() ([]string, error)

GetLocalIPv4s get local ipv4

func IsPublicIP

func IsPublicIP(IP net.IP) bool

IsPublicIP is public ip

Types

This section is empty.

Jump to

Keyboard shortcuts

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