kvm

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: 4 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 kvm holds the interfaces shared between the session (transport) and the feature packages (hid, video, media). Feature packages depend only on these interfaces, never on the session implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channels

type Channels interface {
	OpenChannel(ctx context.Context, label string, init *webrtc.DataChannelInit) (io.ReadWriteCloser, error)
}

Channels opens extra data channels after connect (e.g. upload channels, "terminal", "serial"). Renegotiation is handled by the session.

type Device

type Device interface {
	RPC
	HID
	Video
	Channels
	BaseURL() string
}

Device bundles everything a command needs. BaseURL is the device's HTTP origin, e.g. "http://jetkvm.local", for plain HTTP endpoints such as /device or /storage/upload.

type Event

type Event struct {
	Method string
	Params json.RawMessage
}

Event is a JSON-RPC notification pushed by the device.

type HID

type HID interface {
	// SendHID writes one hidrpc message: type byte followed by payload.
	SendHID(msg []byte) error
	// HIDMessages returns messages the device sends back (LED state 0x32,
	// keys-down state 0x33, macro state 0x34).
	HIDMessages() <-chan []byte
}

HID is the binary "hidrpc" data channel (reliable, ordered). The session has already completed the hidrpc handshake (0x01 0x01) before handing it out.

type RPC

type RPC interface {
	// Call sends {"jsonrpc":"2.0","method":method,"params":params,"id":n} and
	// waits for the matching response. params may be nil. A JSON-RPC error
	// response is returned as *RPCError.
	Call(ctx context.Context, method string, params map[string]any) (json.RawMessage, error)
	// Events returns server-initiated notifications (no id), e.g.
	// "videoInputState", "usbState", "otherSessionConnected".
	Events() <-chan Event
}

RPC is the JSON-RPC 2.0 client on the "rpc" data channel.

type RPCError

type RPCError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

RPCError is a JSON-RPC error object returned by the device.

func (*RPCError) Error

func (e *RPCError) Error() string

type Video

type Video interface {
	// VideoTrack blocks until the remote video track arrives.
	VideoTrack(ctx context.Context) (*webrtc.TrackRemote, error)
	// RequestKeyframe sends an RTCP PLI for the video track. The device only
	// emits an IDR frame on feedback, so call this after attaching a reader.
	RequestKeyframe() error
}

Video gives access to the device's video track.

Directories

Path Synopsis
Package kvmtest provides a fake kvm.Device for tests.
Package kvmtest provides a fake kvm.Device for tests.

Jump to

Keyboard shortcuts

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