package check import ( "time" ) //Result denotes the status from a status check. type Result uint8 const ( //Online means all requests were fulfilled by the remote end. Online Result = iota //Unstable means some requests were fulfilled by the remote end. Unstable //Offline means every requests to the remote end has failed. Offline ) //TryCount is the amount of times requests will be made to the remote end. const TryCount = 3 func statusFromSuccessCount(count int) Result { if count == 0 { return Offline } if count < TryCount { return Unstable } return Online } func divide(t time.Duration, dividend int) time.Duration { return time.Duration(int(t) / dividend) }