optionsconfiguration.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package config
  7. type OptionsConfiguration struct {
  8. ListenAddresses []string `xml:"listenAddress" json:"listenAddresses" default:"default"`
  9. GlobalAnnServers []string `xml:"globalAnnounceServer" json:"globalAnnounceServers" json:"globalAnnounceServer" default:"default"`
  10. GlobalAnnEnabled bool `xml:"globalAnnounceEnabled" json:"globalAnnounceEnabled" default:"true"`
  11. LocalAnnEnabled bool `xml:"localAnnounceEnabled" json:"localAnnounceEnabled" default:"true"`
  12. LocalAnnPort int `xml:"localAnnouncePort" json:"localAnnouncePort" default:"21027"`
  13. LocalAnnMCAddr string `xml:"localAnnounceMCAddr" json:"localAnnounceMCAddr" default:"[ff12::8384]:21027"`
  14. MaxSendKbps int `xml:"maxSendKbps" json:"maxSendKbps"`
  15. MaxRecvKbps int `xml:"maxRecvKbps" json:"maxRecvKbps"`
  16. ReconnectIntervalS int `xml:"reconnectionIntervalS" json:"reconnectionIntervalS" default:"60"`
  17. RelaysEnabled bool `xml:"relaysEnabled" json:"relaysEnabled" default:"true"`
  18. RelayReconnectIntervalM int `xml:"relayReconnectIntervalM" json:"relayReconnectIntervalM" default:"10"`
  19. StartBrowser bool `xml:"startBrowser" json:"startBrowser" default:"true"`
  20. NATEnabled bool `xml:"natEnabled" json:"natEnabled" default:"true"`
  21. NATLeaseM int `xml:"natLeaseMinutes" json:"natLeaseMinutes" default:"60"`
  22. NATRenewalM int `xml:"natRenewalMinutes" json:"natRenewalMinutes" default:"30"`
  23. NATTimeoutS int `xml:"natTimeoutSeconds" json:"natTimeoutSeconds" default:"10"`
  24. URAccepted int `xml:"urAccepted" json:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently)
  25. URUniqueID string `xml:"urUniqueID" json:"urUniqueId"` // Unique ID for reporting purposes, regenerated when UR is turned on.
  26. URURL string `xml:"urURL" json:"urURL" default:"https://data.syncthing.net/newdata"`
  27. URPostInsecurely bool `xml:"urPostInsecurely" json:"urPostInsecurely" default:"false"` // For testing
  28. URInitialDelayS int `xml:"urInitialDelayS" json:"urInitialDelayS" default:"1800"`
  29. RestartOnWakeup bool `xml:"restartOnWakeup" json:"restartOnWakeup" default:"true"`
  30. AutoUpgradeIntervalH int `xml:"autoUpgradeIntervalH" json:"autoUpgradeIntervalH" default:"12"` // 0 for off
  31. KeepTemporariesH int `xml:"keepTemporariesH" json:"keepTemporariesH" default:"24"` // 0 for off
  32. CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"false"`
  33. ProgressUpdateIntervalS int `xml:"progressUpdateIntervalS" json:"progressUpdateIntervalS" default:"5"`
  34. SymlinksEnabled bool `xml:"symlinksEnabled" json:"symlinksEnabled" default:"true"`
  35. LimitBandwidthInLan bool `xml:"limitBandwidthInLan" json:"limitBandwidthInLan" default:"false"`
  36. MinHomeDiskFreePct float64 `xml:"minHomeDiskFreePct" json:"minHomeDiskFreePct" default:"1"`
  37. ReleasesURL string `xml:"releasesURL" json:"releasesURL" default:"https://upgrades.syncthing.net/meta.json"`
  38. AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"`
  39. OverwriteRemoteDevNames bool `xml:"overwriteRemoteDeviceNamesOnConnect" json:"overwriteRemoteDeviceNamesOnConnect" default:"false"`
  40. TempIndexMinBlocks int `xml:"tempIndexMinBlocks" json:"tempIndexMinBlocks" default:"10"`
  41. DeprecatedUPnPEnabled bool `xml:"upnpEnabled,omitempty" json:"-"`
  42. DeprecatedUPnPLeaseM int `xml:"upnpLeaseMinutes,omitempty" json:"-"`
  43. DeprecatedUPnPRenewalM int `xml:"upnpRenewalMinutes,omitempty" json:"-"`
  44. DeprecatedUPnPTimeoutS int `xml:"upnpTimeoutSeconds,omitempty" json:"-"`
  45. DeprecatedRelayServers []string `xml:"relayServer,omitempty" json:"-"`
  46. }
  47. func (orig OptionsConfiguration) Copy() OptionsConfiguration {
  48. c := orig
  49. c.ListenAddresses = make([]string, len(orig.ListenAddresses))
  50. copy(c.ListenAddresses, orig.ListenAddresses)
  51. c.GlobalAnnServers = make([]string, len(orig.GlobalAnnServers))
  52. copy(c.GlobalAnnServers, orig.GlobalAnnServers)
  53. c.AlwaysLocalNets = make([]string, len(orig.AlwaysLocalNets))
  54. copy(c.AlwaysLocalNets, orig.AlwaysLocalNets)
  55. return c
  56. }