2015-09-12 16:11:54 -04:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
)
|
|
|
|
|
|
|
|
// User is the user account that is used for connection to a Point
|
|
|
|
type User struct {
|
|
|
|
Id ID `json:"id"` // The ID of this User.
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConnectionConfig struct {
|
|
|
|
Protocol string `json:"protocol"`
|
|
|
|
File string `json:"file"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Config is the config for Point server.
|
|
|
|
type Config struct {
|
2015-09-13 14:01:50 -04:00
|
|
|
Port uint16 `json:"port"` // Port of this Point server.
|
2015-09-12 16:11:54 -04:00
|
|
|
InboundConfig ConnectionConfig `json:"inbound"`
|
|
|
|
OutboundConfig ConnectionConfig `json:"outbound"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func LoadConfig(rawConfig []byte) (Config, error) {
|
|
|
|
config := Config{}
|
|
|
|
err := json.Unmarshal(rawConfig, &config)
|
|
|
|
return config, err
|
|
|
|
}
|