trimmed old functions
Signed-off-by: Michael <michael.lindman@gmail.com>
This commit is contained in:
parent
5af5f3d277
commit
9a7e759260
19
helper.go
19
helper.go
|
@ -11,9 +11,6 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
// IP returns IP address from requester
|
||||
|
@ -29,22 +26,6 @@ func IP(r *http.Request) (net.IP, error) {
|
|||
return net.ParseIP(ip), nil
|
||||
}
|
||||
|
||||
// ColourStatus colour code statuscodes
|
||||
func ColourStatus(statuscode int) string {
|
||||
status := color.GreenString(strconv.Itoa(statuscode))
|
||||
switch {
|
||||
case statuscode == 200:
|
||||
status = color.GreenString(strconv.Itoa(statuscode))
|
||||
case statuscode >= 500 && statuscode <= 511:
|
||||
status = color.RedString(strconv.Itoa(statuscode))
|
||||
case statuscode >= 400 && statuscode <= 451:
|
||||
status = color.YellowString(strconv.Itoa(statuscode))
|
||||
default:
|
||||
status = color.MagentaString(strconv.Itoa(statuscode))
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
// Hostname returns hostname
|
||||
func Hostname(ip net.IP) ([]string, error) {
|
||||
names, err := net.LookupAddr(ip.String())
|
||||
|
|
Reference in New Issue