diff --git a/pkg/config/config.go b/pkg/config/config.go index ab23834..521d101 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -19,7 +19,6 @@ const ( ) // Config defines the user-specific information for the transfer. -// In general, it needs to be consistent across all devices of a user. type Config struct { ID string `json:"id"` PSK string `json:"psk"` @@ -42,6 +41,16 @@ func (conf *Config) ApplyDefault() { } } +// Export returns a Config with only the fields that are common to all devices of a user. +func (conf *Config) Export() *Config { + return &Config{ + ID: conf.ID, + PSK: conf.PSK, + Server: conf.Server, + UseIPv6: conf.UseIPv6, + } +} + var configFilename = filepath.Join(userConfigDir(), "acp", "config.json") func Setup(confStr string) (err error) { @@ -71,7 +80,7 @@ func Setup(confStr string) (err error) { } else if err != nil { return err } - confBytes, _ := json.Marshal(&conf) + confBytes, _ := json.Marshal(conf.Export()) confStr = string(confBytes) } conf.ApplyDefault()