2024-01-08 12:55:23 -06:00
|
|
|
// this defines the kinds of problems that can be detected
|
|
|
|
package main
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
import (
|
2024-01-08 12:55:23 -06:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ProblemType int
|
|
|
|
type ActionType int
|
|
|
|
|
|
|
|
type Problem struct {
|
2024-01-21 00:15:20 -06:00
|
|
|
kind ProblemType
|
2024-01-08 12:55:23 -06:00
|
|
|
action ActionType
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
id int
|
|
|
|
Name string
|
|
|
|
desc string
|
|
|
|
value string
|
|
|
|
aaaa string
|
|
|
|
fixed bool
|
2024-01-10 20:22:25 -06:00
|
|
|
duration time.Duration // how long until you should check to see if it's fixed
|
2024-01-21 00:15:20 -06:00
|
|
|
born time.Time // when first reported
|
2024-01-10 20:22:25 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
begun bool // weather or not fixing it has begun
|
|
|
|
begunTime time.Time // when the attempt to fix the problem happened
|
|
|
|
begunResult bool // weather or not the attempt worked
|
2024-01-08 12:55:23 -06:00
|
|
|
}
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
var IPcreate = Problem{
|
|
|
|
kind: RR,
|
2024-01-08 22:34:08 -06:00
|
|
|
action: CREATE,
|
2024-01-21 00:15:20 -06:00
|
|
|
desc: "This RR entry in the zonefile needs to be removed",
|
2024-01-08 22:34:08 -06:00
|
|
|
}
|
|
|
|
|
2024-01-08 12:55:23 -06:00
|
|
|
/*
|
|
|
|
var hostname Problem = (
|
|
|
|
kind: ProblemType.OS,
|
|
|
|
action: ActionType.CREATE,
|
|
|
|
Name: "Your /etc/hostname file is incorrect",
|
|
|
|
fixed: false,
|
|
|
|
)
|
|
|
|
*/
|
|
|
|
|
|
|
|
const (
|
|
|
|
OS ProblemType = iota
|
|
|
|
ETC
|
|
|
|
RESOLVE
|
|
|
|
RR
|
|
|
|
PING
|
|
|
|
LOOKUP
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
USER ActionType = iota
|
|
|
|
CREATE
|
|
|
|
DELETE
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s Problem) String() string {
|
|
|
|
return s.Name
|
|
|
|
}
|
2024-01-08 22:34:08 -06:00
|
|
|
|
|
|
|
func (s ProblemType) String() string {
|
|
|
|
switch s {
|
|
|
|
case OS:
|
|
|
|
return "OS"
|
|
|
|
case RR:
|
|
|
|
return "RR"
|
|
|
|
default:
|
2024-01-10 20:22:25 -06:00
|
|
|
return "FIXMEP"
|
2024-01-08 22:34:08 -06:00
|
|
|
}
|
2024-01-10 20:22:25 -06:00
|
|
|
return "FIXMEP"
|
2024-01-08 22:34:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s ActionType) String() string {
|
|
|
|
switch s {
|
|
|
|
case USER:
|
|
|
|
return "USER"
|
|
|
|
case CREATE:
|
|
|
|
return "CREATE"
|
|
|
|
case DELETE:
|
|
|
|
return "DELETE"
|
|
|
|
default:
|
2024-01-10 20:22:25 -06:00
|
|
|
return "FIXMEA"
|
2024-01-08 22:34:08 -06:00
|
|
|
}
|
2024-01-10 20:22:25 -06:00
|
|
|
return "FIXMEA"
|
2024-01-08 22:34:08 -06:00
|
|
|
}
|