25 lines
415 B
Go
25 lines
415 B
Go
package checks
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type Checks struct {
|
|
Message func(string)
|
|
}
|
|
|
|
func (c *Checks) get(url string) (*http.Response, error) {
|
|
res, err := http.Get(url)
|
|
if err != nil {
|
|
//log.Println(domain + " error: " + err.Error())
|
|
return nil, err
|
|
}
|
|
|
|
if res.StatusCode != 200 {
|
|
//log.Println(domain + " status: " + res.Status)
|
|
return nil, fmt.Errorf("bad status code")
|
|
}
|
|
|
|
return res, nil
|
|
}
|