Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IPInCIDR ¶ added in v1.2.19
IPInCIDR determines whether a given IP address is in a given CIDR. It parses the IP address and CIDR from strings and checks if the IP address is in the CIDR.
Parameters:
ip (string): The IP address in string format to be checked. cidr (string): The CIDR in string format to be checked.
Returns:
inCIDR (bool): Returns true if the IP address is in the CIDR, false otherwise.
func IsPrivateIP ¶
IsPrivateIP determines whether a given IP address is a private IP address. It parses the IP address from a string and checks it against a list of predefined private IP blocks.
Parameters:
ip (string): The IP address in string format to be checked.
Returns:
isPrivate (bool): Returns true if the IP address is a private IP address, false otherwise.
func IsValidHostPort ¶ added in v1.2.20
func IsValidIP ¶ added in v1.2.19
IsValidIP determines whether a given IP address is a valid IP address. It parses the IP address from a string and checks if the parsed IP is not nil.
Parameters:
ip (string): The IP address in string format to be checked.
Returns:
isValid (bool): Returns true if the IP address is a valid IP address, false otherwise.
func IsValidIPOrCIDR ¶ added in v1.2.19
IsValidIPOrCIDR determines whether a given string is a valid IP address or CIDR. It first parses the string as an IP address, if it fails, it then parses the string as a CIDR. If both parsing operations fail, the string is not a valid IP address or CIDR.
Parameters:
ipOrCIDR (string): The IP address or CIDR in string format to be checked.
Returns:
isValid (bool): Returns true if the string is a valid IP address or CIDR, false otherwise.
Types ¶
This section is empty.