mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-28 09:01:22 +02:00
feat(webrtc): add configurable STUN and TURN servers
Add backend config, RPC handlers, and an HTTP endpoint for WebRTC ICE servers. Replace hardcoded frontend STUN usage with server-provided ICE server configuration, and add access settings UI for STUN and TURN entries.
This commit is contained in:
12
config.go
12
config.go
@@ -21,6 +21,12 @@ type WakeOnLanDevice struct {
|
||||
MacAddress string `json:"macAddress"`
|
||||
}
|
||||
|
||||
type TurnServer struct {
|
||||
URL string `json:"url"`
|
||||
Username string `json:"username"`
|
||||
Credential string `json:"credential"`
|
||||
}
|
||||
|
||||
// Constants for keyboard macro limits
|
||||
const (
|
||||
MaxMacrosPerDevice = 25
|
||||
@@ -81,6 +87,7 @@ func (m *KeyboardMacro) Validate() error {
|
||||
|
||||
type Config struct {
|
||||
STUN string `json:"stun"`
|
||||
TurnServers []TurnServer `json:"turn_servers"`
|
||||
JigglerEnabled bool `json:"jiggler_enabled"`
|
||||
AutoUpdateEnabled bool `json:"auto_update_enabled"`
|
||||
IncludePreRelease bool `json:"include_pre_release"`
|
||||
@@ -185,6 +192,7 @@ const sdConfigPath = "/mnt/sdcard/kvm_config.json"
|
||||
|
||||
var defaultConfig = &Config{
|
||||
STUN: "stun:stun.l.google.com:19302",
|
||||
TurnServers: []TurnServer{},
|
||||
AutoUpdateEnabled: false, // Set a default value
|
||||
ActiveExtension: "",
|
||||
KeyboardMacros: []KeyboardMacro{},
|
||||
@@ -299,6 +307,10 @@ func LoadConfig() {
|
||||
loadedConfig.Firewall = defaultConfig.Firewall
|
||||
}
|
||||
|
||||
if loadedConfig.TurnServers == nil {
|
||||
loadedConfig.TurnServers = []TurnServer{}
|
||||
}
|
||||
|
||||
config = &loadedConfig
|
||||
|
||||
logging.GetRootLogger().UpdateLogLevel(config.DefaultLogLevel)
|
||||
|
||||
Reference in New Issue
Block a user