agent_server

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AGENT_SESSION_GC_INTERVAL = 5 * time.Second
	AGENT_SESSION_TIMEOUT     = 5 * time.Second
	AGENT_SCHEDULE_INTERVAL   = 1 * time.Minute
)
View Source
const (
	AGENT_SESSION_LOG_HISTORY = 1000 // Number of lines of log history to keep
)

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(listen string, tlsConfig *tls.Config)

func RemoveSession

func RemoveSession(spaceId string)

removeSession removes a session associated with the given spaceId. It locks the sessionMutex to ensure thread safety, checks if a session exists for the provided spaceId, and if so, closes the MuxSession if it is not nil. Finally, it deletes the session from the sessions map and unlocks the sessionMutex.

Parameters:

  • spaceId: The identifier for the space whose session is to be removed.

Types

type Session

type Session struct {
	Id               string
	Version          string
	HasCodeServer    bool
	SSHPort          int
	VNCHttpPort      int
	HasTerminal      bool
	TcpPorts         map[string]string
	HttpPorts        map[string]string
	HasVSCodeTunnel  bool
	VSCodeTunnelName string
	AgentIp          string
	ExpiresAfter     time.Time
	MuxSession       *yamux.Session

	// The log history
	LogHistoryMutex *sync.RWMutex
	LogHistory      []*msg.LogMessage

	// The list of listeners for log messages
	LogListenersMutex *sync.RWMutex
	LogListeners      map[string]chan *msg.LogMessage
}

Struct holding the state / registration information of an agent

func GetSession

func GetSession(spaceId string) *Session

GetSession retrieves the agent session associated with the given spaceId. If an agent session is found for the provided spaceId, it returns the session; otherwise, it returns nil.

func NewSession

func NewSession(spaceId string, version string) *Session

creates a new agent session

func (*Session) Ping

func (s *Session) Ping() bool

func (*Session) RegisterLogListener added in v0.11.5

func (s *Session) RegisterLogListener() (string, chan *msg.LogMessage)

func (*Session) SendUpdateAuthorizedKeys

func (s *Session) SendUpdateAuthorizedKeys(sshKey string, githubUsername string) error

func (*Session) SendUpdateShell added in v0.11.5

func (s *Session) SendUpdateShell(shell string) error

func (*Session) UnregisterLogListener added in v0.11.5

func (s *Session) UnregisterLogListener(listenerId string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL