optionsconfiguration.go 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. ListenAddress []string `xml:"listenAddress" json:"listenAddress" default:"tcp://0.0.0.0:22000"`
  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. RelayServers []string `xml:"relayServer" json:"relayServers" default:"dynamic+https://relays.syncthing.net/endpoint"`
  15. MaxSendKbps int `xml:"maxSendKbps" json:"maxSendKbps"`
  16. MaxRecvKbps int `xml:"maxRecvKbps" json:"maxRecvKbps"`
  17. ReconnectIntervalS int `xml:"reconnectionIntervalS" json:"reconnectionIntervalS" default:"60"`
  18. RelaysEnabled bool `xml:"relaysEnabled" json:"relaysEnabled" default:"true"`
  19. RelayReconnectIntervalM int `xml:"relayReconnectIntervalM" json:"relayReconnectIntervalM" default:"10"`
  20. StartBrowser bool `xml:"startBrowser" json:"startBrowser" default:"true"`
  21. NATEnabled bool `xml:"natEnabled" json:"natEnabled" default:"true"`
  22. NATLeaseM int `xml:"natLeaseMinutes" json:"natLeaseMinutes" default:"60"`
  23. NATRenewalM int `xml:"natRenewalMinutes" json:"natRenewalMinutes" default:"30"`
  24. NATTimeoutS int `xml:"natTimeoutSeconds" json:"natTimeoutSeconds" default:"10"`
  25. URAccepted int `xml:"urAccepted" json:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently)
  26. URUniqueID string `xml:"urUniqueID" json:"urUniqueId"` // Unique ID for reporting purposes, regenerated when UR is turned on.
  27. URURL string `xml:"urURL" json:"urURL" default:"https://data.syncthing.net/newdata"`
  28. URPostInsecurely bool `xml:"urPostInsecurely" json:"urPostInsecurely" default:"false"` // For testing
  29. URInitialDelayS int `xml:"urInitialDelayS" json:"urInitialDelayS" default:"1800"`
  30. RestartOnWakeup bool `xml:"restartOnWakeup" json:"restartOnWakeup" default:"true"`
  31. AutoUpgradeIntervalH int `xml:"autoUpgradeIntervalH" json:"autoUpgradeIntervalH" default:"12"` // 0 for off
  32. KeepTemporariesH int `xml:"keepTemporariesH" json:"keepTemporariesH" default:"24"` // 0 for off
  33. CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"false"`
  34. ProgressUpdateIntervalS int `xml:"progressUpdateIntervalS" json:"progressUpdateIntervalS" default:"5"`
  35. SymlinksEnabled bool `xml:"symlinksEnabled" json:"symlinksEnabled" default:"true"`
  36. LimitBandwidthInLan bool `xml:"limitBandwidthInLan" json:"limitBandwidthInLan" default:"false"`
  37. MinHomeDiskFreePct float64 `xml:"minHomeDiskFreePct" json:"minHomeDiskFreePct" default:"1"`
  38. ReleasesURL string `xml:"releasesURL" json:"releasesURL" default:"https://api.github.com/repos/syncthing/syncthing/releases?per_page=30"`
  39. AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"`
  40. OverwriteNames bool `xml:"overwriteNames" json:"overwriteNames" default:"false"`
  41. DeprecatedUPnPEnabled bool `xml:"upnpEnabled"`
  42. DeprecatedUPnPLeaseM int `xml:"upnpLeaseMinutes"`
  43. DeprecatedUPnPRenewalM int `xml:"upnpRenewalMinutes"`
  44. DeprecatedUPnPTimeoutS int `xml:"upnpTimeoutSeconds"`
  45. }
  46. func (orig OptionsConfiguration) Copy() OptionsConfiguration {
  47. c := orig
  48. c.ListenAddress = make([]string, len(orig.ListenAddress))
  49. copy(c.ListenAddress, orig.ListenAddress)
  50. c.GlobalAnnServers = make([]string, len(orig.GlobalAnnServers))
  51. copy(c.GlobalAnnServers, orig.GlobalAnnServers)
  52. c.RelayServers = make([]string, len(orig.RelayServers))
  53. copy(c.RelayServers, orig.RelayServers)
  54. c.AlwaysLocalNets = make([]string, len(orig.AlwaysLocalNets))
  55. copy(c.AlwaysLocalNets, orig.AlwaysLocalNets)
  56. return c
  57. }