session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func Dial(ctx context.Context, opt Options) (*Session, error)

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) BaseURL

func (s *Session) BaseURL() string

BaseURL implements kvm.Device.

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) Close

func (s *Session) Close() error

Close tears down the peer connection and releases the device lock.

func (*Session) Events

func (s *Session) Events() <-chan kvm.Event

Events implements kvm.RPC.

func (*Session) HIDMessages

func (s *Session) HIDMessages() <-chan []byte

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

func (s *Session) RequestKeyframe() error

RequestKeyframe implements kvm.Video.

func (*Session) SendHID

func (s *Session) SendHID(msg []byte) error

SendHID implements kvm.HID.

func (*Session) VideoTrack

func (s *Session) VideoTrack(ctx context.Context) (*webrtc.TrackRemote, error)

VideoTrack implements kvm.Video.

Jump to

Keyboard shortcuts

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