Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrNoDuration = "[DMS]: no duration given" ErrNoUsername = "[DMS]: no username given" ErrNoPassword = "[DMS]: no password given" ErrNoFunction = "[DMS]: no function given" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeadMansSwitch ¶
type DeadMansSwitch struct {
// TimerDuration specifies the timespan
// after which it will run OnTrigger
// if the Dead Mans Switch was not reset
TimerDuration time.Duration
// Username is the username for the Dead
// Mans Switch which has to be provided
// via BasicAuth
Username string
// Password is the Password for the Dead
// Mans Switch which has to be provided
// via BasicAuth
Password string
// OnTrigger is the function which gets
// run once the timer runs out because
// it was not reset
OnTrigger func()
}
A DeadManSwitch struct stores values such as Duration and Credentials
func (*DeadMansSwitch) Handler ¶
func (d *DeadMansSwitch) Handler() http.HandlerFunc
Handler returns a http.HandlerFunc which can be used in every web framework/router
func (*DeadMansSwitch) SetOnTrigger ¶
func (d *DeadMansSwitch) SetOnTrigger(f func()) *DeadMansSwitch
SetOnTrigger sets the OnTrigger function of the Dead Mans Switch
func (*DeadMansSwitch) SetPassword ¶
func (d *DeadMansSwitch) SetPassword(p string) *DeadMansSwitch
SetPassword sets the Password of the Dead Mans Switch
func (*DeadMansSwitch) SetTimerDuration ¶
func (d *DeadMansSwitch) SetTimerDuration(t time.Duration) *DeadMansSwitch
SetTimerDuration sets the Timer Duration of the Dead Mans Switch
Click to show internal directories.
Click to hide internal directories.