func newCluster(client *httpClient, marathonURL string, isDCOS bool) (*cluster, error) {
	var members []*member
	var defaultProto string
	for _, endpoint := range strings.Split(marathonURL, ",") {
		if endpoint == "" {
			return nil, newInvalidEndpointError("endpoint is blank")
		}
		if !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") {
			if defaultProto == "" {
				return nil, newInvalidEndpointError("missing scheme on (first) endpoint")
			}
			endpoint = fmt.Sprintf("%s://%s", defaultProto, endpoint)
		}
		u, err := url.Parse(endpoint)
		if err != nil {
			return nil, newInvalidEndpointError("invalid endpoint '%s': %s", endpoint, err)
		}
		if defaultProto == "" {
			defaultProto = u.Scheme
		}
		if u.Host == "" {
			return nil, newInvalidEndpointError("endpoint: %s must have a host", endpoint)
		}
		if isDCOS && strings.TrimLeft(u.Path, "/") == "" {
			u.Path = defaultDCOSPath
		}
		members = append(members, &member{endpoint: u.String()})
	}
	return &cluster{
		client:  client,
		members: members,
	}, nil
}
newCluster returns a new marathon cluster
package marathon
import (
	"fmt"
	"net/url"
	"strings"
	"sync"
	"time"
)
const (
	memberStatusUp   = 0
	memberStatusDown = 1
)
type memberStatus int
type cluster struct {
	sync.RWMutex
	members []*member
	client *httpClient
}
type member struct {
	endpoint string
	status memberStatus
}