Documentation
¶
Index ¶
- func AssignFirstHostIP(ifaceName, cidr string) error
- func AssignFirstHostIPToLink(link netlink.Link, cidr string) error
- func AssignIfaceIP(ifaceName, cidr string) error
- func FirstHostCIDR(subnet *net.IPNet) string
- func NextIP(ip net.IP) net.IP
- func SubnetForIndex(baseCIDR string, childBits int, n uint) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignFirstHostIP ¶
AssignFirstHostIP assigns the first host IP of cidr to the named interface. e.g. cidr="10.9.5.0/24" → assigns 10.9.5.1/24 to ifaceName.
func AssignFirstHostIPToLink ¶
AssignFirstHostIPToLink assigns the first host IP of cidr to an already-resolved link. Use when the caller already holds a netlink.Link (avoids a second LinkByName lookup).
func AssignIfaceIP ¶
AssignIfaceIP assigns cidr (e.g. "10.8.0.1/24") to the named interface and brings it up. Idempotent — EEXIST is not an error.
func FirstHostCIDR ¶
FirstHostCIDR returns the first host address of subnet as "ip/prefix" (e.g. 10.8.0.0/24 → 10.8.0.1/24).
func SubnetForIndex ¶
SubnetForIndex computes a child subnet by adding n * 2^(32-childBits) to the literal host address in baseCIDR (NOT the masked network address). This lets you write "10.8.0.0/10" to mean "start from 10.8.0.0 within the /10 space". Example: SubnetForIndex("10.8.0.0/10", 24, 5) → "10.8.5.0/24"
Types ¶
This section is empty.