// NewServer creates a new SSE server.
14007
func NewServer(options *Options) *Server {
	if options == nil {
		options = &Options{
			Logger: log.New(os.Stdout, "go-sse: ", log.LstdFlags),
		}
	}

	if options.Logger == nil {
		options.Logger = log.New(ioutil.Discard, "", log.LstdFlags)
	}

	s := &Server{
		options,
		make(map[string]*Channel),
		make(chan *Client),
		make(chan *Client),
		make(chan bool),
		make(chan string),
	}

	go s.dispatch()

	return s
}
308292
func NewServer() *Server {
	return &Server{
		codecs:   make(map[string]Codec),
		services: new(serviceMap),
	}
}
1320179
func NewServer(c Coser) http.Handler {
	ms := &server{
		Coser: c,
	}

	mux := http.NewServeMux()
	mux.HandleFunc("/cos-n", ms.handleCosNQuery)
	mux.HandleFunc("/cos", ms.handleCosQuery)
	mux.HandleFunc("/coses", ms.handleCosesQuery)

	ms.ServeMux = mux
	return ms
}
337016
func NewServer(kind string, apiDef *raml.APIDefinition, apiDocsDir, targetDir string,
	withMain bool, libRootURLs []string) generator.Server {
	switch kind {
	case "", serverKindFlask:
		return NewFlaskServer(apiDef, apiDocsDir, targetDir, withMain, libRootURLs, false)
	case serverKindGeventFlask:
		return NewFlaskServer(apiDef, apiDocsDir, targetDir, true, libRootURLs, true)
	case serverKindSanic:
		return NewSanicServer(apiDef, apiDocsDir, targetDir, withMain, libRootURLs)

	default:
		log.Fatalf("Invalid kind of python server : %v", kind)
		return nil
	}
}
1135139
func NewServer(addr string) (*Server, error) {
	if (Conf == Config{}) {
		InitConf("")
	}

	s := Server{neptulon: neptulon.NewServer(addr)}

	if err := s.SetDB(inmem.NewDB()); err != nil {
		return nil, err
	}
	if err := s.SetQueue(inmem.NewQueue(s.neptulon.SendRequest)); err != nil {
		return nil, err
	}

	s.neptulon.MiddlewareFunc(middleware.Logger)
	s.pubRouter = middleware.NewRouter()
	s.neptulon.Middleware(s.pubRouter)
	initPubRoutes(s.pubRouter, &s.db, Conf.App.JWTPass())

	//all communication below this point is authenticated
	s.neptulon.MiddlewareFunc(jwt.HMAC(Conf.App.JWTPass()))
	s.neptulon.Middleware(s.queue)
	s.privRouter = middleware.NewRouter()
	s.neptulon.Middleware(s.privRouter)
	initPrivRoutes(s.privRouter, &s.queue)
	// todo: r.Middleware(NotFoundHandler()) - 404-like handler, if any request reaches this point without being handled

	s.neptulon.DisconnHandler(func(c *neptulon.Conn) {
		// only handle this event for previously authenticated
		if id, ok := c.Session.GetOk("userid"); ok {
			s.queue.RemoveConn(id.(string))
		}
	})

	return &s, nil
}
1052378
func NewServer(r io.Reader, w io.Writer) *Server {
	return &Server{
		r:       NewReader(r),
		w:       NewWriter(w),
		running: atomic.NewBool(false),
	}
}
888291
func (c Configuration) NewServer(handler Handler, iOpts instrument.Options) Server {
	return NewServer(c.ListenAddress, handler, c.NewOptions(iOpts))
}
317256
func NewServer(
	host HostInterface,
	resourceAnalyzer stats.ResourceAnalyzer,
	auth AuthInterface,
	enableDebuggingHandlers,
	enableContentionProfiling,
	redirectContainerStreaming bool,
	criHandler http.Handler) Server {
	server := Server{
		host:                       host,
		resourceAnalyzer:           resourceAnalyzer,
		auth:                       auth,
		restfulCont:                &filteringContainer{Container: restful.NewContainer()},
		redirectContainerStreaming: redirectContainerStreaming,
	}
	if auth != nil {
		server.InstallAuthFilter()
	}
	server.InstallDefaultHandlers()
	if enableDebuggingHandlers {
		server.InstallDebuggingHandlers(criHandler)
		if enableContentionProfiling {
			goruntime.SetBlockProfileRate(1)
		}
	} else {
		server.InstallDebuggingDisabledHandlers()
	}
	return server
}
445311
func NewServer(handler http.Handler) *Server {
	ts := NewUnstartedServer(handler, "")
	ts.Start()
	return ts
}
901143
func NewServer(network *Network) *Server {
	s := &Server{
		router:  httprouter.New(),
		network: network,
	}

	s.OPTIONS("/", s.Options)
	s.GET("/", s.GetNetwork)
	s.POST("/start", s.StartNetwork)
	s.POST("/stop", s.StopNetwork)
	s.POST("/mocker/start", s.StartMocker)
	s.POST("/mocker/stop", s.StopMocker)
	s.GET("/mocker", s.GetMockers)
	s.POST("/reset", s.ResetNetwork)
	s.GET("/events", s.StreamNetworkEvents)
	s.GET("/snapshot", s.CreateSnapshot)
	s.POST("/snapshot", s.LoadSnapshot)
	s.POST("/nodes", s.CreateNode)
	s.GET("/nodes", s.GetNodes)
	s.GET("/nodes/:nodeid", s.GetNode)
	s.POST("/nodes/:nodeid/start", s.StartNode)
	s.POST("/nodes/:nodeid/stop", s.StopNode)
	s.POST("/nodes/:nodeid/conn/:peerid", s.ConnectNode)
	s.DELETE("/nodes/:nodeid/conn/:peerid", s.DisconnectNode)
	s.GET("/nodes/:nodeid/rpc", s.NodeRPC)

	return s
}
525696
func NewServer(ns string, kubeclientset kubernetes.Interface, appclientset appclientset.Interface, enf *rbac.Enforcer, projectLock *util.KeyLock, sessionMgr *session.SessionManager) *Server {
	auditLogger := argo.NewAuditLogger(ns, kubeclientset, "argocd-server")
	return &Server{enf: enf, appclientset: appclientset, kubeclientset: kubeclientset, ns: ns, projectLock: projectLock, auditLogger: auditLogger, sessionMgr: sessionMgr}
}
295024
func NewServer(c *Config) *socks.Server {
	return &socks.Server{
		Rules:  createRuleSet(c),
		Dialer: createDialer(c),
	}
}
1227627
func NewServer(store mailstore.Mailstore) *Server {
	s := &Server{
		Addr:       defaultAddress,
		mailstore:  store,
		Transcript: ioutil.Discard,
	}
	return s
}
1289869
func NewServer(readHandler func(filename string, rf io.ReaderFrom) error,
	writeHandler func(filename string, wt io.WriterTo) error) *Server {
	s := &Server{
		timeout:           defaultTimeout,
		retries:           defaultRetries,
		runGC:             make(chan []string),
		gcInterval:        1 * time.Minute,
		packetReadTimeout: 100 * time.Millisecond,
		readHandler:       readHandler,
		writeHandler:      writeHandler,
	}
	return s
}
213450
func NewServer(serverAddr, root string) *Server {
	return &Server{
		root: root,
		conn: Connect(serverAddr),
	}
}
1216876
func NewServer(cells ...string) *topo.Server {
	server, _ := NewServerAndFactory(cells...)
	return server
}
589831
func NewServer(hostname string, recorder record.EventRecorder, listener Listener, httpServerFactory HTTPServerFactory) Server {
	if listener == nil {
		listener = stdNetListener{}
	}
	if httpServerFactory == nil {
		httpServerFactory = stdHTTPServerFactory{}
	}
	return &server{
		hostname:    hostname,
		recorder:    recorder,
		listener:    listener,
		httpFactory: httpServerFactory,
		services:    map[types.NamespacedName]*hcInstance{},
	}
}