Documentation
¶
Index ¶
- Variables
- func DefaultInterface() (string, error)
- func First(ipnet *net.IPNet) net.IP
- func Last(ipnet *net.IPNet) net.IP
- func NextBy(ip netip.Addr, by int) netip.Addr
- func Overlap(a, b *net.IPNet) bool
- func ParseIP(ip string) (net.IP, error)
- func PrevBy(ip netip.Addr, by int) netip.Addr
- type BasicSubnetAllocator
- type IPFamily
- type Network
- func (n *Network) Contains(ip net.IP) bool
- func (n *Network) ContainsNetwork(other *Network) bool
- func (n *Network) FirstAddress() netip.Addr
- func (n *Network) IPNet() *net.IPNet
- func (n *Network) LastAddress() netip.Addr
- func (n *Network) MarshalJSON() ([]byte, error)
- func (n *Network) UnmarshalJSON(data []byte) error
- func (n *Network) Validate() error
- type SubnetAllocator
- type SubnetPool
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DefaultInterface ¶
Types ¶
type BasicSubnetAllocator ¶
type BasicSubnetAllocator struct {
// contains filtered or unexported fields
}
func NewBasicSubnetAllocator ¶
func NewBasicSubnetAllocator(pool SubnetPool) (*BasicSubnetAllocator, error)
func (*BasicSubnetAllocator) Allocate ¶
func (a *BasicSubnetAllocator) Allocate(network *Network) error
func (*BasicSubnetAllocator) AllocateNext ¶
func (a *BasicSubnetAllocator) AllocateNext() (Network, error)
func (*BasicSubnetAllocator) Release ¶
func (a *BasicSubnetAllocator) Release(subnet *Network) error
type Network ¶
type Network struct { Family IPFamily `json:"family"` IP net.IP `json:"ip"` PrefixLength int `json:"prefix_length"` }
func (*Network) ContainsNetwork ¶
func (*Network) FirstAddress ¶
func (*Network) LastAddress ¶
func (*Network) MarshalJSON ¶
func (*Network) UnmarshalJSON ¶
type SubnetAllocator ¶
type SubnetPool ¶
func (SubnetPool) AddressesBySubnet ¶
func (p SubnetPool) AddressesBySubnet() int
Click to show internal directories.
Click to hide internal directories.