示例#1
0
文件: servers.go 项目: 1zb/go-steam
// 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
文件: servers.go 项目: 1zb/go-steam
// 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
}