devmon

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package devmon contains the device monitor.

Index

Constants

This section is empty.

Variables

View Source
var RegisterLinkUpdates = func(d *DevMon) (chan netlink.LinkUpdate, error) {

	events := make(chan netlink.LinkUpdate)
	options := netlink.LinkSubscribeOptions{
		ListExisting: true,
	}
	if err := netlink.LinkSubscribeWithOptions(events, d.upsDone, options); err != nil {
		return nil, fmt.Errorf("could not subscribe to link updates: %w", err)
	}

	return events, nil
}

RegisterLinkUpdates registers for link update events.

Functions

This section is empty.

Types

type DevMon

type DevMon struct {
	// contains filtered or unexported fields
}

DevMon is a device monitor.

func NewDevMon

func NewDevMon() *DevMon

NewDevMon returns a new device monitor.

func (*DevMon) Start

func (d *DevMon) Start() error

Start starts the device monitor.

func (*DevMon) Stop

func (d *DevMon) Stop()

Stop stops the device monitor.

func (*DevMon) Updates

func (d *DevMon) Updates() chan *Update

Updates returns the Update channel for device updates.

type Update

type Update struct {
	Add    bool
	Device string
	Type   string
	Index  int
}

Update is a device update.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL