func (s *Server) Members() (members []string) {
	peers := s.raftServer.Peers()
	for _, p := range peers {
		members = append(members, strings.TrimPrefix(p.ConnectionString, "http://"))
	}
	return
}
Members returns the current members.
package server
import (
	"bytes"
	"crypto/tls"
	"encoding/json"
	"errors"
	"fmt"
	"log"
	"math"
	"net"
	"net/http"
	"net/url"
	"os"
	"os/signal"
	"strings"
	"sync"
	"time"
	"github.com/goraft/raft"
	"github.com/gorilla/mux"
	"github.com/miekg/dns"
	"github.com/skynetservices/skydns1/msg"
	"github.com/skynetservices/skydns1/registry"
	"github.com/skynetservices/skydns1/stats"
)
const (
	raftElectionTimeout = 200 * time.Millisecond
)
func init() {
	raft.RegisterCommand(&AddServiceCommand{})
	raft.RegisterCommand(&UpdateTTLCommand{})
	raft.RegisterCommand(&RemoveServiceCommand{})
	raft.RegisterCommand(&AddCallbackCommand{})
}
type Server struct {
	members     []string  
	nameservers []string  
	domain       string
	domainLabels int
	dnsAddr      string
	httpAddr     string
	readTimeout  time.Duration
	writeTimeout time.Duration
	waiter       *sync.WaitGroup
	registry registry.Registry
	dnsUDPServer *dns.Server
	dnsTCPServer *dns.Server
	dnsHandler   *dns.ServeMux
	httpServer *http.Server
	router     *mux.Router
	raftServer raft.Server
	dataDir    string
	secret     string
	dnsKey  *dns.DNSKEY
	keyTag  uint16
	privKey dns.PrivateKey
	roundrobin bool
	tlskey string
	tlspem string
}
func NewServer(members []string, domain string, dnsAddr string, httpAddr string, dataDir string, rt, wt time.Duration, secret string, nameservers []string, roundrobin bool, tlskey string, tlspem string) (s *Server) {
	s = &Server{
		members:      members,
		domain:       strings.ToLower(domain),
		domainLabels: dns.CountLabel(dns.Fqdn(domain)),
		dnsAddr:      dnsAddr,
		httpAddr:     httpAddr,
		readTimeout:  rt,
		writeTimeout: wt,
		router:       mux.NewRouter(),
		registry:     registry.New(),
		dataDir:      dataDir,
		dnsHandler:   dns.NewServeMux(),
		waiter:       new(sync.WaitGroup),
		secret:       secret,
		nameservers:  nameservers,
		roundrobin:   roundrobin,
		tlskey:       tlskey,
		tlspem:       tlspem,
	}
	if _, err := os.Stat(s.dataDir); os.IsNotExist(err) {
		log.Fatal("Data directory does not exist: ", dataDir)
		return
	}
	s.dnsHandler.Handle(".", s)
	authWrapper := s.authHTTPWrapper
	s.router.HandleFunc("/skydns/services/{uuid}", authWrapper(s.addServiceHTTPHandler)).Methods("PUT")
	s.router.HandleFunc("/skydns/services/{uuid}", authWrapper(s.getServiceHTTPHandler)).Methods("GET")
	s.router.HandleFunc("/skydns/services/{uuid}", authWrapper(s.removeServiceHTTPHandler)).Methods("DELETE")
	s.router.HandleFunc("/skydns/services/{uuid}", authWrapper(s.updateServiceHTTPHandler)).Methods("PATCH")
	s.router.HandleFunc("/skydns/callbacks/{uuid}", authWrapper(s.addCallbackHTTPHandler)).Methods("PUT")
	s.router.HandleFunc("/skydns/services/", authWrapper(s.getServicesHTTPHandler)).Methods("GET")
	s.router.HandleFunc("/skydns/regions/", authWrapper(s.getRegionsHTTPHandler)).Methods("GET")
	s.router.HandleFunc("/skydns/environments/", authWrapper(s.getEnvironmentsHTTPHandler)).Methods("GET")
	s.router.HandleFunc("/raft/join", s.joinHandler).Methods("POST")
	return
}
func (s *Server) DNSAddr() string { return s.dnsAddr }
func (s *Server) HTTPAddr() string { return s.httpAddr }
func (s *Server) PublicKey() *dns.DNSKEY { return s.dnsKey }
func (s *Server) KeyTag() uint16 { return s.keyTag }
func (s *Server) PrivateKey() dns.PrivateKey { return s.privKey }
func (s *Server) Start() (*sync.WaitGroup, error) {
	var err error
	log.Printf("Initializing Server. DNS Addr: %q, HTTP Addr: %q, Data Dir: %q, Forwarders: %q", s.dnsAddr, s.httpAddr, s.dataDir, s.nameservers)
	transporter := raft.NewHTTPTransporter("/raft", raftElectionTimeout)
	s.raftServer, err = raft.NewServer(s.HTTPAddr(), s.dataDir, transporter, nil, s.registry, "")
	if err != nil {
		log.Fatal(err)
	}
	transporter.Install(s.raftServer, s)
	s.raftServer.Start()
	if len(s.members) > 0 {
		log.Println("Joining cluster:", strings.Join(s.members, ","))
		if !s.raftServer.IsLogEmpty() {
			log.Fatal("Cannot join with an existing log")
		}
		if err := s.Join(s.members); err != nil {
			return nil, err
		}
		log.Println("Joined cluster")
	} else if s.raftServer.IsLogEmpty() {
		log.Println("Initializing new cluster")
		_, err := s.raftServer.Do(&raft.DefaultJoinCommand{
			Name:             s.raftServer.Name(),
			ConnectionString: s.connectionString(),
		})
		if err != nil {
			log.Fatal(err)
			return nil, err
		}
	} else {
		log.Println("Recovered from log")
	}
	s.dnsTCPServer = &dns.Server{
		Addr:         s.DNSAddr(),
		Net:          "tcp",
		Handler:      s.dnsHandler,
		ReadTimeout:  s.readTimeout,
		WriteTimeout: s.writeTimeout,
	}
	s.dnsUDPServer = &dns.Server{
		Addr:         s.DNSAddr(),
		Net:          "udp",
		Handler:      s.dnsHandler,
		UDPSize:      65535,
		ReadTimeout:  s.readTimeout,
		WriteTimeout: s.writeTimeout,
	}
	s.httpServer = &http.Server{
		Addr:           s.HTTPAddr(),
		Handler:        s.router,
		ReadTimeout:    s.readTimeout,
		WriteTimeout:   s.writeTimeout,
		MaxHeaderBytes: 1 << 20,
	}
	go s.listenAndServe()
	s.waiter.Add(1)
	go s.run()
	return s.waiter, nil
}
func (s *Server) Stop() {
	log.Println("Stopping server")
	s.waiter.Done()
}
func (s *Server) Leader() string {
	l := s.raftServer.Leader()
	if l == "" {
		return s.raftServer.Name()
	}
	return l
}
func (s *Server) IsLeader() bool {
	return s.raftServer.State() == raft.Leader
}