network

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MacFormatColon3  = "colon-3"
	MacFormatColon6  = "colon-6"
	MacFormatHyphen3 = "hyphen-3"
	MacFormatHyphen6 = "hyphen-6"
	MacFormatDot6    = "dot-6"
	MacFormatNoDelim = "no-delim"
)
View Source
const TextLineSeparator = "\r\n"

Variables

This section is empty.

Functions

func ConvertHexToIp

func ConvertHexToIp(hex string) string

func ConvertIpToHex

func ConvertIpToHex(ip string) string

func FindInterfaceByIp added in v0.1.6

func FindInterfaceByIp(addr string) (*net.Interface, error)

func FormatMac added in v0.1.8

func FormatMac(data string, format string) (string, error)

colon-3,冒号,0000:0000:0000 colon-6,冒号,00:00:00:00:00:00 hyphen-3,中划线,0000-0000-0000 hyphen-6,中划线,00-00-00-00-00-00 dot-6,点分割,00.00.00.00.00.00 no-delim,无分隔符,000000000000

func GetCidrHostNum

func GetCidrHostNum(maskLen int) uint

GetCidrHostNum @Description: 计算得到CIDR地址范围内可拥有的主机数量 @param maskLen @return uint

func GetCidrIpMask

func GetCidrIpMask(maskLen int) string

GetCidrIpMask @Description: 获取Cidr的掩码 @param maskLen @return string

func GetCidrIpRange

func GetCidrIpRange(cidr string) (string, string)

func GetCidrIpRangeHex

func GetCidrIpRangeHex(cidr string) (string, string)

func GetLocalIps added in v0.1.6

func GetLocalIps() []string

func HostsOfCidr

func HostsOfCidr(cidr string) ([]string, error)

func IntegerStringToMac

func IntegerStringToMac(intMacStr, separ string) []string

func IsIpInGateway

func IsIpInGateway(ip, min, max string) bool

func IsValidIp

func IsValidIp(input string) bool

func ParseMac

func ParseMac(s string) net.HardwareAddr

func SendMultiCastDataByInterface added in v0.1.6

func SendMultiCastDataByInterface(ni *net.Interface, remoteAddr *net.UDPAddr, message string, respPrefix string, timeout time.Duration) ([]string, error)

func SendUdpData added in v0.1.6

func SendUdpData(host string, port int, message []byte, timeout time.Duration, bufferSize int) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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