Documentation
¶
Index ¶
- Constants
- func ErrorfL(l *zerolog.Logger, format string, err error, args ...any) error
- func GetBuiltAppVersion() string
- func GetDefaultHostname() string
- func GetDeviceID() string
- func GetLocalVersion() (systemVersion *semver.Version, appVersion *semver.Version, err error)
- func GetVersionData(isJson bool) ([]byte, error)
- func LoadConfig()
- func Main()
- func RateLimitMiddleware() gin.HandlerFunc
- func RunWebSecureServer()
- func RunWebServer()
- func RunWebsocketClient()
- func SaveBackupConfig() error
- func SaveConfig() error
- type ATXState
- type BacklightSettings
- type ChangePasswordRequest
- type CloudConnectionState
- type CloudRegisterRequest
- type CloudState
- type Config
- type ConsoleBroker
- type DCMsg
- type DCPowerState
- type DevModeState
- type DeviceStatus
- type DisplayRotationSettings
- type FailsafeModeNotification
- type JSONRPCEvent
- type JSONRPCRequest
- type JSONRPCResponse
- type JigglerConfig
- type KeyboardMacro
- type KeyboardMacroStep
- type KeyboardMacrosParams
- type LineEndingMode
- type LocalDevice
- type LoginRequest
- type MQTTConfig
- type MQTTManager
- type MQTTStatusResponse
- type MQTTTestResult
- type NBDDevice
- type NormalizationOptions
- type NormalizeMode
- type PostRebootAction
- type QuickButton
- type RPCHandler
- type RateLimiter
- type RpcNetworkSettings
- type SSHKeyState
- type SerialMux
- type SerialSettings
- type Session
- type SessionConfig
- type SetPasswordRequest
- type SetWakeOnLanDevicesParams
- type SetupRequest
- type Sink
- type StorageFile
- type StorageFileUpload
- type StorageFiles
- type StorageSpace
- type TLSState
- type TXOrigin
- type TerminalSize
- type Terminator
- type UploadProgress
- type VirtualMediaMode
- type VirtualMediaSource
- type VirtualMediaState
- type VirtualMediaUrlInfo
- type WakeOnLanDevice
- type WebRTCSessionRequest
Constants ¶
const ( // CloudWebSocketConnectTimeout is the timeout for the websocket connection to the cloud CloudWebSocketConnectTimeout = 1 * time.Minute // CloudAPIRequestTimeout is the timeout for cloud API requests CloudAPIRequestTimeout = 10 * time.Second // CloudOidcRequestTimeout is the timeout for OIDC token verification requests // should be lower than the websocket response timeout set in cloud-api CloudOidcRequestTimeout = 10 * time.Second // WebsocketPingInterval is the interval at which the websocket client sends ping messages to the cloud WebsocketPingInterval = 15 * time.Second )
const ( MaxMacrosPerDevice = 25 MaxStepsPerMacro = 10 MaxKeysPerStep = 10 MinStepDelay = 50 MaxStepDelay = 2000 )
Constants for keyboard macro limits
const (
DefaultAPIURL = "https://api.jetkvm.com"
)
const MaxPasswordLength = 72
MaxPasswordLength is the maximum length bcrypt can hash. Go's bcrypt implementation rejects passwords over 72 bytes rather than silently truncating them.
const MinPasswordLength = 8
MinPasswordLength is the minimum required length for new passwords. This is only enforced when setting or changing passwords, not when validating existing passwords (to maintain backward compatibility).
const (
NetIfName = "eth0"
)
const SerialCommandHistoryPath = "/userdata/serialCommandHistory.json"
Variables ¶
This section is empty.
Functions ¶
func GetBuiltAppVersion ¶
func GetBuiltAppVersion() string
GetBuiltAppVersion returns the built-in app version
func GetDefaultHostname ¶
func GetDefaultHostname() string
func GetDeviceID ¶
func GetDeviceID() string
func GetLocalVersion ¶
GetLocalVersion returns the local version of the system and app
func GetVersionData ¶
func LoadConfig ¶
func LoadConfig()
func RateLimitMiddleware ¶
func RateLimitMiddleware() gin.HandlerFunc
RateLimitMiddleware creates a Gin middleware that applies rate limiting
func RunWebSecureServer ¶
func RunWebSecureServer()
func RunWebServer ¶
func RunWebServer()
func RunWebsocketClient ¶
func RunWebsocketClient()
func SaveBackupConfig ¶
func SaveBackupConfig() error
func SaveConfig ¶
func SaveConfig() error
Types ¶
type BacklightSettings ¶
type ChangePasswordRequest ¶
type CloudConnectionState ¶
type CloudConnectionState uint8
const ( CloudConnectionStateNotConfigured CloudConnectionState = iota CloudConnectionStateDisconnected CloudConnectionStateConnecting CloudConnectionStateConnected )
type CloudRegisterRequest ¶
type CloudState ¶
type Config ¶
type Config struct {
CloudURL string `json:"cloud_url"`
UpdateAPIURL string `json:"update_api_url"`
CloudAppURL string `json:"cloud_app_url"`
CloudToken string `json:"cloud_token"`
TailscaleControlURL string `json:"tailscale_control_url,omitempty"`
GoogleIdentity string `json:"google_identity"`
JigglerEnabled bool `json:"jiggler_enabled"`
JigglerConfig *JigglerConfig `json:"jiggler_config"`
AutoUpdateEnabled bool `json:"auto_update_enabled"`
IncludePreRelease bool `json:"include_pre_release"`
HashedPassword string `json:"hashed_password"`
LocalAuthToken string `json:"local_auth_token"`
LocalAuthMode string `json:"localAuthMode"` //TODO: fix it with migration
LocalLoopbackOnly bool `json:"local_loopback_only"`
WakeOnLanDevices []WakeOnLanDevice `json:"wake_on_lan_devices"`
KeyboardMacros []KeyboardMacro `json:"keyboard_macros"`
KeyboardLayout string `json:"keyboard_layout"`
EdidString string `json:"hdmi_edid_string"`
ActiveExtension string `json:"active_extension"`
DisplayRotation string `json:"display_rotation"`
DisplayMaxBrightness int `json:"display_max_brightness"`
DisplayDimAfterSec int `json:"display_dim_after_sec"`
DisplayOffAfterSec int `json:"display_off_after_sec"`
TLSMode string `json:"tls_mode"` // options: "self-signed", "user-defined", ""
UsbConfig *usbgadget.Config `json:"usb_config"`
UsbDevices *usbgadget.Devices `json:"usb_devices"`
NetworkConfig *types.NetworkConfig `json:"network_config"`
DefaultLogLevel string `json:"default_log_level"`
VideoSleepAfterSec int `json:"video_sleep_after_sec"`
VideoQualityFactor float64 `json:"video_quality_factor"`
VideoCodecPreference string `json:"video_codec_preference"`
NativeMaxRestart uint `json:"native_max_restart_attempts"`
MqttConfig *MQTTConfig `json:"mqtt_config"`
}
func (*Config) GetDisplayRotation ¶
GetDisplayRotation returns the display rotation
func (*Config) GetUpdateAPIURL ¶
GetUpdateAPIURL returns the update API URL
func (*Config) SetDisplayRotation ¶
SetDisplayRotation sets the display rotation
type ConsoleBroker ¶
type ConsoleBroker struct {
// contains filtered or unexported fields
}
func NewConsoleBroker ¶
func NewConsoleBroker(s Sink, norm NormalizationOptions) *ConsoleBroker
func (*ConsoleBroker) Close ¶
func (b *ConsoleBroker) Close()
func (*ConsoleBroker) Enqueue ¶
func (b *ConsoleBroker) Enqueue(ev consoleEvent)
func (*ConsoleBroker) SetNormOptions ¶
func (b *ConsoleBroker) SetNormOptions(norm NormalizationOptions)
func (*ConsoleBroker) SetSink ¶
func (b *ConsoleBroker) SetSink(s Sink)
func (*ConsoleBroker) SetTerminalPaused ¶
func (b *ConsoleBroker) SetTerminalPaused(v bool)
func (*ConsoleBroker) Start ¶
func (b *ConsoleBroker) Start()
type DCMsg ¶
type DCMsg struct {
Type string `json:"type"` // "serial" | "system"
Name string `json:"name,omitempty"` // e.g. "term.size"
Data json.RawMessage `json:"data"` // string for "serial", object for "system"
}
type DCPowerState ¶
type DevModeState ¶
type DevModeState struct {
Enabled bool `json:"enabled"`
}
type DeviceStatus ¶
type DeviceStatus struct {
IsSetup bool `json:"isSetup"`
}
type DisplayRotationSettings ¶
type DisplayRotationSettings struct {
Rotation string `json:"rotation"`
}
type JSONRPCEvent ¶
type JSONRPCRequest ¶
type JSONRPCResponse ¶
type JigglerConfig ¶
type KeyboardMacro ¶
type KeyboardMacro struct {
ID string `json:"id"`
Name string `json:"name"`
Steps []KeyboardMacroStep `json:"steps"`
SortOrder int `json:"sortOrder,omitempty"`
}
func (*KeyboardMacro) Validate ¶
func (m *KeyboardMacro) Validate() error
type KeyboardMacroStep ¶
type KeyboardMacroStep struct {
Keys []string `json:"keys"`
Modifiers []string `json:"modifiers"`
Delay int `json:"delay"`
}
func (*KeyboardMacroStep) Validate ¶
func (s *KeyboardMacroStep) Validate() error
type KeyboardMacrosParams ¶
type KeyboardMacrosParams struct {
Macros []any `json:"macros"`
}
type LineEndingMode ¶
type LineEndingMode int
const ( LineEnding_AsIs LineEndingMode = iota LineEnding_LF LineEnding_CR LineEnding_CRLF LineEnding_LFCR )
type LocalDevice ¶
type LoginRequest ¶
type LoginRequest struct {
Password string `json:"password"`
}
type MQTTConfig ¶
type MQTTConfig struct {
Enabled bool `json:"enabled"`
Broker string `json:"broker"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
BaseTopic string `json:"base_topic"`
UseTLS bool `json:"use_tls"`
TLSInsecure bool `json:"tls_insecure"`
EnableHADiscovery bool `json:"enable_ha_discovery"`
EnableActions bool `json:"enable_actions"`
DebounceMs int `json:"debounce_ms"`
}
type MQTTManager ¶
type MQTTManager struct {
// contains filtered or unexported fields
}
func NewMQTTManager ¶
func NewMQTTManager(cfg *MQTTConfig, deviceID string) (*MQTTManager, error)
func (*MQTTManager) Close ¶
func (m *MQTTManager) Close()
Close disconnects from the MQTT broker gracefully and stops background goroutines.
func (*MQTTManager) IsConnected ¶
func (m *MQTTManager) IsConnected() bool
IsConnected returns the current connection state.
func (*MQTTManager) LastError ¶
func (m *MQTTManager) LastError() string
LastError returns the last connection error, or empty string if none.
type MQTTStatusResponse ¶
type MQTTTestResult ¶
type NBDDevice ¶
type NBDDevice struct {
// contains filtered or unexported fields
}
func NewNBDDevice ¶
func NewNBDDevice() *NBDDevice
type NormalizationOptions ¶
type NormalizationOptions struct {
Mode NormalizeMode
LineEnding LineEndingMode
TabRender string // e.g. " " or "" to keep '\t'
PreserveANSI bool
ShowNLTag bool // print a visible tag for CR/LF like <CR>, <LF>, <CRLF>
}
type NormalizeMode ¶
type NormalizeMode int
const ( ModeCaret NormalizeMode = iota // ^C ^M ^? ModeNames // <CR>, <LF>, <ESC>, … ModeHex // \x1B )
type PostRebootAction ¶
type QuickButton ¶
type QuickButton struct {
Id string `json:"id"` // Unique identifier
Label string `json:"label"` // Button label
Command string `json:"command"` // Command to send, raw command to send (without auto-terminator)
Terminator Terminator `json:"terminator"` // Terminator to use: None/CR/LF/CRLF/LFCR
Sort int `json:"sort"` // Sort order
}
type RPCHandler ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter provides IP-based rate limiting for password-related endpoints
func NewRateLimiter ¶
func NewRateLimiter() *RateLimiter
NewRateLimiter creates a new rate limiter with automatic cleanup
func (*RateLimiter) IsAllowed ¶
func (rl *RateLimiter) IsAllowed(ip string) (bool, int)
IsAllowed checks if the IP is allowed to make an attempt. Returns (allowed, retryAfterSeconds)
func (*RateLimiter) RecordFailure ¶
func (rl *RateLimiter) RecordFailure(ip string)
RecordFailure records a failed authentication attempt for the IP
func (*RateLimiter) RecordSuccess ¶
func (rl *RateLimiter) RecordSuccess(ip string)
RecordSuccess clears the rate limit entry for an IP after successful auth
type RpcNetworkSettings ¶
type RpcNetworkSettings struct {
types.NetworkConfig
}
func (*RpcNetworkSettings) ToNetworkConfig ¶
func (s *RpcNetworkSettings) ToNetworkConfig() *types.NetworkConfig
type SSHKeyState ¶
type SSHKeyState struct {
SSHKey string `json:"sshKey"`
}
type SerialMux ¶
type SerialMux struct {
// contains filtered or unexported fields
}
func NewSerialMux ¶
func NewSerialMux(p serial.Port, broker *ConsoleBroker) *SerialMux
func (*SerialMux) SetEchoEnabled ¶
type SerialSettings ¶
type SerialSettings struct {
BaudRate int `json:"baudRate"` // The serial port bitrate (aka Baudrate)
DataBits int `json:"dataBits"` // Size of the character (must be 5, 6, 7 or 8)
Parity string `json:"parity"` // Parity (see Parity type for more info)
StopBits string `json:"stopBits"` // Stop bits (see StopBits type for more info)
Terminator Terminator `json:"terminator"` // Terminator to send after each command
HideSerialSettings bool `json:"hideSerialSettings"` // Whether to hide the serial settings in the UI
EnableEcho bool `json:"enableEcho"` // Whether to echo received characters back to the sender
NormalizeMode string `json:"normalizeMode"` // Normalization mode: "carret", "names", "hex"
NormalizeLineEnd string `json:"normalizeLineEnd"` // Line ending normalization: "keep", "lf", "cr", "crlf", "lfcr"
TabRender string `json:"tabRender"` // How to render tabs: "spaces", "arrow", "pipe"
PreserveANSI bool `json:"preserveANSI"` // Whether to preserve ANSI escape codes
ShowNLTag bool `json:"showNLTag"` // Whether to show a special tag for new lines
Buttons []QuickButton `json:"buttons"` // Custom quick buttons
}
Mode describes a serial port configuration.
type Session ¶
type Session struct {
VideoTrack *webrtc.TrackLocalStaticSample
ControlChannel *webrtc.DataChannel
RPCChannel *webrtc.DataChannel
HidChannel *webrtc.DataChannel
// contains filtered or unexported fields
}
func (*Session) GetDiagnosticsInfo ¶
func (s *Session) GetDiagnosticsInfo() diagnostics.SessionInfo
GetDiagnosticsInfo returns WebRTC diagnostic info for the diagnostics package.
type SessionConfig ¶
type SetPasswordRequest ¶
type SetPasswordRequest struct {
Password string `json:"password"`
}
type SetWakeOnLanDevicesParams ¶
type SetWakeOnLanDevicesParams struct {
Devices []WakeOnLanDevice `json:"devices"`
}
type SetupRequest ¶
type StorageFile ¶
type StorageFileUpload ¶
type StorageFiles ¶
type StorageFiles struct {
Files []StorageFile `json:"files"`
}
type StorageSpace ¶
type TerminalSize ¶
type Terminator ¶
type UploadProgress ¶
type VirtualMediaMode ¶
type VirtualMediaMode string
const ( CDROM VirtualMediaMode = "CDROM" Disk VirtualMediaMode = "Disk" )
type VirtualMediaSource ¶
type VirtualMediaSource string
const ( HTTP VirtualMediaSource = "HTTP" Storage VirtualMediaSource = "Storage" )
type VirtualMediaState ¶
type VirtualMediaState struct {
Source VirtualMediaSource `json:"source"`
Mode VirtualMediaMode `json:"mode"`
Filename string `json:"filename,omitempty"`
URL string `json:"url,omitempty"`
Size int64 `json:"size"`
}
type VirtualMediaUrlInfo ¶
type WakeOnLanDevice ¶
Source Files
¶
- block_device.go
- block_device_linux.go
- cdc_acm_console.go
- cloud.go
- config.go
- dc_metrics.go
- display.go
- failsafe.go
- hidrpc.go
- hw.go
- jiggler.go
- jsonrpc.go
- log.go
- main.go
- mdns.go
- mqtt.go
- mqtt_commands.go
- mqtt_discovery.go
- mqtt_publish.go
- native.go
- network.go
- ota.go
- prometheus.go
- ratelimit.go
- serial.go
- serial_console_helpers.go
- tailscale.go
- terminal.go
- timesync.go
- usb.go
- usb_mass_storage.go
- version.go
- video.go
- web.go
- web_tls.go
- webrtc.go
- wol.go
Directories
¶
| Path | Synopsis |
|---|---|
|
e2e
|
|
|
remote-agent
module
|
|
|
internal
|
|
|
diagnostics
Package diagnostics provides comprehensive system diagnostics logging for crash analysis, debugging, and troubleshooting.
|
Package diagnostics provides comprehensive system diagnostics logging for crash analysis, debugging, and troubleshooting. |
|
tzdata
Code generated by "go run gen.go".
|
Code generated by "go run gen.go". |
|
usbgadget
Package usbgadget provides a high-level interface to manage USB gadgets THIS PACKAGE IS FOR INTERNAL USE ONLY AND ITS API MAY CHANGE WITHOUT NOTICE
|
Package usbgadget provides a high-level interface to manage USB gadgets THIS PACKAGE IS FOR INTERNAL USE ONLY AND ITS API MAY CHANGE WITHOUT NOTICE |
|
pkg
|
|
|
nmlite
Package nmlite provides DHCP client functionality for the network manager.
|
Package nmlite provides DHCP client functionality for the network manager. |
|
nmlite/link
Package link provides a wrapper around netlink.Link and provides a singleton netlink manager.
|
Package link provides a wrapper around netlink.Link and provides a singleton netlink manager. |