func getHost(addr string) string {
	bracket := strings.LastIndexByte(addr, ']')
	if bracket > 0 {
		return addr[:bracket+1]
	}
	colon := strings.LastIndexByte(addr, ':')
	if colon < 0 {
		return addr
	}
	return addr[:colon]
}
host:port => host
package main
import (
	"log"
	"net"
	"strings"
	"time"
	"github.com/udhos/disbalance/rule"
)
type checker struct {
	done chan struct{}
}
func getPort(addr string) string {
	bracket := strings.LastIndexByte(addr, ']')
	addr = addr[bracket+1:]
	colon := strings.LastIndexByte(addr, ':')
	if colon < 0 {
		return ""
	}
	port := addr[colon:]
	if port == ":" {
		return ""
	}
	return port
}