func (r *Registrar) Register() {
	r.Lock()
	defer r.Unlock()
	if r.quitc != nil {
		return  
	}
	if err := r.conn.RegisterInstance(r.instance); err != nil {
		r.logger.Log("during", "Register", "err", err)
	}
	r.quitc = make(chan chan struct{})
	go r.loop()
}
Register implements sd.Registrar.
package eureka
import (
	"fmt"
	"net/http"
	"sync"
	"time"
	"github.com/hudl/fargo"
	"github.com/go-kit/kit/log"
	"github.com/go-kit/kit/sd"
)
const defaultRenewalInterval = 30 * time.Second
type fargoConnection interface {
	RegisterInstance(instance *fargo.Instance) error
	DeregisterInstance(instance *fargo.Instance) error
	ReregisterInstance(instance *fargo.Instance) error
	HeartBeatInstance(instance *fargo.Instance) error
	ScheduleAppUpdates(name string, await bool, done <-chan struct{}) <-chan fargo.AppUpdate
	GetApp(name string) (*fargo.Application, error)
}
type fargoUnsuccessfulHTTPResponse struct {
	statusCode    int
	messagePrefix string
}
func (u *fargoUnsuccessfulHTTPResponse) Error() string {
	return fmt.Sprintf("err=%s code=%d", u.messagePrefix, u.statusCode)
}
type Registrar struct {
	conn     fargoConnection
	instance *fargo.Instance
	logger   log.Logger
	quitc    chan chan struct{}
	sync.Mutex
}
var _ sd.Registrar = (*Registrar)(nil)
func NewRegistrar(conn fargoConnection, instance *fargo.Instance, logger log.Logger) *Registrar {
	return &Registrar{
		conn:     conn,
		instance: instance,
		logger:   log.With(logger, "service", instance.App, "address", fmt.Sprintf("%s:%d", instance.IPAddr, instance.Port)),
	}
}