コード例 #1
0
func scopedHandler(scope string, proxy http.Handler) (http.Handler, error) {
	if scope == "" {
		return proxy, nil
	}
	mux := route.NewMux()
	mux.SetNotFound(&DefaultNotFound{})
	if err := mux.Handle(scope, proxy); err != nil {
		return nil, err
	}
	return mux, nil
}
コード例 #2
0
func setDefaults(o Options) Options {
	if o.MetricsClient == nil {
		o.MetricsClient = metrics.NewNop()
	}
	if o.TimeProvider == nil {
		o.TimeProvider = &timetools.RealTime{}
	}
	if o.Router == nil {
		o.Router = route.NewMux()
	}
	return o
}
コード例 #3
0
func NewRegistry() *Registry {
	return &Registry{
		specs:  []*MiddlewareSpec{},
		router: route.NewMux(),
	}
}