func New(addr utils.NetAddr,
	hostname string,
	signers []ssh.Signer,
	authService auth.AccessPoint,
	dataDir string,
	advertiseIP net.IP,
	options ...ServerOption) (*Server, error) {

	// read the host UUID:
	uuid, err := utils.ReadOrMakeHostUUID(dataDir)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	s := &Server{
		addr:        addr,
		authService: authService,
		hostname:    hostname,
		labelsMutex: &sync.Mutex{},
		advertiseIP: advertiseIP,
		uuid:        uuid,
		closer:      utils.NewCloseBroadcaster(),
	}
	s.limiter, err = limiter.NewLimiter(limiter.LimiterConfig{})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	s.certChecker = ssh.CertChecker{IsAuthority: s.isAuthority}

	for _, o := range options {
		if err := o(s); err != nil {
			return nil, trace.Wrap(err)
		}
	}

	var component string
	if s.proxyMode {
		component = teleport.ComponentProxy
	} else {
		component = teleport.ComponentNode
	}

	s.reg = newSessionRegistry(s)
	srv, err := sshutils.NewServer(
		component,
		addr, s, signers,
		sshutils.AuthMethods{PublicKey: s.keyAuth},
		sshutils.SetLimiter(s.limiter),
		sshutils.SetRequestHandler(s))
	if err != nil {
		return nil, trace.Wrap(err)
	}
	s.srv = srv
	return s, nil
}
// New returns an unstarted server
New returns an unstarted server
// New returns an unstarted server
func New(addr utils.NetAddr,
	hostname string,
	signers []ssh.Signer,
	authService auth.AccessPoint,
	dataDir string,
	advertiseIP net.IP,
	options ...ServerOption) (*Server, error) {
	uuid, err := utils.ReadOrMakeHostUUID(dataDir)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	s := &Server{
		addr:        addr,
		authService: authService,
		hostname:    hostname,
		labelsMutex: &sync.Mutex{},
		advertiseIP: advertiseIP,
		uuid:        uuid,
		closer:      utils.NewCloseBroadcaster(),
	}
	s.limiter, err = limiter.NewLimiter(limiter.LimiterConfig{})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	s.certChecker = ssh.CertChecker{IsAuthority: s.isAuthority}
	for _, o := range options {
		if err := o(s); err != nil {
			return nil, trace.Wrap(err)
		}
	}
	var component string
	if s.proxyMode {
		component = teleport.ComponentProxy
	} else {
		component = teleport.ComponentNode
	}
	s.reg = newSessionRegistry(s)
	srv, err := sshutils.NewServer(
		component,
		addr, s, signers,
		sshutils.AuthMethods{PublicKey: s.keyAuth},
		sshutils.SetLimiter(s.limiter),
		sshutils.SetRequestHandler(s))
	if err != nil {
		return nil, trace.Wrap(err)
	}
	s.srv = srv
	return s, nil
}
func New ( addr utils . NetAddr , hostname string , signers [ ] ssh . Signer , authService auth . AccessPoint , dataDir string , advertiseIP net . IP , options ... ServerOption ) ( * Server , error ) { uuid , err := utils . ReadOrMakeHostUUID ( dataDir ) if err != nil { return nil , trace . Wrap ( err ) } s := & Server { addr : addr , authService : authService , hostname : hostname , labelsMutex : & sync . Mutex { } , advertiseIP : advertiseIP , uuid : uuid , closer : utils . NewCloseBroadcaster ( ) , } s . limiter , err = limiter . NewLimiter ( limiter . LimiterConfig { } ) if err != nil { return nil , trace . Wrap ( err ) } s . certChecker = ssh . CertChecker { IsAuthority : s . isAuthority } for _ , o := range options { if err := o ( s ) ; err != nil { return nil , trace . Wrap ( err ) } } var component string if s . proxyMode { component = teleport . ComponentProxy } else { component = teleport . ComponentNode } s . reg = newSessionRegistry ( s ) srv , err := sshutils . NewServer ( component , addr , s , signers , sshutils . AuthMethods { PublicKey : s . keyAuth } , sshutils . SetLimiter ( s . limiter ) , sshutils . SetRequestHandler ( s ) ) if err != nil { return nil , trace . Wrap ( err ) } s . srv = srv return s , nil }
New returns an unstarted server
New returns an unstarted server
// read the host UUID: