//NewEmailServer - Create an email server
516990
func NewEmailServer(host string, port int, auth smtp.Auth, sendMailFunc SendMailFunc) *EmailServer {
	return &EmailServer{
		host:         host,
		port:         port,
		auth:         auth,
		sendMailFunc: sendMailFunc,
	}
}
894315
func New(server string) *Account {
	return &Account{
		server: server,
		auth:   auth.Public,
		ctx: wrap.Wrap(&apex.Logger{
			Handler: cli.New(os.Stdout),
		}),
		headers: map[string]string{},
	}
}
1052378
func NewServer(r io.Reader, w io.Writer) *Server {
	return &Server{
		r:       NewReader(r),
		w:       NewWriter(w),
		running: atomic.NewBool(false),
	}
}
975634
func NewRemoteServer(spec ServerSpec) (*Server, error) {
	if err := spec.Validate(); err != nil {
		return nil, errors.Trace(err)
	}

	// Skip the get, because we know that we're going to request it
	// when calling new server, preventing the double request.
	spec.connectionArgs.SkipGetServer = true
	cSvr, err := ConnectRemote(spec)
	if err != nil {
		return nil, errors.Trace(err)
	}
	svr, err := NewServer(cSvr)
	return svr, err
}
628137
func NewClient(server ...string) (*Client, error) {
	ss := new(ServerList)
	if len(server) == 0 {
		server = []string{"localhost:6379"}
	}
	if err := ss.SetServers(server...); err != nil {
		return nil, err
	}
	return NewFromSelector(ss), nil
}
136490
func (worker *Worker) AddServer(net, addr string) (err error) {
	// Create a new job server's client as a agent of server
	a, err := newAgent(net, addr, worker)
	if err != nil {
		return err
	}
	worker.agents = append(worker.agents, a)
	return
}
752356
func NewEventServer(address string, registerer registerer.Registerer) (*EventServer, error) {

	// Cleanup the socket first.
	if _, err := os.Stat(address); err == nil {
		if err := os.Remove(address); err != nil {
			return nil, fmt.Errorf("Cannot create clean up socket: %s", err)
		}
	}

	return &EventServer{
		socketPath: address,
		registerer: registerer,
	}, nil
}
655673
func NewServer(sessionMgr *session.SessionManager, settingsMgr *settings.SettingsManager) *Server {
	return &Server{
		sessionMgr:  sessionMgr,
		settingsMgr: settingsMgr,
	}

}
1308476
func NewServer(addr string, opts ...ServerOption) *Server {
	sopts := &serverOptions{}
	for _, opt := range opts {
		opt(sopts)
	}
	sopts.adjust()

	s := &Server{
		addr:        addr,
		sessionMaps: make(map[int]*sessionMap, sopts.sessionBucketSize),
		opts:        sopts,

		stopOnce: &sync.Once{},
		startCh:  make(chan struct{}, 1),
	}

	for i := 0; i < sopts.sessionBucketSize; i++ {
		s.sessionMaps[i] = &sessionMap{
			sessions: make(map[interface{}]IOSession),
		}
	}

	return s
}
39258
func NewEmailMessage(l level.Priority, e Email) Composer {
	m := MakeEmailMessage(e)
	_ = m.SetPriority(l)

	return m
}
1327720
func NewServer(cfg *ServerConfig) *Server {
	if cfg == nil {
		defaultCfg := DefaultServerConfig()
		cfg = &defaultCfg
	}
	return &Server{
		config: cfg,

		healthchecks: make(map[Id]*Check),
		notify:       make(chan *Notification, cfg.ChannelSize),
		configs:      make(chan map[Id]*Config),
		batch:        make([]*Notification, 0, cfg.BatchSize),

		quit: make(chan bool, 1),
	}
}
1089315
func New(address string) *server {
	log.Println("Creating server with address", address)
	server := &server{
		address: address,
		config:  nil,
	}

	server.OnNewClient(func(c *Client) {})
	server.OnNewMessage(func(c *Client, message string) {})
	server.OnClientConnectionClosed(func(c *Client, err error) {})

	return server
}
677030
func NewServer() *Server {
	return &Server{serviceMap: make(map[string]*service), contextType: reflect.TypeOf("")}
}
148407
func NewAdminServer(ace AccessControlEvaluator) *ServerAdmin {
	s := &ServerAdmin{
		v: &validator{
			ace: ace,
		},
		specAtStartup: flogging.Global.Spec(),
	}
	return s
}
522815
func (api *API) CloneServer(server_id string, new_name string, datacenter_id string) (*Server, error) {
	data := struct {
		Name         string `json:"name"`
		DatacenterId string `json:"datacenter_id,omitempty"`
	}{Name: new_name, DatacenterId: datacenter_id}
	result := new(Server)
	url := createUrl(api, serverPathSegment, server_id, "clone")
	err := api.Client.Post(url, &data, &result, http.StatusAccepted)
	if err != nil {
		return nil, err
	}
	result.api = api
	result.decodeRaws()
	return result, nil
}
1088363
func NewEmailChange(g *libkb.GlobalContext, a *keybase1.EmailChangeArg) *EmailChange {
	return &EmailChange{
		arg:          a,
		Contextified: libkb.NewContextified(g),
	}
}
1213349
func (c *Client) CreateServer(name string, regionID, planID, osID int, options *ServerOptions) (Server, error) {
	values := url.Values{
		"label":     {name},
		"DCID":      {fmt.Sprintf("%v", regionID)},
		"VPSPLANID": {fmt.Sprintf("%v", planID)},
		"OSID":      {fmt.Sprintf("%v", osID)},
	}

	if options != nil {
		if options.IPXEChainURL != "" {
			values.Add("ipxe_chain_url", options.IPXEChainURL)
		}

		if options.ISO != 0 {
			values.Add("ISOID", fmt.Sprintf("%v", options.ISO))
		}

		if options.Script != 0 {
			values.Add("SCRIPTID", fmt.Sprintf("%v", options.Script))
		}

		if options.UserData != "" {
			values.Add("userdata", base64.StdEncoding.EncodeToString([]byte(options.UserData)))
		}

		if options.Snapshot != "" {
			values.Add("SNAPSHOTID", options.Snapshot)
		}

		if options.SSHKey != "" {
			values.Add("SSHKEYID", options.SSHKey)
		}

		if options.ReservedIP != "" {
			values.Add("reserved_ip_v4", options.ReservedIP)
		}

		if options.Networks != nil && len(options.Networks) != 0 {
			for _, n := range options.Networks {
				values.Add("NETWORKID[]", n)
			}
		} else {
			values.Add("enable_private_network", "no")
			if options.PrivateNetworking {
				values.Set("enable_private_network", "yes")
			}
		}

		values.Add("enable_ipv6", "no")
		if options.IPV6 {
			values.Set("enable_ipv6", "yes")
		}

		values.Add("auto_backups", "no")
		if options.AutoBackups {
			values.Set("auto_backups", "yes")
		}

		values.Add("notify_activate", "yes")
		if options.DontNotifyOnActivate {
			values.Set("notify_activate", "no")
		}

		if options.Hostname != "" {
			values.Add("hostname", options.Hostname)
		}

		if options.Tag != "" {
			values.Add("tag", options.Tag)
		}

		if options.AppID != "" {
			values.Add("APPID", options.AppID)
		}

		if options.FirewallGroupID != "" {
			values.Add("FIREWALLGROUPID", options.FirewallGroupID)
		}
	}

	var server Server
	if err := c.post(`server/create`, values, &server); err != nil {
		return Server{}, err
	}
	server.Name = name
	server.RegionID = regionID
	server.PlanID = planID

	return server, nil
}