code: func (n *Node) LeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
  	cc, err := n.getLeaderConn()
  	if err == nil {
  		return cc, nil
  	}
  	if err == raftselector.ErrIsLeader {
  		return nil, err
  	}
  	if atomic.LoadUint32(&n.ticksWithNoLeader) > lostQuorumTimeout {
  		return nil, errLostQuorum
  	}
  
  	ticker := time.NewTicker(1 * time.Second)
  	defer ticker.Stop()
  	for {
  		select {
  		case <-ticker.C:
  			cc, err := n.getLeaderConn()
  			if err == nil {
  				return cc, nil
  			}
  			if err == raftselector.ErrIsLeader {
  				return nil, err
  			}
  		case <-ctx.Done():
  			return nil, ctx.Err()
  		}
  	}
  }
docs: // LeaderConn returns current connection to cluster leader or raftselector.ErrIsLeader
  // if current machine is leader.