func NewEndpointWithConnector(
	hostId *hostid.HostID, appName string, connector sources.Connector) *Endpoint {
	return newEndpoint(hostId, appName, connector)
}
NewEndpointWithConnector creates a new endpoint for given host, port
and connector.
package scotty
import (
	"github.com/Symantec/scotty/hostid"
	"github.com/Symantec/scotty/metrics"
	"github.com/Symantec/scotty/sources"
	"sync"
	"time"
)
type Status int
const (
	FailedToConnect Status = -1 - iota
	FailedToPoll
)
const (
	Unknown Status = iota
	WaitingToConnect
	Connecting
	WaitingToPoll
	Polling
	Synced
)
func (s Status) String() string {
	switch s {
	case Unknown:
		return ""
	case WaitingToConnect:
		return "waiting to connect"
	case Connecting:
		return "connecting"
	case WaitingToPoll:
		return "waiting to poll"
	case Polling:
		return "polling"
	case Synced:
		return "synced"
	case FailedToConnect:
		return "failed to connect"
	case FailedToPoll:
		return "failed to poll"
	default:
		return ""
	}
}
type State struct {
	timestamp             time.Time
	sweepStartTime        time.Time
	waitToConnectDuration time.Duration
	connectDuration       time.Duration
	waitToPollDuration    time.Duration
	pollDuration          time.Duration
	connectorName         string
	status                Status
}
func (s *State) ConnectorName() string {
	return s.connectorName
}
func (s *State) Timestamp() time.Time {
	return s.timestamp
}
func (s *State) SweepStartTime() time.Time {
	return s.sweepStartTime
}
func (s *State) TimeSpentWaitingToConnect() time.Duration {
	return s.waitToConnectDuration
}
func (s *State) TimeSpentConnecting() time.Duration {
	return s.connectDuration
}
func (s *State) TimeSpentWaitingToPoll() time.Duration {
	return s.waitToPollDuration
}
func (s *State) TimeSpentPolling() time.Duration {
	return s.pollDuration
}
func (s *State) Status() Status {
	return s.status
}
type Logger interface {
	LogResponse(
		e *Endpoint, response metrics.List, timestamp time.Time) error
	LogError(e *Endpoint, err error, state *State)
	LogStateChange(e *Endpoint, oldState, newState *State)
}
type Endpoint struct {
	hostId         *hostid.HostID
	name           string
	conn           sources.ResourceConnector
	onePollAtATime chan bool
	state        *State
	errored      bool
	lock         sync.Mutex
	isTls        bool
	resourcePort uint
	resource     sources.Resource
}