// AddrAdd will add an IP address to a link device. // // Equivalent to: `ip addr add $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func AddrAdd(link Link, addr *Addr) error { … } // AddrAdd will add an IP address to a link device. // // Equivalent to: `ip addr add $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func (h *Handle) AddrAdd(link Link, addr *Addr) error { … } // AddrReplace will replace (or, if not present, add) an IP address on a link device. // // Equivalent to: `ip addr replace $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func AddrReplace(link Link, addr *Addr) error { … } // AddrReplace will replace (or, if not present, add) an IP address on a link device. // // Equivalent to: `ip addr replace $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func (h *Handle) AddrReplace(link Link, addr *Addr) error { … } // AddrDel will delete an IP address from a link device. // // Equivalent to: `ip addr del $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func AddrDel(link Link, addr *Addr) error { … } // AddrDel will delete an IP address from a link device. // Equivalent to: `ip addr del $addr dev $link` // // If `addr` is an IPv4 address and the broadcast address is not given, it // will be automatically computed based on the IP mask if /30 or larger. func (h *Handle) AddrDel(link Link, addr *Addr) error { … } func (h *Handle) addrHandle(link Link, addr *Addr, req *nl.NetlinkRequest) error { … } // AddrList gets a list of IP addresses in the system. // Equivalent to: `ip addr show`. // The list can be filtered by link and ip family. func AddrList(link Link, family int) ([]Addr, error) { … } // AddrList gets a list of IP addresses in the system. // Equivalent to: `ip addr show`. // The list can be filtered by link and ip family. func (h *Handle) AddrList(link Link, family int) ([]Addr, error) { … } func parseAddr(m []byte) (addr Addr, family int, err error) { … } type AddrUpdate … // AddrSubscribe takes a chan down which notifications will be sent // when addresses change. Close the 'done' chan to stop subscription. func AddrSubscribe(ch chan<- AddrUpdate, done <-chan struct{ … } // AddrSubscribeAt works like AddrSubscribe plus it allows the caller // to choose the network namespace in which to subscribe (ns). func AddrSubscribeAt(ns netns.NsHandle, ch chan<- AddrUpdate, done <-chan struct{ … } type AddrSubscribeOptions … // AddrSubscribeWithOptions work like AddrSubscribe but enable to // provide additional options to modify the behavior. Currently, the // namespace can be provided as well as an error callback. func AddrSubscribeWithOptions(ch chan<- AddrUpdate, done <-chan struct{ … } func addrSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- AddrUpdate, done <-chan struct{ … }