Documentation ¶
Overview ¶
Package netlink uses the netlink library to watch for changes in link states.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkIndex ¶
type LinkIndex int
LinkIndex is an opaque identifier for a link as used by netlink.
type MultiSubscription ¶
type MultiSubscription struct{}
MultiSubscription represents a subscription over all links.
func (MultiSubscription) Get ¶
func (s MultiSubscription) Get() []Link
Get returns the most recent Link that matches the subscription conditions.
func (MultiSubscription) Next ¶
func (s MultiSubscription) Next() <-chan struct{}
Next returns a channel that will be closed on the next update.
type Subscription ¶
type Subscription struct { C <-chan struct{} // contains filtered or unexported fields }
Subscription represents a potentially filtered subscription to netlink, which returns the best link that matches the filter conditions specified.
func Any ¶
func Any() *Subscription
Any creates a netlink watcher that returns the 'best' link. Links are preferred in order of their status, and then by name. The status order is Up > Dormant > Testing > LowerLayerDown > Down > NotPresent > Unknown. (A 'virtual' link with status Gone may be returned if no links are available). If multiple links have the same status, they are ordered alphabetically by their name.
func ByName ¶
func ByName(name string) *Subscription
ByName creates a netlink watcher for the named interface. Any updates to the named interface will cause the current information about that link to be sent on the returned channel.
func WithPrefix ¶
func WithPrefix(prefix string) *Subscription
WithPrefix creates a netlink watcher that returns the 'best' link beginning with the given prefix (e.g. 'wl' for wireless, or 'e' for ethernet). See #Any() for details on link priority.
func (*Subscription) Get ¶
func (s *Subscription) Get() Link
Get returns the most recent Link that matches the subscription conditions.
func (*Subscription) Next ¶
func (s *Subscription) Next() <-chan struct{}
Next returns a channel that will be closed on the next update.
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe()
Unsubscribe stops further notifications and closes the channel.