func (c *Spec) NewHandler(next http.Handler) (http.Handler, error) {
	return fromSpec(c, next)
}
NewMiddleware vulcan library compatible middleware
package cbreaker
import (
	"fmt"
	"net/http"
	"time"
	"github.com/urfave/cli"
	"github.com/vulcand/oxy/cbreaker"
	"github.com/vulcand/vulcand/plugin"
)
const Type = "cbreaker"
func GetSpec() *plugin.MiddlewareSpec {
	return &plugin.MiddlewareSpec{
		Type:      Type,
		FromOther: FromOther,
		FromCli:   FromCli,
		CliFlags:  CliFlags(),
	}
}
type Spec struct {
	Condition string
	Fallback interface{}
	OnTripped interface{}
	OnStandby interface{}
	FallbackDuration time.Duration
	RecoveryDuration time.Duration
	CheckPeriod time.Duration
}
func fromSpec(spec *Spec, next http.Handler) (*cbreaker.CircuitBreaker, error) {
	b, err := toBytes(spec.Fallback)
	if err != nil {
		return nil, err
	}
	fallback, err := actionFromJSON(b)
	if err != nil {
		return nil, err
	}
	var onTripped, onStandby cbreaker.SideEffect
	if spec.OnTripped != nil {
		b, err := toBytes(spec.OnTripped)
		if err != nil {
			return nil, err
		}
		if len(b) != 0 {
			v, err := sideEffectFromJSON(b)
			if err != nil {
				return nil, err
			}
			onTripped = v
		}
	}
	if spec.OnStandby != nil {
		b, err := toBytes(spec.OnStandby)
		if err != nil {
			return nil, err
		}
		if len(b) != 0 {
			v, err := sideEffectFromJSON(b)
			if err != nil {
				return nil, err
			}
			onStandby = v
		}
	}
	return cbreaker.New(next, spec.Condition,
		cbreaker.Fallback(fallback),
		cbreaker.FallbackDuration(spec.FallbackDuration),
		cbreaker.RecoveryDuration(spec.RecoveryDuration),
		cbreaker.OnTripped(onTripped),
		cbreaker.OnStandby(onStandby),
		cbreaker.CheckPeriod(spec.CheckPeriod))
}