Ejemplo n.º 1
0
// GetRandomSingaporeCM returns back a random server in singapore
func GetRandomSingaporeCM() *netutil.PortAddr {
	rng := rand.New(rand.NewSource(time.Now().UnixNano()))
	addr := netutil.ParsePortAddr(CMServers[2][rng.Int31n(int32(len(CMServers[2])-1))])
	if addr == nil {
		panic("invalid address in CMServers slice")
	}
	return addr
}
Ejemplo n.º 2
0
// GetRandomCM returns back a random server anywhere
func GetRandomCM() *netutil.PortAddr {
	rng := rand.New(rand.NewSource(time.Now().UnixNano()))
	servers := append(CMServers[0], CMServers[1]...)
	addr := netutil.ParsePortAddr(servers[rng.Int31n(int32(len(servers)-1))])
	if addr == nil {
		panic("invalid address in CMServers slice")
	}
	return addr
}