Documentation
¶
Index ¶
- Variables
- type AgentAuth
- type AuthError
- type AuthMethod
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect(host string, port int, auth AuthMethod) error
- func (c *Client) ConnectWithConn(conn net.Conn, auth AuthMethod) error
- func (c *Client) Disconnect() error
- func (c *Client) IsConnected() bool
- func (c *Client) ListGames() ([]GameInfo, error)
- func (c *Client) Reconnect(auth AuthMethod) error
- func (c *Client) Run(ctx context.Context) error
- func (c *Client) SelectGame(gameName string) error
- func (c *Client) SetView(view View) error
- type ClientConfig
- type ConnectionError
- type GameInfo
- type HostKeyCallback
- type InputEvent
- type InputEventType
- type InsecureHostKeyCallback
- type InteractiveAuth
- type KeyAuth
- type KnownHostsCallback
- type PasswordAuth
- type ResizeEvent
- type Session
- type View
- type ViewFactory
- type ViewFactoryFunc
- type ViewOptions
Constants ¶
This section is empty.
Variables ¶
var ( // Connection errors ErrConnectionFailed = errors.New("connection failed") ErrAuthenticationFailed = errors.New("authentication failed") ErrHostKeyMismatch = errors.New("host key mismatch") ErrConnectionTimeout = errors.New("connection timeout") // Session errors ErrPTYAllocationFailed = errors.New("PTY allocation failed") ErrSessionNotStarted = errors.New("session not started") ErrInvalidTerminalSize = errors.New("invalid terminal size") // View errors ErrViewNotSet = errors.New("view not set") ErrViewInitFailed = errors.New("view initialization failed") // Game errors ErrGameNotFound = errors.New("game not found") ErrGameSelectionFailed = errors.New("game selection failed") )
Functions ¶
This section is empty.
Types ¶
type AgentAuth ¶
type AgentAuth struct {
// contains filtered or unexported fields
}
AgentAuth implements SSH agent-based authentication
func (*AgentAuth) GetSSHAuthMethod ¶
func (a *AgentAuth) GetSSHAuthMethod() (ssh.AuthMethod, error)
type AuthMethod ¶
type AuthMethod interface { // GetSSHAuthMethod returns the underlying SSH auth method GetSSHAuthMethod() (ssh.AuthMethod, error) // Name returns a human-readable name for the auth method Name() string }
AuthMethod defines the interface for SSH authentication methods
func NewAgentAuth ¶
func NewAgentAuth() AuthMethod
NewAgentAuth creates a new SSH agent authentication method
func NewInteractiveAuth ¶
func NewInteractiveAuth(callback func(name, instruction string, questions []string, echos []bool) ([]string, error)) AuthMethod
NewInteractiveAuth creates a new interactive authentication method
func NewKeyAuth ¶
func NewKeyAuth(keyPath, passphrase string) AuthMethod
NewKeyAuth creates a new key authentication method
func NewPasswordAuth ¶
func NewPasswordAuth(password string) AuthMethod
NewPasswordAuth creates a new password authentication method
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages connections to dgamelaunch servers
func NewClient ¶
func NewClient(config *ClientConfig) *Client
NewClient creates a new dgamelaunch client
func (*Client) Connect ¶
func (c *Client) Connect(host string, port int, auth AuthMethod) error
Connect establishes a connection to the dgamelaunch server
func (*Client) ConnectWithConn ¶
func (c *Client) ConnectWithConn(conn net.Conn, auth AuthMethod) error
ConnectWithConn establishes a connection to the dgamelaunch server using an existing net.Conn
func (*Client) Disconnect ¶
Disconnect closes the connection to the server
func (*Client) IsConnected ¶
IsConnected returns true if the client is connected
func (*Client) Reconnect ¶
func (c *Client) Reconnect(auth AuthMethod) error
Reconnect attempts to reconnect to the server
func (*Client) SelectGame ¶
SelectGame sends commands to select a specific game
type ClientConfig ¶
type ClientConfig struct { // SSH client configuration SSHConfig *ssh.ClientConfig // Connection settings ConnectTimeout time.Duration KeepAliveInterval time.Duration // Retry settings MaxReconnectAttempts int ReconnectDelay time.Duration // Terminal settings DefaultTerminal string // Debug options Debug bool }
ClientConfig contains configuration for the client
func DefaultClientConfig ¶
func DefaultClientConfig() *ClientConfig
DefaultClientConfig returns a client configuration with sensible defaults
type ConnectionError ¶
ConnectionError wraps connection-specific errors with additional context
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (e *ConnectionError) Unwrap() error
type HostKeyCallback ¶
HostKeyCallback defines host key verification behavior
func NewKnownHostsCallback ¶
func NewKnownHostsCallback(path string) (HostKeyCallback, error)
NewKnownHostsCallback creates a new known hosts callback
type InputEvent ¶
type InputEvent struct { Type InputEventType Data []byte Key string // For special keys }
InputEvent represents a user input event
type InputEventType ¶
type InputEventType int
InputEventType defines types of input events
const ( InputEventTypeKey InputEventType = iota InputEventTypeResize InputEventTypePaste )
type InsecureHostKeyCallback ¶
type InsecureHostKeyCallback struct{}
InsecureHostKeyCallback accepts any host key (NOT FOR PRODUCTION)
type InteractiveAuth ¶
type InteractiveAuth struct {
// contains filtered or unexported fields
}
InteractiveAuth implements keyboard-interactive authentication
func (*InteractiveAuth) GetSSHAuthMethod ¶
func (i *InteractiveAuth) GetSSHAuthMethod() (ssh.AuthMethod, error)
func (*InteractiveAuth) Name ¶
func (i *InteractiveAuth) Name() string
type KeyAuth ¶
type KeyAuth struct {
// contains filtered or unexported fields
}
KeyAuth implements key-based authentication
func (*KeyAuth) GetSSHAuthMethod ¶
func (k *KeyAuth) GetSSHAuthMethod() (ssh.AuthMethod, error)
type KnownHostsCallback ¶
type KnownHostsCallback struct {
// contains filtered or unexported fields
}
KnownHostsCallback uses a known_hosts file for verification
type PasswordAuth ¶
type PasswordAuth struct {
// contains filtered or unexported fields
}
PasswordAuth implements password-based authentication
func (*PasswordAuth) GetSSHAuthMethod ¶
func (p *PasswordAuth) GetSSHAuthMethod() (ssh.AuthMethod, error)
func (*PasswordAuth) Name ¶
func (p *PasswordAuth) Name() string
type ResizeEvent ¶
ResizeEvent contains terminal resize information
type Session ¶
type Session interface { // RequestPTY requests a pseudo-terminal RequestPTY(term string, h, w int) error // WindowChange notifies the server of terminal size changes WindowChange(h, w int) error // StdinPipe returns a pipe for writing to the session StdinPipe() (io.WriteCloser, error) // StdoutPipe returns a pipe for reading from the session StdoutPipe() (io.Reader, error) // StderrPipe returns a pipe for reading stderr from the session StderrPipe() (io.Reader, error) // Start starts the session with the given command Start(cmd string) error // Shell starts an interactive shell session Shell() error // Wait waits for the session to finish Wait() error // Signal sends a signal to the remote process Signal(sig ssh.Signal) error // Close closes the session Close() error }
Session wraps an SSH session with PTY support
func NewSSHSession ¶
NewSSHSession creates a new Session from an ssh.Session
type View ¶
type View interface { // Init initializes the view Init() error // Render displays the provided data Render(data []byte) error // Clear clears the display Clear() error // SetSize updates the view dimensions SetSize(width, height int) error // GetSize returns current dimensions GetSize() (width, height int) // HandleInput reads and returns user input // Returns nil, io.EOF when input stream is closed HandleInput() ([]byte, error) // Close cleans up resources Close() error }
View defines the interface for rendering game output and handling input
type ViewFactory ¶
type ViewFactory interface {
CreateView(opts ViewOptions) (View, error)
}
ViewFactory creates View instances
type ViewFactoryFunc ¶
type ViewFactoryFunc func(opts ViewOptions) (View, error)
ViewFactoryFunc is an adapter to allow functions to be used as ViewFactory
func (ViewFactoryFunc) CreateView ¶
func (f ViewFactoryFunc) CreateView(opts ViewOptions) (View, error)
type ViewOptions ¶
type ViewOptions struct { // Terminal type (e.g., "xterm-256color", "vt100") TerminalType string // Initial dimensions InitialWidth int InitialHeight int // Color support ColorEnabled bool // Unicode support UnicodeEnabled bool // Custom configuration Config map[string]interface{} }
ViewOptions contains configuration for view creation
func DefaultViewOptions ¶
func DefaultViewOptions() ViewOptions
DefaultViewOptions returns sensible defaults for view creation