Documentation
¶
Index ¶
- type IPv4CIDR
- func (i *IPv4CIDR) GetCIDRRangeLength() uint32
- func (i *IPv4CIDR) GetIP() string
- func (i *IPv4CIDR) GetIPInRange(n uint32, withCIDR bool) (string, error)
- func (i *IPv4CIDR) GetMask() uint8
- func (i *IPv4CIDR) GetNetmask() string
- func (i *IPv4CIDR) Split() (*IPv4CIDR, *IPv4CIDR, error)
- func (i *IPv4CIDR) ToString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPv4CIDR ¶
type IPv4CIDR struct {
// contains filtered or unexported fields
}
IPv4CIDR models an IPv4 CIDR range. @field ip uint32: Holds the IP address @field mask uint8: Holds the CIDR mask @field netmask uint32: Holds the netmask for the subnet @field rangeLength uint32: Holds the number of IP addresses in the CIDR range
func NewIPv4CIDR ¶
NewIPv4CIDR instantiates a new IPv4CIDR object and returns it @param IP string: A string representation of CIDR range in the format a.b.c.d/e or a.b.c.d @param standardize bool: If the IP part of the CIDR range is not the first IP in range, then setting this value to "true" will automatically convert it to the first IP in range. If set to "false", a non-standard CIDR will give an error @returns *IPv4CIDR: If the input parameters are valid, returns a pointer to a new IPv4CIDR object @returns error: If the input parameters are invalid, or any processing errors occur, returns the appropriate error back to caller.
func (*IPv4CIDR) GetCIDRRangeLength ¶
GetCIDRRangeLength returns the number of IP addresses contained in the CIDR range @returns uint32: Length of the CIDR range
func (*IPv4CIDR) GetIP ¶
GetIP returns the IP part of the CIDR range @returns string: String corresponding to the first IP address in CIDR range in format a.b.c.d
func (*IPv4CIDR) GetIPInRange ¶
GetIPInRange returns the nth IP address in the CIDR block @input n uint32: The value of n, representing the nth IP to return @input withCIDR bool: Flag corresponding to whether to append the CIDR mask with the returned IP or not @returns string: The nth IP address @returns error: If nth IP is out of range of the CIDR block, an error is returned
func (*IPv4CIDR) GetMask ¶
GetMask returns the mask part of the CIDR range (0-32) @returns uint8: Mask of the CIDR range
func (*IPv4CIDR) GetNetmask ¶
GetNetmask returns the netmask for the CIDR range @returns string: Netmask of the CIDR range