// NewHandler creates a new join-sever handler.
487198
func NewHandler(config HandlerConfig) (http.Handler, error) {
	if config.GetDeviceKeysByDevEUIFunc == nil {
		return nil, errors.New("backend/joinserver: GetDeviceKeysFunc must not be nil")
	}

	h := handler{
		config: config,
		log:    config.Logger,
	}

	if h.log == nil {
		h.log = &log.Logger{
			Out: ioutil.Discard,
		}
	}

	if h.config.GetKEKByLabelFunc == nil {
		h.log.Warning("backend/joinserver: get kek by label function is not set")

		h.config.GetKEKByLabelFunc = func(label string) ([]byte, error) {
			return nil, nil
		}
	}

	if h.config.GetASKEKLabelByDevEUIFunc == nil {
		h.log.Warning("backend/joinserver: get application-server kek by deveui function is not set")

		h.config.GetASKEKLabelByDevEUIFunc = func(devEUI lorawan.EUI64) (string, error) {
			return "", nil
		}
	}

	return &h, nil
}
673697
func NewHandler() http.Handler {
	return api.HTTPHandler{Handler: new(Handler), Methods: []string{"POST"}}
}
148072
func NewEventHandler(handlerType string) *EventHandler {
	return &EventHandler{
		Type:    handlerType,
		Events:  []eh.Event{},
		Context: context.Background(),
		Recv:    make(chan eh.Event, 10),
	}
}
246415
func NewChannelHandler(channel LogPartsChannel) *ChannelHandler {
	handler := new(ChannelHandler)
	handler.SetChannel(channel)

	return handler
}
1032207
func NewHandler(plugin Plugin) *Handler {
	h := &Handler{plugin, sdk.NewHandler(manifest)}
	h.initMux()
	return h
}
910268
func NewHandler(expiration time.Duration) *Handler {
	return &Handler{
		rule:       DefaultRuleSet,
		expiration: expiration,
		entries:    make(map[string]*entry.Entry, 0),
	}
}
376722
func NewHandler(prefix string, output io.Writer) *Handler {
	return &Handler{
		Output:     output,
		Prefix:     prefix,
		TimeFormat: DefaultTimeFormat,
	}
}
850793
func (c *ConnLimit) NewHandler(next http.Handler) (http.Handler, error) {
	extract, err := utils.NewExtractor(c.Variable)
	if err != nil {
		return nil, err
	}
	return connlimit.New(next, extract, c.Connections)
}
397799
func NewHandler(w io.Writer) events.Handler {
	var term bool

	if w == nil {
		return nil
	}

	if f, ok := w.(interface {
		Fd() uintptr
	}); ok {
		term = events.IsTerminal(int(f.Fd()))
	}

	if term {
		return text.NewHandler("", w)
	}
	return ecslogs.NewHandler(w)
}
72968
func NewHandler(handler http.Handler) http.Handler {
	return NewHandlerWith(events.DefaultLogger, handler)
}
444720
func NewHandler(cfg Config) (*Handler, error) {
	if err := cfg.CheckAndSetDefaults(); err != nil {
		return nil, trace.Wrap(err)
	}

	h := &Handler{
		Entry: log.WithFields(log.Fields{
			trace.Component: teleport.Component(teleport.SchemeFile),
		}),
		Config: cfg,
	}
	return h, nil
}
405118
func NewHandler(driver Driver) *Handler {
	h := &Handler{driver, http.NewServeMux()}
	h.initMux()
	return h
}
61250
func NewHandlerWrapper(service micro.Service) server.HandlerWrapper {
	return func(h server.HandlerFunc) server.HandlerFunc {
		return func(ctx context.Context, req server.Request, rsp interface{}) error {
			ctx = micro.NewContext(ctx, service)
			return h(ctx, req, rsp)
		}
	}
}
481785
func NewHandler(params *HandlerParams) *Handler {
	fh := &Handler{
		cache: make(map[uint64]*cacheEntry),
	}

	for i := 0; i < hasherCount; i++ {
		hashfunc := storage.MakeHashFunc(feedsHashAlgorithm)()
		if fh.HashSize == 0 {
			fh.HashSize = hashfunc.Size()
		}
		hashPool.Put(hashfunc)
	}

	return fh
}
711978
func NewEventHandler(event string, fn interface{}) (events.ThrustEventHandler, error) {
	return events.NewHandler(event, fn)
}
635891
func NewWrapperHandler(delegate http.Handler, handlerEnv HandlerEnv) http.Handler {
	return newWrapperHandler(delegate, handlerEnv)
}
441255
func NewHandler(s signer.Signer) (http.Handler, error) {
	return &api.HTTPHandler{
		Handler: &Handler{
			sign: s,
		},
		Methods: []string{"POST"},
	}, nil
}