alrm/check/check.go

20 lines
301 B
Go
Raw Normal View History

package check
2020-08-20 08:44:56 -08:00
import (
"fmt"
)
type Check interface {
Parse(string) (bool, error)
2021-01-02 06:29:12 -09:00
Check(int) error
}
func NewCheck(name string, addr string) (Check, error) {
2020-08-20 08:44:56 -08:00
switch name {
case "ping":
return NewCheckPing(addr), nil
2020-08-20 08:44:56 -08:00
default:
return nil, fmt.Errorf("unknown check name \"%s\"", name)
}
}