agent_server

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AGENT_SESSION_GC_INTERVAL = 5 * time.Second
	AGENT_SESSION_TIMEOUT     = 15 * time.Second
)

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            `msgpack:"space_id"`
	Version          string            `msgpack:"version"`
	HasCodeServer    bool              `msgpack:"has_code_server"`
	SSHPort          int               `msgpack:"ssh_port"`
	VNCHttpPort      int               `msgpack:"vnc_http_port"`
	HasTerminal      bool              `msgpack:"has_terminal"`
	TcpPorts         map[string]string `msgpack:"tcp_ports"`
	HttpPorts        map[string]string `msgpack:"http_ports"`
	HasVSCodeTunnel  bool              `msgpack:"has_vscode_tunnel"`
	VSCodeTunnelName string            `msgpack:"vscode_tunnel_name"`
	ExpiresAfter     time.Time         `msgpack:"-"`
	MuxSession       *yamux.Session    `msgpack:"-"`
}

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) SendUpdateAuthorizedKeys

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

Jump to

Keyboard shortcuts

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