func (s *MCSet) Endpoints() []string {
	return s.endpoints
}
Endpoints returns the current endpoints for this service.
This can be those set via the serverset.Watch or manually via SetEndpoints()
package mcset
import (
	"errors"
	"log"
	"net"
	"sort"
	"sync"
	"time"
	"github.com/golang/groupcache/consistenthash"
	"github.com/reusee/mmh3"
)
var (
	ErrNoServers = errors.New("mcset: no servers configured or available")
	DefaultLogger Logger = defaultLogger{}
)
type Logger interface {
	Printf(string, ...interface{})
}
type Watcher interface {
	Endpoints() []string
	Event() <-chan struct{}
	IsClosed() bool
}
type MCSet struct {
	Watcher
	LastEvent  time.Time
	EventCount int
	Logger Logger
	event chan struct{}
	consistent *consistenthash.Map
	lock      sync.Mutex
	endpoints []string
	addresses map[string]net.Addr
}
func New(watch Watcher) *MCSet {
	mcset := &MCSet{
		Watcher: watch,
		Logger:  DefaultLogger,
		event:   make(chan struct{}, 1),
	}
	if watch != nil {
		mcset.setEndpoints(watch.Endpoints())
		go func() {
			for {
				select {
				case <-watch.Event():
					mcset.SetEndpoints(watch.Endpoints())
				}
				if watch.IsClosed() {
					break
				}
			}
			watcherClosed()
		}()
	}
	return mcset
}
var watcherClosed = func() {}
func (s *MCSet) SetEndpoints(endpoints []string) {
	s.setEndpoints(endpoints)
	s.triggerEvent()
}
func (s *MCSet) setEndpoints(endpoints []string) {
	s.lock.Lock()
	defer s.lock.Unlock()
	addresses := make(map[string]net.Addr)
	for _, e := range endpoints {
		a, err := net.ResolveTCPAddr("tcp", e)
		if err != nil {
		}
		addresses[e] = a
	}
	s.addresses = addresses
	s.endpoints = endpoints
	sort.StringSlice(endpoints).Sort()
	s.Logger.Printf("new endpoints for mcset: %v", endpoints)
	s.consistent = consistenthash.New(150, mmh3.Sum32)
	s.consistent.Add(endpoints...)
}