Documentation ¶
Overview ¶
Package config implements reading and writing of the syncthing configuration file.
Index ¶
- Constants
- Variables
- type Committer
- type Configuration
- type DeviceConfiguration
- type DeviceConfigurationList
- type FolderConfiguration
- func (f *FolderConfiguration) CheckFreeSpace() (err error)
- func (f *FolderConfiguration) CheckPath() error
- func (f FolderConfiguration) Copy() FolderConfiguration
- func (f *FolderConfiguration) CreateMarker() error
- func (f *FolderConfiguration) CreateRoot() (err error)
- func (f FolderConfiguration) Description() string
- func (f *FolderConfiguration) DeviceIDs() []protocol.DeviceID
- func (f FolderConfiguration) Filesystem() fs.Filesystem
- type FolderDeviceConfiguration
- type FolderDeviceConfigurationList
- type FolderType
- type GUIConfiguration
- type InternalParam
- type InternalVersioningConfiguration
- type OptionsConfiguration
- type PullOrder
- type Size
- type VersioningConfiguration
- type WeakHashSelectionMethod
- func (m WeakHashSelectionMethod) MarshalJSON() ([]byte, error)
- func (m WeakHashSelectionMethod) MarshalString() (string, error)
- func (m WeakHashSelectionMethod) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (WeakHashSelectionMethod) ParseDefault(value string) (interface{}, error)
- func (m WeakHashSelectionMethod) String() string
- func (m *WeakHashSelectionMethod) UnmarshalJSON(data []byte) error
- func (m *WeakHashSelectionMethod) UnmarshalString(value string) error
- func (m *WeakHashSelectionMethod) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Wrapper
- func (w *Wrapper) CheckHomeFreeSpace() error
- func (w *Wrapper) ConfigPath() string
- func (w *Wrapper) Device(id protocol.DeviceID) (DeviceConfiguration, bool)
- func (w *Wrapper) Devices() map[protocol.DeviceID]DeviceConfiguration
- func (w *Wrapper) Folder(id string) (FolderConfiguration, bool)
- func (w *Wrapper) Folders() map[string]FolderConfiguration
- func (w *Wrapper) GUI() GUIConfiguration
- func (w *Wrapper) GlobalDiscoveryServers() []string
- func (w *Wrapper) IgnoredDevice(id protocol.DeviceID) bool
- func (w *Wrapper) IgnoredFolder(folder string) bool
- func (w *Wrapper) ListenAddresses() []string
- func (w *Wrapper) MyName() string
- func (w *Wrapper) Options() OptionsConfiguration
- func (w *Wrapper) RawCopy() Configuration
- func (w *Wrapper) RemoveDevice(id protocol.DeviceID) error
- func (w *Wrapper) Replace(cfg Configuration) error
- func (w *Wrapper) ReplaceBlocking(cfg Configuration) error
- func (w *Wrapper) RequiresRestart() bool
- func (w *Wrapper) Save() error
- func (w *Wrapper) SetDevice(dev DeviceConfiguration) error
- func (w *Wrapper) SetDevices(devs []DeviceConfiguration) error
- func (w *Wrapper) SetFolder(fld FolderConfiguration) error
- func (w *Wrapper) SetGUI(gui GUIConfiguration) error
- func (w *Wrapper) SetOptions(opts OptionsConfiguration) error
- func (w *Wrapper) Stop()
- func (w *Wrapper) StunServers() []string
- func (w *Wrapper) Subscribe(c Committer)
- func (w *Wrapper) Unsubscribe(c Committer)
Constants ¶
const ( OldestHandledVersion = 10 CurrentVersion = 25 MaxRescanIntervalS = 365 * 24 * 60 * 60 )
Variables ¶
var ( // DefaultTCPPort defines default TCP port used if the URI does not specify one, for example tcp://0.0.0.0 DefaultTCPPort = 22000 // DefaultKCPPort defines default KCP (UDP) port used if the URI does not specify one, for example kcp://0.0.0.0 DefaultKCPPort = 22020 // DefaultListenAddresses should be substituted when the configuration // contains <listenAddress>default</listenAddress>. This is done by the // "consumer" of the configuration as we don't want these saved to the // config. DefaultListenAddresses = []string{ util.Address("tcp", net.JoinHostPort("0.0.0.0", strconv.Itoa(DefaultTCPPort))), "dynamic+https://relays.syncthing.net/endpoint", util.Address("kcp", net.JoinHostPort("0.0.0.0", strconv.Itoa(DefaultKCPPort))), } // DefaultDiscoveryServersV4 should be substituted when the configuration // contains <globalAnnounceServer>default-v4</globalAnnounceServer>. DefaultDiscoveryServersV4 = []string{ "https://discovery-v4-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC", "https://discovery-v4-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ", "https://discovery-v4-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW", } // DefaultDiscoveryServersV6 should be substituted when the configuration // contains <globalAnnounceServer>default-v6</globalAnnounceServer>. DefaultDiscoveryServersV6 = []string{ "https://discovery-v6-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC", "https://discovery-v6-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ", "https://discovery-v6-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW", } // DefaultDiscoveryServers should be substituted when the configuration // contains <globalAnnounceServer>default</globalAnnounceServer>. DefaultDiscoveryServers = append(DefaultDiscoveryServersV4, DefaultDiscoveryServersV6...) // DefaultStunServers should be substituted when the configuration // contains <stunServer>default</stunServer>. DefaultStunServers = []string{ "stun.callwithus.com:3478", "stun.counterpath.com:3478", "stun.counterpath.net:3478", "stun.ekiga.net:3478", "stun.ideasip.com:3478", "stun.internetcalls.com:3478", "stun.schlund.de:3478", "stun.sipgate.net:10000", "stun.sipgate.net:3478", "stun.voip.aebc.com:3478", "stun.voiparound.com:3478", "stun.voipbuster.com:3478", "stun.voipstunt.com:3478", "stun.voxgratia.org:3478", "stun.xten.com:3478", } // DefaultTheme is the default and fallback theme for the web UI. DefaultTheme = "default" )
Functions ¶
This section is empty.
Types ¶
type Committer ¶
type Committer interface { VerifyConfiguration(from, to Configuration) error CommitConfiguration(from, to Configuration) (handled bool) String() string }
The Committer interface is implemented by objects that need to know about or have a say in configuration changes.
When the configuration is about to be changed, VerifyConfiguration() is called for each subscribing object, with the old and new configuration. A nil error is returned if the new configuration is acceptable (i.e. does not contain any errors that would prevent it from being a valid config). Otherwise an error describing the problem is returned.
If any subscriber returns an error from VerifyConfiguration(), the configuration change is not committed and an error is returned to whoever tried to commit the broken config.
If all verification calls returns nil, CommitConfiguration() is called for each subscribing object. The callee returns true if the new configuration has been successfully applied, otherwise false. Any Commit() call returning false will result in a "restart needed" response to the API/user. Note that the new configuration will still have been applied by those who were capable of doing so.
type Configuration ¶
type Configuration struct { Version int `xml:"version,attr" json:"version"` Folders []FolderConfiguration `xml:"folder" json:"folders"` Devices []DeviceConfiguration `xml:"device" json:"devices"` GUI GUIConfiguration `xml:"gui" json:"gui"` Options OptionsConfiguration `xml:"options" json:"options"` IgnoredDevices []protocol.DeviceID `xml:"ignoredDevice" json:"ignoredDevices"` IgnoredFolders []string `xml:"ignoredFolder" json:"ignoredFolders"` XMLName xml.Name `xml:"configuration" json:"-"` MyID protocol.DeviceID `xml:"-" json:"-"` // Provided by the instantiator. OriginalVersion int `xml:"-" json:"-"` // The version we read from disk, before any conversion }
func New ¶
func New(myID protocol.DeviceID) Configuration
func (Configuration) Copy ¶
func (cfg Configuration) Copy() Configuration
type DeviceConfiguration ¶
type DeviceConfiguration struct { DeviceID protocol.DeviceID `xml:"id,attr" json:"deviceID"` Name string `xml:"name,attr,omitempty" json:"name"` Addresses []string `xml:"address,omitempty" json:"addresses"` Compression protocol.Compression `xml:"compression,attr" json:"compression"` CertName string `xml:"certName,attr,omitempty" json:"certName"` Introducer bool `xml:"introducer,attr" json:"introducer"` SkipIntroductionRemovals bool `xml:"skipIntroductionRemovals,attr" json:"skipIntroductionRemovals"` IntroducedBy protocol.DeviceID `xml:"introducedBy,attr" json:"introducedBy"` Paused bool `xml:"paused" json:"paused"` AllowedNetworks []string `xml:"allowedNetwork,omitempty" json:"allowedNetworks"` }
func NewDeviceConfiguration ¶ added in v0.12.2
func NewDeviceConfiguration(id protocol.DeviceID, name string) DeviceConfiguration
func (DeviceConfiguration) Copy ¶
func (cfg DeviceConfiguration) Copy() DeviceConfiguration
type DeviceConfigurationList ¶
type DeviceConfigurationList []DeviceConfiguration
func (DeviceConfigurationList) Len ¶
func (l DeviceConfigurationList) Len() int
func (DeviceConfigurationList) Less ¶
func (l DeviceConfigurationList) Less(a, b int) bool
func (DeviceConfigurationList) Swap ¶
func (l DeviceConfigurationList) Swap(a, b int)
type FolderConfiguration ¶
type FolderConfiguration struct { ID string `xml:"id,attr" json:"id"` Label string `xml:"label,attr" json:"label"` FilesystemType fs.FilesystemType `xml:"filesystemType" json:"filesystemType"` Path string `xml:"path,attr" json:"path"` Type FolderType `xml:"type,attr" json:"type"` Devices []FolderDeviceConfiguration `xml:"device" json:"devices"` RescanIntervalS int `xml:"rescanIntervalS,attr" json:"rescanIntervalS"` FSWatcherEnabled bool `xml:"fsWatcherEnabled,attr" json:"fsWatcherEnabled"` FSWatcherDelayS int `xml:"fsWatcherDelayS,attr" json:"fsWatcherDelayS"` IgnorePerms bool `xml:"ignorePerms,attr" json:"ignorePerms"` AutoNormalize bool `xml:"autoNormalize,attr" json:"autoNormalize"` MinDiskFree Size `xml:"minDiskFree" json:"minDiskFree"` Versioning VersioningConfiguration `xml:"versioning" json:"versioning"` Copiers int `xml:"copiers" json:"copiers"` // This defines how many files are handled concurrently. Pullers int `xml:"pullers" json:"pullers"` // Defines how many blocks are fetched at the same time, possibly between separate copier routines. Hashers int `xml:"hashers" json:"hashers"` // Less than one sets the value to the number of cores. These are CPU bound due to hashing. Order PullOrder `xml:"order" json:"order"` IgnoreDelete bool `xml:"ignoreDelete" json:"ignoreDelete"` ScanProgressIntervalS int `xml:"scanProgressIntervalS" json:"scanProgressIntervalS"` // Set to a negative value to disable. Value of 0 will get replaced with value of 2 (default value) PullerSleepS int `xml:"pullerSleepS" json:"pullerSleepS"` PullerPauseS int `xml:"pullerPauseS" json:"pullerPauseS"` MaxConflicts int `xml:"maxConflicts" json:"maxConflicts"` DisableSparseFiles bool `xml:"disableSparseFiles" json:"disableSparseFiles"` DisableTempIndexes bool `xml:"disableTempIndexes" json:"disableTempIndexes"` Paused bool `xml:"paused" json:"paused"` WeakHashThresholdPct int `xml:"weakHashThresholdPct" json:"weakHashThresholdPct"` // Use weak hash if more than X percent of the file has changed. Set to -1 to always use weak hash. DeprecatedReadOnly bool `xml:"ro,attr,omitempty" json:"-"` DeprecatedMinDiskFreePct float64 `xml:"minDiskFreePct,omitempty" json:"-"` // contains filtered or unexported fields }
func NewFolderConfiguration ¶ added in v0.12.2
func NewFolderConfiguration(id string, fsType fs.FilesystemType, path string) FolderConfiguration
func (*FolderConfiguration) CheckFreeSpace ¶ added in v0.14.40
func (f *FolderConfiguration) CheckFreeSpace() (err error)
func (*FolderConfiguration) CheckPath ¶ added in v0.14.40
func (f *FolderConfiguration) CheckPath() error
CheckPath returns nil if the folder root exists and contains the marker file
func (FolderConfiguration) Copy ¶
func (f FolderConfiguration) Copy() FolderConfiguration
func (*FolderConfiguration) CreateMarker ¶
func (f *FolderConfiguration) CreateMarker() error
func (*FolderConfiguration) CreateRoot ¶ added in v0.14.28
func (f *FolderConfiguration) CreateRoot() (err error)
func (FolderConfiguration) Description ¶ added in v0.14.12
func (f FolderConfiguration) Description() string
func (*FolderConfiguration) DeviceIDs ¶
func (f *FolderConfiguration) DeviceIDs() []protocol.DeviceID
func (FolderConfiguration) Filesystem ¶ added in v0.14.37
func (f FolderConfiguration) Filesystem() fs.Filesystem
type FolderDeviceConfigurationList ¶
type FolderDeviceConfigurationList []FolderDeviceConfiguration
func (FolderDeviceConfigurationList) Len ¶
func (l FolderDeviceConfigurationList) Len() int
func (FolderDeviceConfigurationList) Less ¶
func (l FolderDeviceConfigurationList) Less(a, b int) bool
func (FolderDeviceConfigurationList) Swap ¶
func (l FolderDeviceConfigurationList) Swap(a, b int)
type FolderType ¶ added in v0.13.0
type FolderType int
const ( FolderTypeSendReceive FolderType = iota // default is sendreceive FolderTypeSendOnly )
func (FolderType) MarshalText ¶ added in v0.13.0
func (t FolderType) MarshalText() ([]byte, error)
func (FolderType) String ¶ added in v0.13.0
func (t FolderType) String() string
func (*FolderType) UnmarshalText ¶ added in v0.13.0
func (t *FolderType) UnmarshalText(bs []byte) error
type GUIConfiguration ¶
type GUIConfiguration struct { Enabled bool `xml:"enabled,attr" json:"enabled" default:"true"` RawAddress string `xml:"address" json:"address" default:"127.0.0.1:8384"` User string `xml:"user,omitempty" json:"user"` Password string `xml:"password,omitempty" json:"password"` RawUseTLS bool `xml:"tls,attr" json:"useTLS"` APIKey string `xml:"apikey,omitempty" json:"apiKey"` InsecureAdminAccess bool `xml:"insecureAdminAccess,omitempty" json:"insecureAdminAccess"` Theme string `xml:"theme" json:"theme" default:"default"` Debugging bool `xml:"debugging,attr" json:"debugging"` InsecureSkipHostCheck bool `xml:"insecureSkipHostcheck,omitempty" json:"insecureSkipHostcheck"` InsecureAllowFrameLoading bool `xml:"insecureAllowFrameLoading,omitempty" json:"insecureAllowFrameLoading"` }
func (GUIConfiguration) Address ¶
func (c GUIConfiguration) Address() string
func (GUIConfiguration) IsValidAPIKey ¶ added in v0.12.18
func (c GUIConfiguration) IsValidAPIKey(apiKey string) bool
IsValidAPIKey returns true when the given API key is valid, including both the value in config and any overrides
func (GUIConfiguration) URL ¶ added in v0.12.0
func (c GUIConfiguration) URL() string
func (GUIConfiguration) UseTLS ¶
func (c GUIConfiguration) UseTLS() bool
type InternalParam ¶
type InternalVersioningConfiguration ¶
type InternalVersioningConfiguration struct { Type string `xml:"type,attr,omitempty"` Params []InternalParam `xml:"param"` }
type OptionsConfiguration ¶
type OptionsConfiguration struct { ListenAddresses []string `xml:"listenAddress" json:"listenAddresses" default:"default"` GlobalAnnServers []string `xml:"globalAnnounceServer" json:"globalAnnounceServers" json:"globalAnnounceServer" default:"default"` GlobalAnnEnabled bool `xml:"globalAnnounceEnabled" json:"globalAnnounceEnabled" default:"true"` LocalAnnEnabled bool `xml:"localAnnounceEnabled" json:"localAnnounceEnabled" default:"true"` LocalAnnPort int `xml:"localAnnouncePort" json:"localAnnouncePort" default:"21027"` LocalAnnMCAddr string `xml:"localAnnounceMCAddr" json:"localAnnounceMCAddr" default:"[ff12::8384]:21027"` MaxSendKbps int `xml:"maxSendKbps" json:"maxSendKbps"` MaxRecvKbps int `xml:"maxRecvKbps" json:"maxRecvKbps"` ReconnectIntervalS int `xml:"reconnectionIntervalS" json:"reconnectionIntervalS" default:"60"` RelaysEnabled bool `xml:"relaysEnabled" json:"relaysEnabled" default:"true"` RelayReconnectIntervalM int `xml:"relayReconnectIntervalM" json:"relayReconnectIntervalM" default:"10"` StartBrowser bool `xml:"startBrowser" json:"startBrowser" default:"true"` NATEnabled bool `xml:"natEnabled" json:"natEnabled" default:"true"` NATLeaseM int `xml:"natLeaseMinutes" json:"natLeaseMinutes" default:"60"` NATRenewalM int `xml:"natRenewalMinutes" json:"natRenewalMinutes" default:"30"` NATTimeoutS int `xml:"natTimeoutSeconds" json:"natTimeoutSeconds" default:"10"` URAccepted int `xml:"urAccepted" json:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently) URSeen int `xml:"urSeen" json:"urSeen"` // Report which the user has been prompted for. URUniqueID string `xml:"urUniqueID" json:"urUniqueId"` // Unique ID for reporting purposes, regenerated when UR is turned on. URURL string `xml:"urURL" json:"urURL" default:"https://data.syncthing.net/newdata"` URPostInsecurely bool `xml:"urPostInsecurely" json:"urPostInsecurely" default:"false"` // For testing URInitialDelayS int `xml:"urInitialDelayS" json:"urInitialDelayS" default:"1800"` RestartOnWakeup bool `xml:"restartOnWakeup" json:"restartOnWakeup" default:"true"` AutoUpgradeIntervalH int `xml:"autoUpgradeIntervalH" json:"autoUpgradeIntervalH" default:"12"` // 0 for off UpgradeToPreReleases bool `xml:"upgradeToPreReleases" json:"upgradeToPreReleases"` // when auto upgrades are enabled KeepTemporariesH int `xml:"keepTemporariesH" json:"keepTemporariesH" default:"24"` // 0 for off CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"false"` ProgressUpdateIntervalS int `xml:"progressUpdateIntervalS" json:"progressUpdateIntervalS" default:"5"` LimitBandwidthInLan bool `xml:"limitBandwidthInLan" json:"limitBandwidthInLan" default:"false"` MinHomeDiskFree Size `xml:"minHomeDiskFree" json:"minHomeDiskFree" default:"1 %"` ReleasesURL string `xml:"releasesURL" json:"releasesURL" default:"https://upgrades.syncthing.net/meta.json"` AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"` OverwriteRemoteDevNames bool `xml:"overwriteRemoteDeviceNamesOnConnect" json:"overwriteRemoteDeviceNamesOnConnect" default:"false"` TempIndexMinBlocks int `xml:"tempIndexMinBlocks" json:"tempIndexMinBlocks" default:"10"` UnackedNotificationIDs []string `xml:"unackedNotificationID" json:"unackedNotificationIDs"` TrafficClass int `xml:"trafficClass" json:"trafficClass"` WeakHashSelectionMethod WeakHashSelectionMethod `xml:"weakHashSelectionMethod" json:"weakHashSelectionMethod"` StunServers []string `xml:"stunServer" json:"stunServers" default:"default"` StunKeepaliveS int `xml:"stunKeepaliveSeconds" json:"stunKeepaliveSeconds" default:"24"` KCPNoDelay bool `xml:"kcpNoDelay" json:"kcpNoDelay" default:"false"` KCPUpdateIntervalMs int `xml:"kcpUpdateIntervalMs" json:"kcpUpdateIntervalMs" default:"25"` KCPFastResend bool `xml:"kcpFastResend" json:"kcpFastResend" default:"false"` KCPCongestionControl bool `xml:"kcpCongestionControl" json:"kcpCongestionControl" default:"true"` KCPSendWindowSize int `xml:"kcpSendWindowSize" json:"kcpSendWindowSize" default:"128"` KCPReceiveWindowSize int `xml:"kcpReceiveWindowSize" json:"kcpReceiveWindowSize" default:"128"` DefaultFolderPath string `xml:"defaultFolderPath" json:"defaultFolderPath" default:"~"` DeprecatedUPnPEnabled bool `xml:"upnpEnabled,omitempty" json:"-"` DeprecatedUPnPLeaseM int `xml:"upnpLeaseMinutes,omitempty" json:"-"` DeprecatedUPnPRenewalM int `xml:"upnpRenewalMinutes,omitempty" json:"-"` DeprecatedUPnPTimeoutS int `xml:"upnpTimeoutSeconds,omitempty" json:"-"` DeprecatedRelayServers []string `xml:"relayServer,omitempty" json:"-"` DeprecatedMinHomeDiskFreePct float64 `xml:"minHomeDiskFreePct" json:"-"` }
func (OptionsConfiguration) Copy ¶
func (orig OptionsConfiguration) Copy() OptionsConfiguration
type PullOrder ¶
type PullOrder int
func (PullOrder) MarshalText ¶
func (*PullOrder) UnmarshalText ¶
type Size ¶ added in v0.14.28
type Size struct { Value float64 `json:"value" xml:",chardata"` Unit string `json:"unit" xml:"unit,attr"` }
func (Size) ParseDefault ¶ added in v0.14.28
func (Size) Percentage ¶ added in v0.14.28
type VersioningConfiguration ¶
type VersioningConfiguration struct { Type string `xml:"type,attr" json:"type"` Params map[string]string `json:"params"` }
func (VersioningConfiguration) Copy ¶ added in v0.12.0
func (c VersioningConfiguration) Copy() VersioningConfiguration
func (*VersioningConfiguration) MarshalXML ¶
func (c *VersioningConfiguration) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*VersioningConfiguration) UnmarshalXML ¶
func (c *VersioningConfiguration) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type WeakHashSelectionMethod ¶ added in v0.14.22
type WeakHashSelectionMethod int
const ( WeakHashAuto WeakHashSelectionMethod = iota WeakHashAlways WeakHashNever )
func (WeakHashSelectionMethod) MarshalJSON ¶ added in v0.14.22
func (m WeakHashSelectionMethod) MarshalJSON() ([]byte, error)
func (WeakHashSelectionMethod) MarshalString ¶ added in v0.14.22
func (m WeakHashSelectionMethod) MarshalString() (string, error)
func (WeakHashSelectionMethod) MarshalXML ¶ added in v0.14.22
func (m WeakHashSelectionMethod) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (WeakHashSelectionMethod) ParseDefault ¶ added in v0.14.22
func (WeakHashSelectionMethod) ParseDefault(value string) (interface{}, error)
func (WeakHashSelectionMethod) String ¶ added in v0.14.22
func (m WeakHashSelectionMethod) String() string
func (*WeakHashSelectionMethod) UnmarshalJSON ¶ added in v0.14.22
func (m *WeakHashSelectionMethod) UnmarshalJSON(data []byte) error
func (*WeakHashSelectionMethod) UnmarshalString ¶ added in v0.14.22
func (m *WeakHashSelectionMethod) UnmarshalString(value string) error
func (*WeakHashSelectionMethod) UnmarshalXML ¶ added in v0.14.22
func (m *WeakHashSelectionMethod) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
func Wrap ¶
func Wrap(path string, cfg Configuration) *Wrapper
Wrap wraps an existing Configuration structure and ties it to a file on disk.
func (*Wrapper) CheckHomeFreeSpace ¶ added in v0.14.40
CheckHomeFreeSpace returns nil if the home disk has the required amount of free space, or if home disk free space checking is disabled.
func (*Wrapper) ConfigPath ¶
func (*Wrapper) Device ¶ added in v0.14.4
func (w *Wrapper) Device(id protocol.DeviceID) (DeviceConfiguration, bool)
Device returns the configuration for the given device and an "ok" bool.
func (*Wrapper) Devices ¶
func (w *Wrapper) Devices() map[protocol.DeviceID]DeviceConfiguration
Devices returns a map of devices. Device structures should not be changed, other than for the purpose of updating via SetDevice().
func (*Wrapper) Folder ¶ added in v0.14.17
func (w *Wrapper) Folder(id string) (FolderConfiguration, bool)
Folder returns the configuration for the given folder and an "ok" bool.
func (*Wrapper) Folders ¶
func (w *Wrapper) Folders() map[string]FolderConfiguration
Folders returns a map of folders. Folder structures should not be changed, other than for the purpose of updating via SetFolder().
func (*Wrapper) GUI ¶
func (w *Wrapper) GUI() GUIConfiguration
GUI returns the current GUI configuration object.
func (*Wrapper) GlobalDiscoveryServers ¶ added in v0.12.0
func (*Wrapper) IgnoredDevice ¶
IgnoredDevice returns whether or not connection attempts from the given device should be silently ignored.
func (*Wrapper) IgnoredFolder ¶ added in v0.14.30
IgnoredFolder returns whether or not share attempts for the given folder should be silently ignored.
func (*Wrapper) ListenAddresses ¶ added in v0.13.0
func (*Wrapper) Options ¶
func (w *Wrapper) Options() OptionsConfiguration
Options returns the current options configuration object.
func (*Wrapper) RawCopy ¶ added in v0.14.11
func (w *Wrapper) RawCopy() Configuration
RawCopy returns a copy of the currently wrapped Configuration object.
func (*Wrapper) RemoveDevice ¶ added in v0.14.12
RemoveDevice removes the device from the configuration
func (*Wrapper) Replace ¶
func (w *Wrapper) Replace(cfg Configuration) error
Replace swaps the current configuration object for the given one.
func (*Wrapper) ReplaceBlocking ¶ added in v0.14.40
func (w *Wrapper) ReplaceBlocking(cfg Configuration) error
ReplaceBlocking swaps the current configuration object for the given one, and waits for subscribers to be notified.
func (*Wrapper) RequiresRestart ¶ added in v0.14.0
func (*Wrapper) SetDevice ¶
func (w *Wrapper) SetDevice(dev DeviceConfiguration) error
SetDevice adds a new device to the configuration, or overwrites an existing device with the same ID.
func (*Wrapper) SetDevices ¶ added in v0.14.25
func (w *Wrapper) SetDevices(devs []DeviceConfiguration) error
SetDevices adds new devices to the configuration, or overwrites existing devices with the same ID.
func (*Wrapper) SetFolder ¶
func (w *Wrapper) SetFolder(fld FolderConfiguration) error
SetFolder adds a new folder to the configuration, or overwrites an existing folder with the same ID.
func (*Wrapper) SetGUI ¶
func (w *Wrapper) SetGUI(gui GUIConfiguration) error
SetGUI replaces the current GUI configuration object.
func (*Wrapper) SetOptions ¶
func (w *Wrapper) SetOptions(opts OptionsConfiguration) error
SetOptions replaces the current options configuration object.
func (*Wrapper) Stop ¶
func (w *Wrapper) Stop()
Stop stops the Serve() loop. Set and Replace operations will panic after a Stop.
func (*Wrapper) StunServers ¶ added in v0.14.25
func (*Wrapper) Subscribe ¶
Subscribe registers the given handler to be called on any future configuration changes.
func (*Wrapper) Unsubscribe ¶ added in v0.12.0
Unsubscribe de-registers the given handler from any future calls to configuration changes