server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package server implements the Waymon server with privilege separation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientManager

type ClientManager struct {
	// contains filtered or unexported fields
}

ClientManager manages connected clients and input routing

func NewClientManager

func NewClientManager(inputBackend input.InputBackend) (*ClientManager, error)

NewClientManager creates a new client manager for the server

func (*ClientManager) GetActiveClient

func (cm *ClientManager) GetActiveClient() *ConnectedClient

GetActiveClient returns the currently controlled client

func (*ClientManager) GetConnectedClients

func (cm *ClientManager) GetConnectedClients() []*ConnectedClient

GetConnectedClients returns a list of connected clients

func (*ClientManager) HandleInputEvent

func (cm *ClientManager) HandleInputEvent(event *protocol.InputEvent)

HandleInputEvent processes input events and routes them to the appropriate target

func (*ClientManager) HandleStatusQuery

func (cm *ClientManager) HandleStatusQuery(query *pb.StatusQuery) (*pb.IPCMessage, error)

HandleStatusQuery implements ipc.MessageHandler

func (*ClientManager) HandleSwitchCommand

func (cm *ClientManager) HandleSwitchCommand(cmd *pb.SwitchCommand) (*pb.IPCMessage, error)

HandleSwitchCommand implements ipc.MessageHandler

func (*ClientManager) IsControllingLocal

func (cm *ClientManager) IsControllingLocal() bool

IsControllingLocal returns whether the server is controlling the local system

func (*ClientManager) MarkEmergencyRelease

func (cm *ClientManager) MarkEmergencyRelease()

MarkEmergencyRelease marks that an emergency release has occurred

func (*ClientManager) NotifyShutdown

func (cm *ClientManager) NotifyShutdown()

NotifyShutdown sends shutdown notification to all connected clients

func (*ClientManager) RegisterClient

func (cm *ClientManager) RegisterClient(id, name, address string)

RegisterClient registers a new client connection

func (*ClientManager) SetOnActivity

func (cm *ClientManager) SetOnActivity(callback func(level, message string))

SetOnActivity sets a callback for activity notifications

func (*ClientManager) SetSSHServer

func (cm *ClientManager) SetSSHServer(sshServer *network.SSHServer)

SetSSHServer sets the SSH server for sending events to clients

func (*ClientManager) Start

func (cm *ClientManager) Start(ctx context.Context, port int) error

Start starts the client manager SSH server

func (*ClientManager) Stop

func (cm *ClientManager) Stop() error

Stop stops the client manager

func (*ClientManager) SwitchToClient

func (cm *ClientManager) SwitchToClient(clientID string) error

SwitchToClient switches input control to the specified client

func (*ClientManager) SwitchToLocal

func (cm *ClientManager) SwitchToLocal() error

SwitchToLocal switches input control back to the local system

func (*ClientManager) SwitchToNextClient

func (cm *ClientManager) SwitchToNextClient() error

SwitchToNextClient switches to the next available client

func (*ClientManager) UnregisterClient

func (cm *ClientManager) UnregisterClient(id string)

UnregisterClient removes a client connection

type ConnectedClient

type ConnectedClient struct {
	ID          string
	Name        string
	Address     string
	Status      protocol.ClientStatus
	ConnectedAt time.Time

	// Client configuration received on connect
	Monitors     []*protocol.Monitor
	Capabilities *protocol.ClientCapabilities
}

ConnectedClient represents a client that can receive input

type EmergencyRelease

type EmergencyRelease struct {
	// contains filtered or unexported fields
}

EmergencyRelease provides multiple mechanisms for emergency control release

func NewEmergencyRelease

func NewEmergencyRelease(manager *ClientManager) *EmergencyRelease

NewEmergencyRelease creates a new emergency release handler

func (*EmergencyRelease) Start

func (er *EmergencyRelease) Start()

Start begins monitoring for emergency release conditions

func (*EmergencyRelease) Stop

func (er *EmergencyRelease) Stop()

Stop stops all emergency monitoring

func (*EmergencyRelease) UpdateActivity

func (er *EmergencyRelease) UpdateActivity()

UpdateActivity updates the last activity timestamp

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the main server

func New

func New(cfg *config.Config) (*Server, error)

New creates a new server instance

func (*Server) GetClientManager

func (s *Server) GetClientManager() *ClientManager

GetClientManager returns the client manager instance

func (*Server) GetName

func (s *Server) GetName() string

GetName returns the server name

func (*Server) GetNetworkServer

func (s *Server) GetNetworkServer() *network.SSHServer

GetNetworkServer returns the SSH server instance

func (*Server) GetPort

func (s *Server) GetPort() int

GetPort returns the server port

func (*Server) GetSSHAuthKeysPath

func (s *Server) GetSSHAuthKeysPath() string

GetSSHAuthKeysPath returns the expanded SSH authorized keys path

func (*Server) GetSSHHostKeyPath

func (s *Server) GetSSHHostKeyPath() string

GetSSHHostKeyPath returns the expanded SSH host key path

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the server with appropriate privilege separation

func (*Server) StartNetworking

func (s *Server) StartNetworking(ctx context.Context) error

StartNetworking starts the SSH server after auth handlers are set

func (*Server) Stop

func (s *Server) Stop()

Stop stops the server

Jump to

Keyboard shortcuts

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