wraith/internal/rdp/freerdp_stub.go
Vantz Stockwell a8974da37d feat: FreeRDP3 purego backend for Windows with platform stub
Add the real FreeRDP3 RDP backend that loads libfreerdp3.dll at runtime
via syscall.NewLazyDLL (no CGO required). The Windows implementation
(freerdp_windows.go) calls FreeRDP3 functions for instance lifecycle,
settings configuration, input forwarding, and event handling. A stub
(freerdp_stub.go) compiles on non-Windows platforms and returns errors,
keeping macOS/Linux development and tests working. A factory function
(freerdp_factory.go) selects the right backend based on runtime.GOOS,
and app.go now uses NewProductionBackend instead of always using mock.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 07:43:31 -04:00

46 lines
1.3 KiB
Go

//go:build !windows
package rdp
import "fmt"
// FreeRDPBackend is a stub on non-Windows platforms. The real implementation
// lives in freerdp_windows.go and loads FreeRDP3 DLLs via syscall at runtime.
type FreeRDPBackend struct{}
// NewFreeRDPBackend creates a stub backend that returns errors on all operations.
func NewFreeRDPBackend() *FreeRDPBackend {
return &FreeRDPBackend{}
}
func (f *FreeRDPBackend) Connect(config RDPConfig) error {
return fmt.Errorf("FreeRDP backend is only available on Windows — use MockBackend for development")
}
func (f *FreeRDPBackend) Disconnect() error {
return nil
}
func (f *FreeRDPBackend) SendMouseEvent(x, y int, flags uint32) error {
return fmt.Errorf("FreeRDP backend is not available on this platform")
}
func (f *FreeRDPBackend) SendKeyEvent(scancode uint32, pressed bool) error {
return fmt.Errorf("FreeRDP backend is not available on this platform")
}
func (f *FreeRDPBackend) SendClipboard(data string) error {
return fmt.Errorf("FreeRDP backend is not available on this platform")
}
func (f *FreeRDPBackend) GetFrame() ([]byte, error) {
return nil, fmt.Errorf("FreeRDP backend is not available on this platform")
}
func (f *FreeRDPBackend) IsConnected() bool {
return false
}
// Ensure FreeRDPBackend satisfies the RDPBackend interface at compile time.
var _ RDPBackend = (*FreeRDPBackend)(nil)