Documentation ¶
Overview ¶
Package listener monitors IP changes on a network interface
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileState ¶
type FileState struct {
// contains filtered or unexported fields
}
FileState supplies methods to handle the state via a file
func NewFileState ¶
NewFileState creates a new FileState
func (*FileState) Get ¶
func (f *FileState) Get() (MonitoredIPs, error)
Get reads the state from a YAML file from disk
func (*FileState) InSync ¶
func (f *FileState) InSync(with MonitoredIPs) bool
InSync tests whether the internal state corresponds to the provided one
func (*FileState) Set ¶
func (f *FileState) Set(ips MonitoredIPs) error
Set writes a the state to disk in YAML representation
type Getter ¶
type Getter interface {
Get() (MonitoredIPs, error)
}
Getter allows to retrieve the current state of the MonitoredIPs
type InMemoryState ¶
type InMemoryState struct {
// contains filtered or unexported fields
}
InMemoryState stores the state in memory. It is hence volatile and only persistent as long as the program is running.
func NewInMemoryState ¶
func NewInMemoryState() *InMemoryState
NewInMemoryState creates a new in-memory state
func (*InMemoryState) Get ¶
func (m *InMemoryState) Get() (MonitoredIPs, error)
Get returns the currently stored state
func (*InMemoryState) InSync ¶
func (m *InMemoryState) InSync(with MonitoredIPs) bool
InSync tests whether the internal state corresponds to the provided one
func (*InMemoryState) Reset ¶
func (m *InMemoryState) Reset() error
Reset returns the state to its default value
func (*InMemoryState) Set ¶
func (m *InMemoryState) Set(ips MonitoredIPs) error
Set sets the state to ips
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener listens for IP changes on an interface and updates all its configured destinations
type MonitoredIPs ¶
MonitoredIPs stores the IP objects
func (MonitoredIPs) String ¶
func (m MonitoredIPs) String() string
String outputs the stored IPv4 and IPv6 information
type Setter ¶
type Setter interface {
Set(MonitoredIPs) error
}
Setter allows to set the state to MonitoredIPs