server.go
func NewServerList(servers ...string) (*ServerList, error) {
	addrs := make([]*Addr, len(servers))
	for i, server := range servers {
		if strings.Contains(server, "/") {
			addr, err := net.ResolveUnixAddr("unix", server)
			if err != nil {
				return nil, err
			}
			addrs[i] = NewAddr(addr)
		} else {
			tcpaddr, err := net.ResolveTCPAddr("tcp", server)
			if err != nil {
				return nil, err
			}
			addrs[i] = NewAddr(tcpaddr)
		}
	}
	return &ServerList{addrs: addrs}, nil
}
func NewServerList(servers ...string) (*ServerList, error) {
	addrs := make([]*Addr, len(servers))
	for i, server := range servers {
		if strings.Contains(server, "/") {
			addr, err := net.ResolveUnixAddr("unix", server)
			if err != nil {
				return nil, err
			}
			addrs[i] = NewAddr(addr)
		} else {
			tcpaddr, err := net.ResolveTCPAddr("tcp", server)
			if err != nil {
				return nil, err
			}
			addrs[i] = NewAddr(tcpaddr)
		}
	}
	return &ServerList{addrs: addrs}, nil
}
func NewServerList ( servers ... string ) ( * ServerList , error ) { addrs := make ( [ ] * Addr , len ( servers ) ) for i , server := range servers { if strings . Contains ( server , " " ) { addr , err := net . ResolveUnixAddr ( " " , server ) if err != nil { return nil , err } addrs [ i ] = NewAddr ( addr ) } else { tcpaddr , err := net . ResolveTCPAddr ( " " , server ) if err != nil { return nil , err } addrs [ i ] = NewAddr ( tcpaddr ) } } return & ServerList { addrs : addrs } , nil }
// NewServerList returns a new ServerList with the given servers.
// All servers have the same weight. To give a server more weight,
// list it multiple times.
//
// NewServerList returns an error if any of the received addresses
// is not valid or fails to resolve, but it doesn't try to connect
// to the provided servers.
NewServerList returns a new ServerList with the given servers . All servers have the same weight . To give a server more weight list it multiple times . NewServerList returns an error if any of the received addresses is not valid or fails to resolve but it doesn t try to connect to the provided servers .