Documentation ¶
Index ¶
- Variables
- type ApiManager
- type BroadcastManager
- type CaptureManager
- type CheckOrigin
- type ClipboardText
- type Cursor
- type CursorImage
- type DependablePlugin
- type DesktopManager
- type ExposablePlugin
- type HttpManager
- type ICEServer
- type KeyboardMap
- type KeyboardModifiers
- type MemberManager
- type MemberProfile
- type MemberProvider
- type MiddlewareHandler
- type Plugin
- type PluginConfig
- type PluginManagers
- type PluginMetadata
- type Router
- type RouterHandler
- type Sample
- type SampleListener
- type ScreenSize
- type ScreencastManager
- type Session
- type SessionManager
- type SessionProfile
- type SessionState
- type Settings
- type StreamSelector
- type StreamSelectorManager
- type StreamSelectorType
- type StreamSinkManager
- type StreamSrcManager
- type VideoConfig
- type WebRTCManager
- type WebRTCPeer
- type WebSocketHandler
- type WebSocketManager
- type WebSocketMessage
- type WebSocketPeer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMemberAlreadyExists = errors.New("member already exists") ErrMemberDoesNotExist = errors.New("member does not exist") ErrMemberInvalidPassword = errors.New("invalid password") )
View Source
var ( ErrSessionNotFound = errors.New("session not found") ErrSessionAlreadyExists = errors.New("session already exists") ErrSessionAlreadyConnected = errors.New("session is already connected") ErrSessionLoginDisabled = errors.New("session login disabled") )
View Source
var ( ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found") ErrWebRTCConnectionNotFound = errors.New("webrtc connection not found") ErrWebRTCStreamNotFound = errors.New("webrtc stream not found") )
View Source
var (
ErrCapturePipelineAlreadyExists = errors.New("capture pipeline already exists")
)
Functions ¶
This section is empty.
Types ¶
type ApiManager ¶
type BroadcastManager ¶
type CaptureManager ¶
type CaptureManager interface { Start() Shutdown() error Broadcast() BroadcastManager Screencast() ScreencastManager Audio() StreamSinkManager Video() StreamSelectorManager Webcam() StreamSrcManager Microphone() StreamSrcManager }
type CheckOrigin ¶
type ClipboardText ¶
type CursorImage ¶
type DependablePlugin ¶
type DesktopManager ¶
type DesktopManager interface { Start() Shutdown() error OnBeforeScreenSizeChange(listener func()) OnAfterScreenSizeChange(listener func()) // xorg Move(x, y int) GetCursorPosition() (int, int) Scroll(x, y int) ButtonDown(code uint32) error KeyDown(code uint32) error ButtonUp(code uint32) error KeyUp(code uint32) error ButtonPress(code uint32) error KeyPress(codes ...uint32) error ResetKeys() ScreenConfigurations() []ScreenSize SetScreenSize(ScreenSize) (ScreenSize, error) GetScreenSize() ScreenSize SetKeyboardMap(KeyboardMap) error GetKeyboardMap() (*KeyboardMap, error) SetKeyboardModifiers(mod KeyboardModifiers) GetKeyboardModifiers() KeyboardModifiers GetCursorImage() *CursorImage GetScreenshotImage() *image.RGBA // xevent OnCursorChanged(listener func(serial uint64)) OnClipboardUpdated(listener func()) OnFileChooserDialogOpened(listener func()) OnFileChooserDialogClosed(listener func()) OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8)) // clipboard ClipboardGetText() (*ClipboardText, error) ClipboardSetText(data ClipboardText) error ClipboardGetBinary(mime string) ([]byte, error) ClipboardSetBinary(mime string, data []byte) error ClipboardGetTargets() ([]string, error) // drop DropFiles(x int, y int, files []string) bool // filechooser HandleFileChooserDialog(uri string) error CloseFileChooserDialog() IsFileChooserDialogOpened() bool }
type ExposablePlugin ¶
type HttpManager ¶
type HttpManager interface { Start() Shutdown() error }
type KeyboardMap ¶
type KeyboardModifiers ¶
type MemberManager ¶
type MemberProfile ¶
type MemberProfile struct { Name string `json:"name"` // permissions IsAdmin bool `json:"is_admin" mapstructure:"is_admin"` CanLogin bool `json:"can_login" mapstructure:"can_login"` CanConnect bool `json:"can_connect" mapstructure:"can_connect"` CanWatch bool `json:"can_watch" mapstructure:"can_watch"` CanHost bool `json:"can_host" mapstructure:"can_host"` CanAccessClipboard bool `json:"can_access_clipboard" mapstructure:"can_access_clipboard"` SendsInactiveCursor bool `json:"sends_inactive_cursor" mapstructure:"sends_inactive_cursor"` CanSeeInactiveCursors bool `json:"can_see_inactive_cursors" mapstructure:"can_see_inactive_cursors"` // plugin scope Plugins map[string]any `json:"plugins"` }
type MemberProvider ¶
type MemberProvider interface { Connect() error Disconnect() error Authenticate(username string, password string) (id string, profile MemberProfile, err error) Insert(username string, password string, profile MemberProfile) (id string, err error) Select(id string) (profile MemberProfile, err error) SelectAll(limit int, offset int) (profiles map[string]MemberProfile, err error) UpdateProfile(id string, profile MemberProfile) error UpdatePassword(id string, password string) error Delete(id string) error }
type MiddlewareHandler ¶
type Plugin ¶
type Plugin interface { Name() string Config() PluginConfig Start(PluginManagers) error Shutdown() error }
type PluginConfig ¶
type PluginManagers ¶
type PluginManagers struct { SessionManager SessionManager WebSocketManager WebSocketManager ApiManager ApiManager LoadServiceFromPlugin func(string) (any, error) }
func (*PluginManagers) Validate ¶
func (p *PluginManagers) Validate() error
type PluginMetadata ¶ added in v1.6.10
type Router ¶
type Router interface { Group(fn func(Router)) Route(pattern string, fn func(Router)) Get(pattern string, fn RouterHandler) Post(pattern string, fn RouterHandler) Put(pattern string, fn RouterHandler) Patch(pattern string, fn RouterHandler) Delete(pattern string, fn RouterHandler) With(fn MiddlewareHandler) Router WithBypass(fn func(next http.Handler) http.Handler) Router Use(fn MiddlewareHandler) UseBypass(fn func(next http.Handler) http.Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) }
type RouterHandler ¶
type RouterHandler func(w http.ResponseWriter, r *http.Request) error
type SampleListener ¶ added in v1.6.9
type SampleListener interface {
WriteSample(Sample)
}
type ScreenSize ¶
type ScreencastManager ¶
type Session ¶
type Session interface { ID() string Profile() MemberProfile State() SessionState IsHost() bool PrivateModeEnabled() bool // cursor SetCursor(cursor Cursor) // websocket ConnectWebSocketPeer(websocketPeer WebSocketPeer) DisconnectWebSocketPeer(websocketPeer WebSocketPeer, delayed bool) DestroyWebSocketPeer(reason string) Send(event string, payload any) // webrtc SetWebRTCPeer(webrtcPeer WebRTCPeer) SetWebRTCConnected(webrtcPeer WebRTCPeer, connected bool) GetWebRTCPeer() WebRTCPeer }
type SessionManager ¶
type SessionManager interface { Create(id string, profile MemberProfile) (Session, string, error) Update(id string, profile MemberProfile) error Delete(id string) error Get(id string) (Session, bool) GetByToken(token string) (Session, bool) List() []Session SetHost(host Session) GetHost() (Session, bool) ClearHost() SetCursor(cursor Cursor, session Session) PopCursors() map[Session][]Cursor Broadcast(event string, payload any, exclude ...string) AdminBroadcast(event string, payload any, exclude ...string) InactiveCursorsBroadcast(event string, payload any, exclude ...string) OnCreated(listener func(session Session)) OnDeleted(listener func(session Session)) OnConnected(listener func(session Session)) OnDisconnected(listener func(session Session)) OnProfileChanged(listener func(session Session)) OnStateChanged(listener func(session Session)) OnHostChanged(listener func(session Session)) OnSettingsChanged(listener func(new Settings, old Settings)) UpdateSettings(Settings) Settings() Settings CookieEnabled() bool CookieSetToken(w http.ResponseWriter, token string) CookieClearToken(w http.ResponseWriter, r *http.Request) Authenticate(r *http.Request) (Session, error) }
type SessionProfile ¶ added in v1.6.9
type SessionProfile struct { Id string Token string Profile MemberProfile }
type SessionState ¶
type SessionState struct { IsConnected bool `json:"is_connected"` // when the session was last connected ConnectedSince *time.Time `json:"connected_since,omitempty"` // when the session was last not connected NotConnectedSince *time.Time `json:"not_connected_since,omitempty"` IsWatching bool `json:"is_watching"` // when the session was last watching WatchingSince *time.Time `json:"watching_since,omitempty"` // when the session was last not watching NotWatchingSince *time.Time `json:"not_watching_since,omitempty"` }
type Settings ¶
type Settings struct { PrivateMode bool `json:"private_mode"` LockedControls bool `json:"locked_controls"` ImplicitHosting bool `json:"implicit_hosting"` InactiveCursors bool `json:"inactive_cursors"` MercifulReconnect bool `json:"merciful_reconnect"` // plugin scope Plugins map[string]any `json:"plugins"` }
type StreamSelector ¶ added in v1.6.12
type StreamSelector struct { // type of stream selector Type StreamSelectorType // select stream by its ID ID string // select stream by its bitrate Bitrate uint64 }
type StreamSelectorManager ¶ added in v1.6.12
type StreamSelectorManager interface { IDs() []string Codec() codec.RTPCodec GetStream(selector StreamSelector) (StreamSinkManager, bool) }
type StreamSelectorType ¶ added in v1.6.12
type StreamSelectorType int
const ( // select exact stream StreamSelectorTypeExact StreamSelectorType = iota // select nearest stream (in either direction) if exact stream is not available StreamSelectorTypeNearest // if exact stream is found select the next lower stream, otherwise select the nearest lower stream StreamSelectorTypeLower // if exact stream is found select the next higher stream, otherwise select the nearest higher stream StreamSelectorTypeHigher )
func (StreamSelectorType) MarshalText ¶ added in v1.6.12
func (s StreamSelectorType) MarshalText() ([]byte, error)
func (StreamSelectorType) String ¶ added in v1.6.12
func (s StreamSelectorType) String() string
func (*StreamSelectorType) UnmarshalText ¶ added in v1.6.12
func (s *StreamSelectorType) UnmarshalText(text []byte) error
type StreamSinkManager ¶
type StreamSinkManager interface { ID() string Codec() codec.RTPCodec Bitrate() uint64 AddListener(listener SampleListener) error RemoveListener(listener SampleListener) error MoveListenerTo(listener SampleListener, targetStream StreamSinkManager) error ListenersCount() int Started() bool CreatePipeline() error DestroyPipeline() }
type StreamSrcManager ¶
type VideoConfig ¶
type VideoConfig struct { Width string `mapstructure:"width"` // expression Height string `mapstructure:"height"` // expression Fps string `mapstructure:"fps"` // expression Bitrate int `mapstructure:"bitrate"` // pipeline bitrate GstPrefix string `mapstructure:"gst_prefix"` // pipeline prefix, starts with ! GstEncoder string `mapstructure:"gst_encoder"` // gst encoder name GstParams map[string]string `mapstructure:"gst_params"` // map of expressions GstSuffix string `mapstructure:"gst_suffix"` // pipeline suffix, starts with ! GstPipeline string `mapstructure:"gst_pipeline"` // whole pipeline as a string }
func (*VideoConfig) GetPipeline ¶
func (config *VideoConfig) GetPipeline(screen ScreenSize) (string, error)
type WebRTCManager ¶
type WebRTCPeer ¶
type WebRTCPeer interface { CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error) CreateAnswer() (*webrtc.SessionDescription, error) SetRemoteDescription(webrtc.SessionDescription) error SetCandidate(webrtc.ICECandidateInit) error SetVideo(StreamSelector) error VideoID() (string, bool) SetPaused(isPaused bool) error Paused() bool SetVideoAuto(auto bool) VideoAuto() bool SendCursorPosition(x, y int) error SendCursorImage(cur *CursorImage, img []byte) error Destroy() }
type WebSocketHandler ¶
type WebSocketHandler func(Session, WebSocketMessage) bool
type WebSocketManager ¶
type WebSocketManager interface { Start() Shutdown() error AddHandler(handler WebSocketHandler) Upgrade(checkOrigin CheckOrigin) RouterHandler }
type WebSocketMessage ¶
type WebSocketMessage struct { Event string `json:"event"` Payload json.RawMessage `json:"payload,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.