alrm/check/check.go

20 lines
330 B
Go
Raw Normal View History

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