Documentation
¶
Overview ¶
Package session connects to a JetKVM the way its web UI does: websocket signaling at /webrtc/signaling/client, one pion PeerConnection, the "rpc" and "hidrpc" data channels and a receive-only video transceiver. It implements kvm.Device.
Index ¶
- type Options
- type Session
- func (s *Session) BaseURL() string
- func (s *Session) Call(ctx context.Context, method string, params map[string]any) (json.RawMessage, error)
- func (s *Session) Close() error
- func (s *Session) Events() <-chan kvm.Event
- func (s *Session) HIDMessages() <-chan []byte
- func (s *Session) OpenChannel(ctx context.Context, label string, init *webrtc.DataChannelInit) (io.ReadWriteCloser, error)
- func (s *Session) RequestKeyframe() error
- func (s *Session) SendHID(msg []byte) error
- func (s *Session) VideoTrack(ctx context.Context) (*webrtc.TrackRemote, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
BaseURL string // e.g. "http://jetkvm.local"
Password string // "" for authMode noPassword
// Video adds a recvonly video transceiver; commands that never look at
// the screen leave it off so the device doesn't start encoding.
Video bool
Timeout time.Duration // connect timeout; 0 = 20s
Verbose bool // log signaling / ICE to stderr
}
Options configures Dial.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is a live connection. It satisfies kvm.Device.
func Dial ¶
Dial takes the per-device lock (only one jkvm process talks to a device at a time, since a new WebRTC session kicks the previous one), signals, and waits until the rpc and hidrpc channels are open and the hidrpc handshake is done.
func (*Session) Call ¶
func (s *Session) Call(ctx context.Context, method string, params map[string]any) (json.RawMessage, error)
Call implements kvm.RPC.
func (*Session) HIDMessages ¶
HIDMessages implements kvm.HID.
func (*Session) OpenChannel ¶
func (s *Session) OpenChannel(ctx context.Context, label string, init *webrtc.DataChannelInit) (io.ReadWriteCloser, error)
OpenChannel implements kvm.Channels. SCTP is already up, so new channels need no renegotiation.
func (*Session) RequestKeyframe ¶
RequestKeyframe implements kvm.Video.
func (*Session) VideoTrack ¶
VideoTrack implements kvm.Video.