Documentation
¶
Overview ¶
Package clientopts holds the RustDesk client options the panel pushes to every device through the heartbeat "strategy" (config_options), currently the WebRTC ones: ice-servers (STUN/TURN for the WebRTC transport of RustDesk 1.5+) and allow-webrtc-congestion-control. See docs/webrtc.md and docs/research/client-api.md §7.4.
The value is one JSON document in the settings table; the ICE server list is AEAD-sealed because TURN URLs carry credentials. Nothing is pushed until an admin saves the options once; from then on the panel owns these keys on the clients ("" removes a key, which restores the client default).
Index ¶
Constants ¶
const ( OptionICEServers = "ice-servers" OptionWebRTCCongestion = "allow-webrtc-congestion-control" )
RustDesk option names pushed in config_options.
const ( MaxICEServers = 16 MaxICEServerLen = 512 )
Limits of the ICE server list.
const SettingKey = "client.options"
SettingKey is the settings row holding the options.
Variables ¶
var ErrInvalidICEServer = errors.New("invalid ICE server")
ErrInvalidICEServer is wrapped by NormalizeICEServers' errors.
Functions ¶
func ConfigOptions ¶
ConfigOptions is the config_options map pushed to clients. Every managed key is present; "" removes it on the client.
func NormalizeICEServers ¶
NormalizeICEServers validates a comma- or newline-separated ICE server list the way RustDesk parses it (hbb_common webrtc.rs get_ice_server_from_url) and returns it comma-joined. TURN URLs without credentials are rejected because the client drops them silently.
Types ¶
type Options ¶
type Options struct {
// ICEServers is a comma-separated list of stun:/stuns:/turn:/turns: URLs;
// TURN entries must carry credentials (turn://user:pass@host:port). ""
// removes the option from clients (they use RustDesk's default STUN).
ICEServers string
// WebRTCCongestion sets allow-webrtc-congestion-control; nil removes it.
WebRTCCongestion *bool
// ModifiedAt (unix ms) is the strategy version clients echo back.
ModifiedAt int64
UpdatedAt time.Time
}
Options are the client options as the admin API sees them.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reads and writes the options and serves them as a heartbeat strategy (clientapi.StrategyProvider). The decoded value is cached; Set refreshes it, so the heartbeat path costs no database read.