// NewServer returns a Server object to manage the exported file system
556378
func NewServer(driver StorageDriver, host *host.Host, volumesPath string) (*Server, error) {
	if len(driver.ExportPath()) < 9 {
		return nil, fmt.Errorf("export path can not be empty")
	}

	s := &Server{
		host:   host,
		driver: driver,
	}

	return s, nil
}
295336
func NewServer(apiDef *raml.APIDefinition, packageName, apiDocsDir, rootImportPath string,
	withMain bool, targetDir string, libsRootURLs []string) *Server {
	// global variables
	rootImportPath = setRootImportPath(rootImportPath, targetDir)
	globAPIDef = apiDef
	globRootImportPath = rootImportPath
	globLibRootURLs = libsRootURLs

	return &Server{
		apiDef:         apiDef,
		PackageName:    packageName,
		apiDocsDir:     apiDocsDir,
		withMain:       withMain,
		RootImportPath: rootImportPath,
		TargetDir:      targetDir,
		libsRootURLs:   libsRootURLs,
	}
}
362442
func (s *Service) NewServer() *Server {
	s.RegisterSDK(Map)

	mux := s.ServeMux
	vim := Map.Path + "/vimService"
	s.sdk[vim] = s.sdk[vim25.Path]
	mux.HandleFunc(vim, s.ServeSDK)
	mux.HandleFunc(Map.Path+"/vimServiceVersions.xml", s.ServiceVersions)
	mux.HandleFunc(folderPrefix, s.ServeDatastore)
	mux.HandleFunc(nfcPrefix, ServeNFC)
	mux.HandleFunc("/about", s.About)

	ts := internal.NewUnstartedServer(mux, s.Listen)
	addr := ts.Listener.Addr().(*net.TCPAddr)
	port := strconv.Itoa(addr.Port)
	u := &url.URL{
		Scheme: "http",
		Host:   net.JoinHostPort(defaultIP(addr), port),
		Path:   Map.Path,
	}
	if s.TLS != nil {
		u.Scheme += "s"
	}

	// Redirect clients to this http server, rather than HostSystem.Name
	Map.SessionManager().ServiceHostName = u.Host

	// Add vcsim config to OptionManager for use by SDK handlers (see lookup/simulator for example)
	m := Map.OptionManager()
	m.Setting = append(m.Setting,
		&types.OptionValue{
			Key:   "vcsim.server.url",
			Value: u.String(),
		},
	)

	u.User = url.UserPassword("user", "pass")

	if s.TLS != nil {
		ts.TLS = s.TLS
		ts.TLS.ClientAuth = tls.RequestClientCert // Used by SessionManager.LoginExtensionByCertificate
		Map.SessionManager().TLSCert = func() string {
			return base64.StdEncoding.EncodeToString(ts.TLS.Certificates[0].Certificate[0])
		}
		ts.StartTLS()
	} else {
		ts.Start()
	}

	return &Server{
		Server: ts,
		URL:    u,
	}
}
846847
func NewServer(
	repoClientset reposerver.Clientset,
	db db.ArgoDB,
	enf *rbac.Enforcer,
	cache *cache.Cache,
) *Server {
	return &Server{
		db:            db,
		repoClientset: repoClientset,
		enf:           enf,
		cache:         cache,
	}
}
412298
func NewServer(apiDef *raml.APIDefinition, apiDocsDir string, targetDir string) *Server {
	resources := getServerResourcesDefs(apiDef)
	return &Server{
		apiDef:     apiDef,
		apiDocsDir: apiDocsDir,
		TargetDir:  targetDir,
		Resources:  resources,
	}
}
308292
func NewServer() *Server {
	return &Server{
		codecs:   make(map[string]Codec),
		services: new(serviceMap),
	}
}
1199113
func NewServer(cfg ServerConfig) (*Server, error) {
	if cfg.LogSinkConfig == nil {
		logSinkConfig := DefaultLogSinkConfig()
		cfg.LogSinkConfig = &logSinkConfig
	}
	if err := cfg.Validate(); err != nil {
		return nil, errors.Trace(err)
	}
	// Important note:
	// Do not manipulate the state within NewServer as the API
	// server needs to run before mongo upgrades have happened and
	// any state manipulation may be be relying on features of the
	// database added by upgrades. Here be dragons.
	return newServer(cfg)
}
873325
func NewServer(name string) *Server {
	server := &Server{
		Name: name,
		// Pre-create for 5 services per host
		Services:    make(map[string]*service.Service, 5),
		LastUpdated: time.Unix(0, 0),
		LastChanged: time.Unix(0, 0),
	}

	return server
}
1331704
func NewServer(bindHost string, bindPort int, syslogishServer *syslogish.Server) (*Server, error) {
	return &Server{
		bindHost: bindHost,
		bindPort: bindPort,
		handler:  &requestHandler{syslogishServer: syslogishServer},
	}, nil
}
318113
func NewServer(addrs map[string]string) (s *Server, err error) {
	s = &Server{
		Listeners: make(map[string]net.Listener),
		control:   make(SignalChan),
	}

	for label, addr := range addrs {
		var listener net.Listener
		listener, err = net.Listen("tcp", addr)
		if err != nil {
			s.closeListeners()
			s = nil
			return
		}
		s.Listeners[label] = listener
		addrs[label] = listener.Addr().String()
	}
	return
}
121246
func NewServer(h http.Handler, opts ...NewServerOpt) *http.Server {
	srv := &http.Server{Handler: h}

	// Prepend defaults to server options.
	opts = append([]NewServerOpt{ServerDefaults}, opts...)
	for _, opt := range opts {
		opt(srv)
	}

	return srv
}
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
}
843188
func NewServer(archiver pkgarchive.Archiver, opts ServerOptions) Server {
	return newServer(archiver, opts)
}
1216876
func NewServer(cells ...string) *topo.Server {
	server, _ := NewServerAndFactory(cells...)
	return server
}
1347469
func NewServer(store *store.MemoryStore, securityConfig *SecurityConfig) *Server {
	return &Server{
		store:                           store,
		securityConfig:                  securityConfig,
		localRootCA:                     securityConfig.RootCA(),
		externalCA:                      NewExternalCA(nil, nil),
		pending:                         make(map[string]*api.Node),
		started:                         make(chan struct{}),
		reconciliationRetryInterval:     defaultReconciliationRetryInterval,
		rootReconciliationRetryInterval: defaultRootReconciliationInterval,
		clusterID:                       securityConfig.ClientTLSCreds.Organization(),
	}
}
1020878
func NewServer(apiDef *raml.APIDefinition, apiDocsDir, dir string) *Server {
	return &Server{
		Title:      apiDef.Title,
		APIDef:     apiDef,
		apiDocsDir: apiDocsDir,
		Dir:        dir,
	}
}
533493
func NewServer(logger *log.Logger, port int) (*Server, error) {
	if logger == nil {
		logger = log.New(os.Stdout, "", log.Flags())
	}
	s := &Server{
		Logger:   logger,
		Port:     port,
		Peers:    make(map[string]*Conn),
		handlers: make(map[string]protocolHandler),
	}

	s.listeningWG.Add(1)

	s.IP = getHost()

	s.listener = &httpListener{
		accept: make(chan *httpConn, 10),
	}

	s.initHTTPRouting()

	// Handlers
	s.Handle("Handshake", s.handleHandshake)
	s.Handle("PeerRequest", s.handlePeerRequest)
	s.Handle("PeerNotify", s.handlePeerNotify)

	return s, nil
}