Documentation ¶
Index ¶
- type SessionState
- type State
- func (s *State) AddAgent(agent *rpc.AgentInfo, now time.Time) string
- func (s *State) AddClient(client *rpc.ClientInfo, now time.Time) string
- func (s *State) AddIntercept(sessionID, apiKey string, spec *rpc.InterceptSpec) (*rpc.InterceptInfo, error)
- func (s *State) AgentTunnel(ctx context.Context, clientSessionInfo *rpc.SessionInfo, ...) error
- func (s *State) AgentsLookup(ctx context.Context, clientSessionID string, request *rpc.LookupHostRequest) (iputil.IPs, error)
- func (s *State) ClientTunnel(ctx context.Context, tunnel connpool.Tunnel) error
- func (s *State) ExpireSessions(moment time.Time)
- func (s *State) GetAgent(sessionID string) *rpc.AgentInfo
- func (s *State) GetAgentsByName(name, namespace string) map[string]*rpc.AgentInfo
- func (s *State) GetAllAgents() map[string]*rpc.AgentInfo
- func (s *State) GetAllClients() map[string]*rpc.ClientInfo
- func (s *State) GetClient(sessionID string) *rpc.ClientInfo
- func (s *State) GetIntercept(interceptID string) *rpc.InterceptInfo
- func (s *State) GetInterceptAPIKey() string
- func (s *State) InitialTempLogLevel() *rpc.LogLevelRequest
- func (s *State) MarkSession(req *rpc.RemainRequest, now time.Time) (ok bool)
- func (s *State) PostLookupResponse(response *rpc.LookupHostAgentResponse)
- func (s *State) RemoveIntercept(interceptID string) bool
- func (s *State) RemoveInterceptAPIKey(interceptID string) bool
- func (s *State) RemoveSession(sessionID string)
- func (s *State) SessionDone(id string) <-chan struct{}
- func (s *State) SetTempLogLevel(ctx context.Context, logLevelRequest *rpc.LogLevelRequest)
- func (s *State) UpdateIntercept(interceptID string, apply func(*rpc.InterceptInfo)) *rpc.InterceptInfo
- func (s *State) WaitForTempLogLevel() *rpc.LogLevelRequest
- func (s *State) WatchAgents(ctx context.Context, filter func(sessionID string, agent *rpc.AgentInfo) bool) <-chan watchable.AgentMapSnapshot
- func (s *State) WatchClients(ctx context.Context, ...) <-chan watchable.ClientMapSnapshot
- func (s *State) WatchIntercepts(ctx context.Context, ...) <-chan watchable.InterceptMapSnapshot
- func (s *State) WatchLookupHost(agentSessionID string) <-chan *rpc.LookupHostRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionState ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the total state of the Traffic Manager. A zero State is invalid; you must call NewState.
func (*State) AddIntercept ¶
func (s *State) AddIntercept(sessionID, apiKey string, spec *rpc.InterceptSpec) (*rpc.InterceptInfo, error)
func (*State) AgentTunnel ¶ added in v2.3.2
func (*State) AgentsLookup ¶ added in v2.3.0
func (s *State) AgentsLookup(ctx context.Context, clientSessionID string, request *rpc.LookupHostRequest) (iputil.IPs, error)
AgentsLookup will send the given request to all agents currently intercepted by the client identified with the clientSessionID, it will then wait for results to arrive, collect those results, and return them as a unique and sorted slice.
func (*State) ClientTunnel ¶ added in v2.3.2
func (*State) ExpireSessions ¶
ExpireSessions prunes any sessions that haven't had a MarkSession heartbeat since the given 'moment'.
func (*State) GetAgentsByName ¶
func (*State) GetAllClients ¶
func (s *State) GetAllClients() map[string]*rpc.ClientInfo
func (*State) GetIntercept ¶
func (s *State) GetIntercept(interceptID string) *rpc.InterceptInfo
func (*State) GetInterceptAPIKey ¶ added in v2.3.1
GetInterceptAPIKey returns the first non-empty apiKey associated with an intercept IDs. We use this fuction as a last resort if we need to garbage collect intercepts when there are no active sessions.
func (*State) InitialTempLogLevel ¶ added in v2.4.2
func (s *State) InitialTempLogLevel() *rpc.LogLevelRequest
InitialTempLogLevel returns the temporary log-level if it exists, along with the remaining duration for it, which might be zero, in which case the log-level is valid until a new level is requested.
func (*State) MarkSession ¶
MarkSession marks a session as being present at the indicated time. Returns true if everything goes OK, returns false if the given session ID does not exist.
func (*State) PostLookupResponse ¶ added in v2.3.0
func (s *State) PostLookupResponse(response *rpc.LookupHostAgentResponse)
PostLookupResponse receives lookup responses from an agent and places them in the channel that corresponds to the lookup request
func (*State) RemoveIntercept ¶
func (*State) RemoveInterceptAPIKey ¶ added in v2.3.1
RemoveInterceptAPIKey removes the associated APIKey for an Intercept ID Only call on an intercept that has been deleted.
func (*State) RemoveSession ¶
RemoveSession removes a session from the set of present session IDs.
func (*State) SessionDone ¶
SessionDone returns a channel that is closed when the session with the given ID terminates. If there is no such currently-live session, then an already-closed channel is returned.
func (*State) SetTempLogLevel ¶ added in v2.4.2
func (s *State) SetTempLogLevel(ctx context.Context, logLevelRequest *rpc.LogLevelRequest)
SetTempLogLevel sets the temporary log-level for the traffic-manager and all agents and, if a duration is given, it also starts a timer that will reset the log-level once it fires.
func (*State) UpdateIntercept ¶
func (s *State) UpdateIntercept(interceptID string, apply func(*rpc.InterceptInfo)) *rpc.InterceptInfo
UpdateIntercept applies a given mutator function to the stored intercept with interceptID; storing and returning the result. If the given intercept does not exist, then the mutator function is not run, and nil is returned.
This does not lock; but instead uses CAS and may therefore call the mutator function multiple times. So: it is safe to perform blocking operations in your mutator function, but you must take care that it is safe to call your mutator function multiple times.
func (*State) WaitForTempLogLevel ¶ added in v2.4.2
func (s *State) WaitForTempLogLevel() *rpc.LogLevelRequest
WaitForTempLogLevel waits for a new temporary log-level request. It returns the values of the last request that was made.
func (*State) WatchAgents ¶
func (*State) WatchClients ¶
func (s *State) WatchClients( ctx context.Context, filter func(sessionID string, client *rpc.ClientInfo) bool, ) <-chan watchable.ClientMapSnapshot
func (*State) WatchIntercepts ¶
func (s *State) WatchIntercepts( ctx context.Context, filter func(sessionID string, intercept *rpc.InterceptInfo) bool, ) <-chan watchable.InterceptMapSnapshot
func (*State) WatchLookupHost ¶ added in v2.3.0
func (s *State) WatchLookupHost(agentSessionID string) <-chan *rpc.LookupHostRequest