gNet

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIPFromRequest

func GetIPFromRequest(req *http.Request) (ip string, err error)

func IsInBlocks

func IsInBlocks(ip string, blocks []string) (isInBlocks bool, err error)

IsInBlocks IP是否包含在地址快中

func IsLinkLocal

func IsLinkLocal(ip string) (isLinkLocal bool, err error)

IsLinkLocal IP是否为链路本地地址

func IsLoopback

func IsLoopback(ip string) (isLoopback bool, err error)

IsLoopback IP是否为回环地址

func IsPrivate

func IsPrivate(ip string) (isPrivate bool, err error)

IsPrivate IP是否为专用地址

func IsPublic

func IsPublic(ip string) (isPublic bool, err error)

IsPublic IP是否为公网地址

Types

type Flag

type Flag struct {
	Up        bool `json:"up"`
	Unicast   bool `json:"unicast"`
	Broadcast bool `json:"broadcast"`
	Multicast bool `json:"multicast"`
}

type NetInterface

type NetInterface struct {
	Name string   `json:"name"`
	Ipv4 []string `json:"ipv4"`
	Ipv6 []string `json:"ipv6"`
	Flag Flag     `json:"flag"`
	Mac  string   `json:"mac"`
}

NetInterface 网络接口

func GetNetInterfaces

func GetNetInterfaces() (netInterface []NetInterface, err error)

Jump to

Keyboard shortcuts

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