vconfig.go 672 B

12345678910111213141516171819202122232425262728
  1. package core
  2. import (
  3. "encoding/json"
  4. )
  5. // VUser is the user account that is used for connection to a VPoint
  6. type VUser struct {
  7. Id VID `json:"id"` // The ID of this VUser.
  8. }
  9. type VConnectionConfig struct {
  10. Protocol string `json:"protocol"`
  11. File string `json:"file"`
  12. }
  13. // VConfig is the config for VPoint server.
  14. type VConfig struct {
  15. Port uint16 `json:"port"` // Port of this VPoint server.
  16. InboundConfig VConnectionConfig `json:"inbound"`
  17. OutboundConfig VConnectionConfig `json:"outbound"`
  18. }
  19. func LoadVConfig(rawConfig []byte) (VConfig, error) {
  20. config := VConfig{}
  21. err := json.Unmarshal(rawConfig, &config)
  22. return config, err
  23. }