mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-11-29 00:23:18 +00:00
41 lines
927 B
Go
41 lines
927 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
const (
|
|
DefaultIdServerPort = 21116
|
|
DefaultRelayServerPort = 21117
|
|
)
|
|
|
|
type Rustdesk struct {
|
|
IdServer string `mapstructure:"id-server"`
|
|
IdServerPort int `mapstructure:"-"`
|
|
RelayServer string `mapstructure:"relay-server"`
|
|
RelayServerPort int `mapstructure:"-"`
|
|
ApiServer string `mapstructure:"api-server"`
|
|
Key string `mapstructure:"key"`
|
|
KeyFile string `mapstructure:"key-file"`
|
|
Personal int `mapstructure:"personal"`
|
|
//webclient-magic-queryonline
|
|
WebclientMagicQueryonline int `mapstructure:"webclient-magic-queryonline"`
|
|
WsHost string `mapstructure:"ws-host"`
|
|
}
|
|
|
|
func (rd *Rustdesk) LoadKeyFile() {
|
|
// Load key file
|
|
if rd.Key != "" {
|
|
return
|
|
}
|
|
if rd.KeyFile != "" {
|
|
// Load key from file
|
|
b, err := os.ReadFile(rd.KeyFile)
|
|
if err != nil {
|
|
return
|
|
}
|
|
rd.Key = string(b)
|
|
return
|
|
}
|
|
}
|