summaryrefslogtreecommitdiff
path: root/problems.go
blob: 12b2c44d2159aa0f784af5298f78079157dbddd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// this defines the kinds of problems that can be detected
package main

import 	(
	"time"
)

type ProblemType int
type ActionType int

type Problem struct {
	kind ProblemType
	action ActionType

	id int
	Name string
	desc string
	value string
	aaaa string
	fixed bool
	duration time.Duration // how long until you should check to see if it's fixed
	born time.Time // when first reported

	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
}

var IPcreate = Problem {
	kind: RR,
	action: CREATE,
	desc: "This RR entry in the zonefile needs to be removed",
}

/*
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
}

func (s ProblemType) String() string {
	switch s {
	case OS:
		return "OS"
	case RR:
		return "RR"
	default:
		return "FIXMEP"
	}
	return "FIXMEP"
}

func (s ActionType) String() string {
	switch s {
	case USER:
		return "USER"
	case CREATE:
		return "CREATE"
	case DELETE:
		return "DELETE"
	default:
		return "FIXMEA"
	}
	return "FIXMEA"
}