net

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderXRealIP       = "X-Real-Ip"
	HeaderXForwardedFor = "X-Forwarded-For"
)

Variables

This section is empty.

Functions

func BetweenMatch

func BetweenMatch(addr net.IP, block string) bool

BetweenMatch checks if ip belongs to specific IP Start-End range (ip-ip)

func BytesToMAC

func BytesToMAC(mac []byte) string

BytesToMAC converts a binary representation of a MAC address to string representation

func CIDRMatch

func CIDRMatch(ip net.IP, cidr string) bool

CIDRMatch checks if specific ip belongs to specific cidr block (ip/mask)

func CheckConnect

func CheckConnect(host string) error

func GetClientIP

func GetClientIP(r *http.Request) string

func GetLocalAddr

func GetLocalAddr() string

func GetLocalHostName

func GetLocalHostName() string

GetLocalHostName returns the local hostname or the local IP if the hostname cannot be resolved

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host

func GetMacAddr

func GetMacAddr() (addr string)

GetMacAddr returns the local mac address

func IPBetween

func IPBetween(from net.IP, to net.IP, userIp net.IP) bool

IPBetween does determine if a given ip is between two others (inclusive)

func IPInRange

func IPInRange(ip string, list []string) bool

func IPToInt

func IPToInt(ip string) uint32

IPToInt encodes a string representation of a IP to a uint32

func IntToIP

func IntToIP(ip uint32) string

IntToIP decodes a uint32 encoded IP to a string representation

func Lookup

func Lookup(host string) error

func MACToByte

func MACToByte(mac string) []byte

MACToByte converts a binary representation of a MAC address to string representation

func WildcardMatch

func WildcardMatch(userIP net.IP, wildcardIP string) bool

WildcardMatch checks if specific ip belongs to specific wildcard IP block

Types

This section is empty.

Jump to

Keyboard shortcuts

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