rustdesk.go 707 B

123456789101112131415161718192021222324252627282930313233
  1. package config
  2. import (
  3. "os"
  4. )
  5. type Rustdesk struct {
  6. IdServer string `mapstructure:"id-server"`
  7. RelayServer string `mapstructure:"relay-server"`
  8. ApiServer string `mapstructure:"api-server"`
  9. Key string `mapstructure:"key"`
  10. KeyFile string `mapstructure:"key-file"`
  11. Personal int `mapstructure:"personal"`
  12. //webclient-magic-queryonline
  13. WebclientMagicQueryonline int `mapstructure:"webclient-magic-queryonline"`
  14. }
  15. func LoadKeyFile(rustdesk *Rustdesk) {
  16. // Load key file
  17. if rustdesk.Key != "" {
  18. return
  19. }
  20. if rustdesk.KeyFile != "" {
  21. // Load key from file
  22. b, err := os.ReadFile(rustdesk.KeyFile)
  23. if err != nil {
  24. return
  25. }
  26. rustdesk.Key = string(b)
  27. return
  28. }
  29. }