Documentation
¶
Index ¶
Constants ¶
const ( // PropertyAction is the key for the ACTION property. PropertyAction = "ACTION" // PropertyDevpath is the key for the DEVPATH property. PropertyDevpath = "DEVPATH" // PropertySubsystem is the key for the SUBSYSTEM property. PropertySubsystem = "SUBSYSTEM" // PropertySeqnum is the key for the SEQNUM property. PropertySeqnum = "SEQNUM" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Header string
Subsystem string
Action string
Devpath string
Seqnum string
Properties map[string]string
}
Event represents a udev event.
type EventReader ¶
type EventReader struct {
// contains filtered or unexported fields
}
EventReader reads udev events.
func NewEventReader ¶
func NewEventReader() (*EventReader, error)
NewEventReader creates a new udev event reader.
func NewEventReaderFromReader ¶
func NewEventReaderFromReader(r io.ReadCloser) *EventReader
NewEventReaderFromReader creates a new udev event reader from an existing io.ReadCloser. This can be used to generate synthetic events for testing.
func (*EventReader) Read ¶
func (r *EventReader) Read() (*Event, error)
Read reads a udev event, blocking until one is available.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor monitors udev events.
func NewMonitor ¶
func NewMonitor(options ...MonitorOption) (*Monitor, error)
NewMonitor creates an udev monitor with the given options.
type MonitorOption ¶
type MonitorOption func(*Monitor)
MonitorOption is an opaque option which can be applied to a Monitor.
func WithFilters ¶
func WithFilters(filters ...map[string]string) MonitorOption
WithFilters returns a MonitorOption for filtering events by properties. Properties within a map have AND semantics: the map matches an event if all key-value pairs match the event. Multiple maps have OR semantics: they match an event if at least one map matches the event. Events which are matched are passed through. Others are filtered out.
func WithGlobFilters ¶
func WithGlobFilters(globbers ...map[string]string) MonitorOption
WithGlobFilters returns a MonitorOption for filtering events by properties. Semantics are similar to WithFilters, but properties are matched using glob patterns instead of verbatim comparison.