// NewService creates a new service. It parses all provided server strings to
// URLs, returning an error if one fails to parse.
NewService creates a new service. It parses all provided server strings to
URLs, returning an error if one fails to parse.
// NewService creates a new service . It parses all provided server strings to // URLs returning an error if one fails to parse .
func NewService(name string, serverURLs ...string) (*Service, error) {
	if name == "" {
		return nil, ErrServiceNameMissing
	}
	if len(serverURLs) < 1 {
		return nil, ErrServerURLsMissing
	}
	service := &Service{
		Name:    name,
		Servers: make([]*url.URL, len(serverURLs)),
	}
	for i, serverURL := range serverURLs {
		u, err := url.Parse(serverURL)
		if err != nil {
			return nil, err
		}
		service.Servers[i] = u
	}
	return service, nil
}
func NewService ( name string , serverURLs ... string ) ( * Service , error ) { if name == " " { return nil , ErrServiceNameMissing } if len ( serverURLs ) < 1 { return nil , ErrServerURLsMissing } service := & Service { Name : name , Servers : make ( [ ] * url . URL , len ( serverURLs ) ) , } for i , serverURL := range serverURLs { u , err := url . Parse ( serverURL ) if err != nil { return nil , err } service . Servers [ i ] = u } return service , nil }
NewService creates a new service.
NewService creates a new service .