Пример #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])))])
	if addr == nil {
		panic("invalid address in CMServers slice")
	}
	return addr
}
Пример #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(CMServers[0][rng.Int31n(int32(len(CMServers[0])))])
	if addr == nil {
		panic("invalid address in CMServers slice")
	}
	return addr
}