rustdesk.go 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package config
  2. import (
  3. "os"
  4. )
  5. const (
  6. DefaultIdServerPort = 21116
  7. DefaultRelayServerPort = 21117
  8. )
  9. type Rustdesk struct {
  10. IdServer string `mapstructure:"id-server"`
  11. IdServerPort int `mapstructure:"-"`
  12. RelayServer string `mapstructure:"relay-server"`
  13. RelayServerPort int `mapstructure:"-"`
  14. ApiServer string `mapstructure:"api-server"`
  15. Key string `mapstructure:"key"`
  16. KeyFile string `mapstructure:"key-file"`
  17. Personal int `mapstructure:"personal"`
  18. //webclient-magic-queryonline
  19. WebclientMagicQueryonline int `mapstructure:"webclient-magic-queryonline"`
  20. WsHost string `mapstructure:"ws-host"`
  21. }
  22. func (rd *Rustdesk) LoadKeyFile() {
  23. // Load key file
  24. if rd.Key != "" {
  25. return
  26. }
  27. if rd.KeyFile != "" {
  28. // Load key from file
  29. b, err := os.ReadFile(rd.KeyFile)
  30. if err != nil {
  31. return
  32. }
  33. rd.Key = string(b)
  34. return
  35. }
  36. }