Documentation
¶
Index ¶
- func IPToInt(ip net.IP) uint32
- func IntToIP(nn uint32) net.IP
- func InvertIPMask(in net.IPMask) net.IPMask
- func MustOffsetString(subnet string, offset int) string
- func OffsetString(subnet string, offset int) (string, error)
- type I4
- func (i I4) Base() I4
- func (i4 I4) CIDRString() string
- func (i4 I4) DoubleDottedQuad() string
- func (i4 I4) DoubleDottedQuadInvertedMask() string
- func (i4 *I4) FromString(s string) error
- func (i4 *I4) FromStringNoOffset(s string) error
- func (i I4) GetAll(lowerOffset, upperOffset int) ([]I4, error)
- func (i I4) Host() I4
- func (i4 I4) IP() net.IP
- func (i4 I4) IPString() string
- func (i I4) Last() I4
- func (i *I4) MakeHost()
- func (i4 I4) MarshalJSON() ([]byte, error)
- func (i4 I4) Mask() IPMask
- func (i4 I4) MaskBits() int
- func (i4 I4) MaskString() string
- func (i I4) MustOffset(offset int) I4
- func (i I4) NumHosts() int
- func (i I4) NumIPs() int
- func (i I4) Number() uint32
- func (i I4) Offset(offset int) (I4, error)
- func (i I4) Overlaps(i2 I4) bool
- func (i *I4) Rebase()
- func (i I4) SetMaskBits(maskBits int) I4
- func (i4 I4) String() string
- func (i I4) SubnetOffset(o int) I4
- func (i4 *I4) UnmarshalJSON(b []byte) error
- func (i4 *I4) UnmarshalText(b []byte) error
- type I4Numerical
- type IPMask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvertIPMask ¶ added in v1.0.2
InvertIPMask inverts a net.IPMask
func MustOffsetString ¶
MustOffsetString same as OffsetString but panics if called with wrong parameter
Types ¶
type I4 ¶
type I4 struct {
// contains filtered or unexported fields
}
I4 is a simple and easy to use type to handle an IP address or an IP network it is designed to be mutable
func NewI4FromIP ¶
NewI4FromIP creates a new I4 from net.IP (32 bit mask)
func NewI4NoOffset ¶
NewI4NoOffset create a new I4 from a string
func (I4) DoubleDottedQuad ¶
DoubleDottedQuad returns the IP in double dotted quad 192.168.0.1 255.255.255.255
func (I4) DoubleDottedQuadInvertedMask ¶ added in v1.0.2
DoubleDottedQuadInvertedMask returns the IP in double dotted quad 192.168.0.1 255.255.255.255
func (*I4) FromString ¶
FromString sets the state from the string but supports + Notation for Offsets
func (*I4) FromStringNoOffset ¶
FromStringNoOffset sets the state from the string
func (I4) MarshalJSON ¶ added in v1.0.1
MarshalJSON used to marshal json
func (I4) MustOffset ¶
MustOffset sames as offset but panics on error
func (I4) Offset ¶
Offset adds the offset to the network address offset 0 returns the network address offset 1 returns the first host address offset -1 returns the last address (i.e. the broadcast address) offset -2 returns the last host address
func (I4) SetMaskBits ¶ added in v1.2.0
SetMaskBits sets the mask bits
func (I4) SubnetOffset ¶
SubnetOffset gives the +-i subnet with the same mask, i.e. the IP address that is shifted o times the number of hosts upwards or downwards
func (*I4) UnmarshalJSON ¶
UnmarshalJSON is used to unmarshal json
func (*I4) UnmarshalText ¶
UnmarshalText satisfies encoding.TextUnmarshaler
type I4Numerical ¶
type I4Numerical []I4
I4Numerical makes IP addresses sortable
func (I4Numerical) Len ¶
func (i4n I4Numerical) Len() int
func (I4Numerical) Less ¶
func (i4n I4Numerical) Less(i, j int) bool
func (I4Numerical) Swap ¶
func (i4n I4Numerical) Swap(i, j int)
type IPMask ¶ added in v1.1.0
type IPMask []byte
IPMask is like the net.IPMask type