func New(addr string, nodes []string, onLeader, onFollower ApplyFunc, l Logger, eMS, hMS int) (*Dinghy, error) {
	l.Println("addr:", addr, "nodes:", nodes)

	if onLeader == nil {
		onLeader = DefaultOnLeader
	}
	if onFollower == nil {
		onFollower = DefaultOnFollower
	}
	c := &http.Client{
		Timeout: time.Duration(hMS) * time.Millisecond,
	}

	id, err := hashToInt(addr, len(nodes)*1000)
	if err != nil {
		return nil, err
	}
	id++
	mu := &sync.Mutex{}
	mu.Lock()
	d := &Dinghy{
		client:      c,
		logger:      l,
		mu:          mu,
		routePrefix: DefaultRoutePrefix,
		stopChan:    make(chan struct{}),
		Addr:        addr,
		Nodes:       nodes,
		OnLeader:    onLeader,
		OnFollower:  onFollower,
		State:       NewState(id, eMS, hMS),
	}
	mu.Unlock()
	l.Printf("%+v", d)
	return d, nil
}
// New initializes a new dinghy. Start is required to be run to
// begin leader election.
New initializes a new dinghy. Start is required to be run to
begin leader election.
// New initializes a new dinghy . Start is required to be run to // begin leader election .
func New(addr string, nodes []string, onLeader, onFollower ApplyFunc, l Logger, eMS, hMS int) (*Dinghy, error) {
	l.Println("addr:", addr, "nodes:", nodes)
	if onLeader == nil {
		onLeader = DefaultOnLeader
	}
	if onFollower == nil {
		onFollower = DefaultOnFollower
	}
	c := &http.Client{
		Timeout: time.Duration(hMS) * time.Millisecond,
	}
	id, err := hashToInt(addr, len(nodes)*1000)
	if err != nil {
		return nil, err
	}
	id++
	mu := &sync.Mutex{}
	mu.Lock()
	d := &Dinghy{
		client:      c,
		logger:      l,
		mu:          mu,
		routePrefix: DefaultRoutePrefix,
		stopChan:    make(chan struct{}),
		Addr:        addr,
		Nodes:       nodes,
		OnLeader:    onLeader,
		OnFollower:  onFollower,
		State:       NewState(id, eMS, hMS),
	}
	mu.Unlock()
	l.Printf("%+v", d)
	return d, nil
}
func New ( addr string , nodes [ ] string , onLeader , onFollower ApplyFunc , l Logger , eMS , hMS int ) ( * Dinghy , error ) { l . Println ( " " , addr , " " , nodes ) if onLeader == nil { onLeader = DefaultOnLeader } if onFollower == nil { onFollower = DefaultOnFollower } c := & http . Client { Timeout : time . Duration ( hMS ) * time . Millisecond , } id , err := hashToInt ( addr , len ( nodes ) * 1000 ) if err != nil { return nil , err } id ++ mu := & sync . Mutex { } mu . Lock ( ) d := & Dinghy { client : c , logger : l , mu : mu , routePrefix : DefaultRoutePrefix , stopChan : make ( chan struct { } ) , Addr : addr , Nodes : nodes , OnLeader : onLeader , OnFollower : onFollower , State : NewState ( id , eMS , hMS ) , } mu . Unlock ( ) l . Printf ( " " , d ) return d , nil }
New initializes a new dinghy.
New initializes a new dinghy .