Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more checks #6

Open
ghost opened this issue Feb 5, 2022 · 0 comments
Open

Add more checks #6

ghost opened this issue Feb 5, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 5, 2022

// Check if the IP is a private IP
func isPrivateIP(ipAddress net.IP) bool {
	return ipAddress.IsPrivate()
}

// Check if the ip is a multicast IP
func isMulticastIP(ipAddress net.IP) bool {
	return ipAddress.IsMulticast()
}

// Check if the ip is a loopback ip.
func isLoopbackIP(ipAddress net.IP) bool {
	return ipAddress.IsLoopback()
}

// Checks if the ip is a local unicast ip
func isLocalUnicastIP(ipAddress net.IP) bool {
	return ipAddress.IsLinkLocalUnicast()
}

// Check if the ip is a local multicast ip
func isLocalMulticastIP(ipAddress net.IP) bool {
	return ipAddress.IsLinkLocalMulticast()
}

// Check if the ip is a interface local multicast ip
func isInterfaceLocalMulticastIP(ipAddress net.IP) bool {
	return ipAddress.IsInterfaceLocalMulticast()
}

// Check if the IP address is a global unicast IP
func isGlobalUnicastIP(ipAddress net.IP) bool {
	return ipAddress.IsGlobalUnicast()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants