Documentation ¶
Overview ¶
utils of network
Index ¶
- Constants
- Variables
- func GetDefaultGateway() (net.IP, error)
- func GetExternalIP() (string, error)
- func GetGatewayByNic(nicName string) (net.IP, error)
- func GetHostIP() (string, error)
- func GetInternalIP() (string, error)
- func GetInternalIPByDevName(dev string) ([]string, error)
- func GetLocalConnectIP(proto string, addr string) (string, error)
- func GetRequestIP(r *http.Request) string
- func GetUploadFileSize(upfile multipart.File) (int64, error)
- func HttpTransportWithCache(maxIdle, cacheTo time.Duration)
- func Inet_aton(ipnr net.IP) int64
- func Inet_ntoa(ipnr int64) net.IP
- func IsPrivateIP(ip stdnet.IP) bool
- func IsPublicIP(IP net.IP) bool
- func NetHexToIPv4(s string) net.IP
- func NewResolver(list []string) *stdnet.Resolver
- func OverrideDefaultResolver(list []string)
- func UpdateResolveList(list []string)
- type NSCache
- type NSServer
- type NSServers
- type Resolver
- type RouteItem
- type Size
- type Stat
Constants ¶
View Source
const (
CACHE_IP_MAX = 64
)
Variables ¶
View Source
var (
ErrNotFound = errors.New("NOT FOUND")
)
Functions ¶
func GetDefaultGateway ¶
func GetInternalIPByDevName ¶
根据网卡设备名称返回内部IP
func GetLocalConnectIP ¶
在主机拥有多个IP地址时,返回能够连通对端网络的自身主机IP
func GetRequestIP ¶
返回HTTP请求IP,优先级(X-Real-IP>X-Forwarded-For>Proxy-Client-IP>WL-Proxy-Client-IP")
func GetUploadFileSize ¶
返回HTTP upload文件的大小
func HttpTransportWithCache ¶
func IsPrivateIP ¶
func NetHexToIPv4 ¶
func NewResolver ¶
func OverrideDefaultResolver ¶
func OverrideDefaultResolver(list []string)
func UpdateResolveList ¶
func UpdateResolveList(list []string)
Types ¶
type NSServers ¶
type NSServers struct { NSServer NicNS map[string]NSServer `json:"nicns" yaml:"nicns"` //ns set by nic }
func GetLocalNS ¶
Click to show internal directories.
Click to hide internal directories.