config

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2014 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config implements reading and writing of the syncthing configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(wr io.Writer, cfg Configuration) error

Types

type Configuration

type Configuration struct {
	Version      int                       `xml:"version,attr" default:"3"`
	Repositories []RepositoryConfiguration `xml:"repository"`
	Nodes        []NodeConfiguration       `xml:"node"`
	GUI          GUIConfiguration          `xml:"gui"`
	Options      OptionsConfiguration      `xml:"options"`
	XMLName      xml.Name                  `xml:"configuration" json:"-"`
}

func Load

func Load(rd io.Reader, myID protocol.NodeID) (Configuration, error)

func (*Configuration) NodeMap

func (cfg *Configuration) NodeMap() map[protocol.NodeID]NodeConfiguration

func (*Configuration) RepoMap

func (cfg *Configuration) RepoMap() map[string]RepositoryConfiguration

type GUIConfiguration

type GUIConfiguration struct {
	Enabled  bool   `xml:"enabled,attr" default:"true"`
	Address  string `xml:"address" default:"127.0.0.1:8080"`
	User     string `xml:"user,omitempty"`
	Password string `xml:"password,omitempty"`
	UseTLS   bool   `xml:"tls,attr"`
	APIKey   string `xml:"apikey,omitempty"`
}

type InternalParam

type InternalParam struct {
	Key string `xml:"key,attr"`
	Val string `xml:"val,attr"`
}

type InternalVersioningConfiguration

type InternalVersioningConfiguration struct {
	Type   string          `xml:"type,attr,omitempty"`
	Params []InternalParam `xml:"param"`
}

type NodeConfiguration

type NodeConfiguration struct {
	NodeID      protocol.NodeID `xml:"id,attr"`
	Name        string          `xml:"name,attr,omitempty"`
	Addresses   []string        `xml:"address,omitempty"`
	Compression bool            `xml:"compression,attr"`
	CertName    string          `xml:"certName,attr,omitempty"`
}

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:22026"`
	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"`
	// contains filtered or unexported fields
}

func (*RepositoryConfiguration) NodeIDs

func (r *RepositoryConfiguration) NodeIDs() []protocol.NodeID

type VersioningConfiguration

type VersioningConfiguration struct {
	Type   string `xml:"type,attr"`
	Params map[string]string
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL