config.go 657 B

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