golang net.DialTimeout
func checkAlive(ip string, port int) bool {
isAlive := false
_, err := net.DialTimeout("tcp", fmt.Sprintf("%v:%v", strconv.Itoa(port)), time.Second*10)
if err == nil {
isAlive = true
}
return isAlive
}