-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (52 loc) · 959 Bytes
/
main.go
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
package main
import (
"fmt"
"net/http"
"time"
)
const ()
type Status string
const (
Operational Status = "Operational"
DegradedPerformance Status = "DegradedPerformance"
PartialOutage Status = "PartialOutage"
MajorOutage Status = "MajorOutage"
Maintenance Status = "Maintenance"
)
var AllStatuses = []Status{
Operational,
DegradedPerformance,
PartialOutage,
MajorOutage,
Maintenance,
}
type Domain struct {
Url string
Intervals uint
Status Status
LastInterval time.Time
}
type Response struct {
Status int
Latency uint
Time time.Time
}
type Incident struct {
Error uint
Protocol string
FirstLog time.Time
LastLog time.Time
Length uint
}
func (t Domain) SendPing() error {
resp, err := http.Get(t.Url)
if err != nil {
return err
}
var newResponse Response
newResponse.Status = resp.StatusCode
return nil
}
func main() {
fmt.Println("Site Uptime Alerts")
}