Files
2015-03-14 03:40:18 +11:00

29 lines
425 B
Go

package chisel
import (
"encoding/json"
"fmt"
)
type Config struct {
Version string
Auth string
Server string
Remotes []*Remote
}
const ConfigPrefix = "chisel"
func DecodeConfig(b []byte) (*Config, error) {
c := &Config{}
err := json.Unmarshal(b, c)
if err != nil {
return nil, fmt.Errorf("Invalid JSON config")
}
return c, nil
}
func EncodeConfig(c *Config) ([]byte, error) {
return json.Marshal(c)
}