internal/cluster/cluster.go
func New(opts Opts) (csr *Cluster, err error) {
	var (
		nodes  []string
		exists bool
	)
	for _, seed := range opts.Seeds {
		if seed == opts.Listen {
			exists = true
		}
	}
	if !exists {
		nodes = append(nodes, opts.Listen)
	}

	nodes = append(nodes, opts.Seeds...)
	sort.Strings(nodes)

	csr = &Cluster{
		nodes:  make([]*Node, 0),
		listen: opts.Listen,
		logger: opts.Logger,
	}

	for i, addr := range nodes {
		if addr == "" {
			continue
		}
		csr.buckets++
		csr.nodes = append(csr.nodes, &Node{
			ID:   i,
			Addr: addr,
		})
	}
	return csr, nil
}
func New(opts Opts) (csr *Cluster, err error) {
	var (
		nodes  []string
		exists bool
	)
	for _, seed := range opts.Seeds {
		if seed == opts.Listen {
			exists = true
		}
	}
	if !exists {
		nodes = append(nodes, opts.Listen)
	}

	nodes = append(nodes, opts.Seeds...)
	sort.Strings(nodes)

	csr = &Cluster{
		nodes:  make([]*Node, 0),
		listen: opts.Listen,
		logger: opts.Logger,
	}

	for i, addr := range nodes {
		if addr == "" {
			continue
		}
		csr.buckets++
		csr.nodes = append(csr.nodes, &Node{
			ID:   i,
			Addr: addr,
		})
	}
	return csr, nil
}
// New ...