netutil

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExternalIP

func GetExternalIP() (string, error)

返回公网出口IP

func GetHostIP

func GetHostIP() (string, error)

返回主机HOST IP

func GetInternalIP

func GetInternalIP() (string, error)

返回主机内部IP(顺序第一个)

func GetInternalIPByDevName

func GetInternalIPByDevName(dev string) ([]string, error)

根据网卡设备名称返回内部IP

func GetLocalConnectIP

func GetLocalConnectIP(proto string, addr string) (string, error)

在主机拥有多个IP地址时,返回能够连通对端网络的自身主机IP

func GetRequestIP

func GetRequestIP(r *http.Request) string

返回HTTP请求IP,优先级(X-Real-IP>X-Forwarded-For>Proxy-Client-IP>WL-Proxy-Client-IP")

func GetUploadFileSize

func GetUploadFileSize(upfile multipart.File) (int64, error)

返回HTTP upload文件的大小

func Inet_aton

func Inet_aton(ipnr net.IP) int64

func Inet_ntoa

func Inet_ntoa(ipnr int64) net.IP

func IsPublicIP

func IsPublicIP(IP net.IP) bool

Types

type Dsn

type Dsn struct {
	Scheme string
	Source string
}

func ParseDsn

func ParseDsn(dsn string) (Dsn, error)

type Size

type Size interface {
	Size() int64
}

获取文件大小的接口

type Stat

type Stat interface {
	Stat() (os.FileInfo, error)
}

获取文件信息的接口

Jump to

Keyboard shortcuts

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