Documentation ¶
Overview ¶
Package config implements reading and writing of the syncthing configuration file.
Index ¶
- func Save(wr io.Writer, cfg Configuration) error
- type Configuration
- type GUIConfiguration
- type InternalParam
- type InternalVersioningConfiguration
- type NodeConfiguration
- type NodeConfigurationList
- type OptionsConfiguration
- type RepositoryConfiguration
- type SyncOrderPattern
- type VersioningConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct { Version int `xml:"version,attr" default:"2"` Repositories []RepositoryConfiguration `xml:"repository"` Nodes []NodeConfiguration `xml:"node"` GUI GUIConfiguration `xml:"gui"` Options OptionsConfiguration `xml:"options"` XMLName xml.Name `xml:"configuration" json:"-"` }
func (*Configuration) NodeMap ¶ added in v0.8.14
func (cfg *Configuration) NodeMap() map[string]NodeConfiguration
func (*Configuration) RepoMap ¶ added in v0.8.14
func (cfg *Configuration) RepoMap() map[string]RepositoryConfiguration
type GUIConfiguration ¶
type InternalParam ¶ added in v0.8.10
type InternalVersioningConfiguration ¶ added in v0.8.10
type InternalVersioningConfiguration struct { Type string `xml:"type,attr,omitempty"` Params []InternalParam `xml:"param"` }
type NodeConfiguration ¶
type NodeConfigurationList ¶
type NodeConfigurationList []NodeConfiguration
func (NodeConfigurationList) Len ¶
func (l NodeConfigurationList) Len() int
func (NodeConfigurationList) Less ¶
func (l NodeConfigurationList) Less(a, b int) bool
func (NodeConfigurationList) Swap ¶
func (l NodeConfigurationList) Swap(a, b int)
type OptionsConfiguration ¶
type OptionsConfiguration struct { ListenAddress []string `xml:"listenAddress" default:"0.0.0.0:22000"` GlobalAnnServer string `xml:"globalAnnounceServer" default:"announce.syncthing.net:22025"` GlobalAnnEnabled bool `xml:"globalAnnounceEnabled" default:"true"` LocalAnnEnabled bool `xml:"localAnnounceEnabled" default:"true"` LocalAnnPort int `xml:"localAnnouncePort" default:"21025"` ParallelRequests int `xml:"parallelRequests" default:"16"` MaxSendKbps int `xml:"maxSendKbps"` RescanIntervalS int `xml:"rescanIntervalS" default:"60"` ReconnectIntervalS int `xml:"reconnectionIntervalS" default:"60"` MaxChangeKbps int `xml:"maxChangeKbps" default:"10000"` StartBrowser bool `xml:"startBrowser" default:"true"` UPnPEnabled bool `xml:"upnpEnabled" default:"true"` URAccepted int `xml:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently) Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"` Deprecated_URDeclined bool `xml:"urDeclined,omitempty" json:"-"` Deprecated_ReadOnly bool `xml:"readOnly,omitempty" json:"-"` Deprecated_GUIEnabled bool `xml:"guiEnabled,omitempty" json:"-"` Deprecated_GUIAddress string `xml:"guiAddress,omitempty" json:"-"` }
type RepositoryConfiguration ¶
type RepositoryConfiguration struct { ID string `xml:"id,attr"` Directory string `xml:"directory,attr"` Nodes []NodeConfiguration `xml:"node"` ReadOnly bool `xml:"ro,attr"` IgnorePerms bool `xml:"ignorePerms,attr"` Invalid string `xml:"-"` // Set at runtime when there is an error, not saved Versioning VersioningConfiguration `xml:"versioning"` SyncOrderPatterns []SyncOrderPattern `xml:"syncorder>pattern"` // contains filtered or unexported fields }
func (RepositoryConfiguration) FileRanker ¶ added in v0.8.14
func (r RepositoryConfiguration) FileRanker() func(scanner.File) int
func (*RepositoryConfiguration) NodeIDs ¶
func (r *RepositoryConfiguration) NodeIDs() []string
type SyncOrderPattern ¶ added in v0.8.14
type SyncOrderPattern struct { Pattern string `xml:"pattern,attr"` Priority int `xml:"priority,attr"` // contains filtered or unexported fields }
SyncOrderPattern allows a user to prioritize file downloading based on a regular expression. If a file matches the Pattern the Priority will be assigned to the file. If a file matches more than one Pattern the Priorities are summed. This allows a user to, for example, prioritize files in a directory, as well as prioritize based on file type. The higher the priority the "sooner" a file will be downloaded. Files can be deprioritized by giving them a negative priority. While Priority is represented as an integer, the expected range is something like -1000 to 1000.
func (*SyncOrderPattern) CompiledPattern ¶ added in v0.8.14
func (s *SyncOrderPattern) CompiledPattern() *regexp.Regexp
type VersioningConfiguration ¶ added in v0.8.10
func (*VersioningConfiguration) MarshalXML ¶ added in v0.8.10
func (c *VersioningConfiguration) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*VersioningConfiguration) UnmarshalXML ¶ added in v0.8.10
func (c *VersioningConfiguration) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error