Compare commits
9
Commits
058bcd7334
...
v0.9.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ce8261d89 | ||
|
|
25c080b46f | ||
|
|
ee765990b7 | ||
|
|
77fcb52b6a | ||
|
|
aaec3330a9 | ||
|
|
3f55a885a1 | ||
|
|
80a1c931a9 | ||
|
|
a147f4bb77 | ||
|
|
e4316aec6e |
@@ -67,75 +67,62 @@ func main() {
|
|||||||
|
|
||||||
checkRequiredGoVersion()
|
checkRequiredGoVersion()
|
||||||
|
|
||||||
if check() != nil {
|
|
||||||
setup()
|
|
||||||
}
|
|
||||||
|
|
||||||
if flag.NArg() == 0 {
|
if flag.NArg() == 0 {
|
||||||
install("./cmd/...")
|
install("./cmd/...")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch flag.Arg(0) {
|
for _, cmd := range flag.Args() {
|
||||||
case "install":
|
switch cmd {
|
||||||
pkg := "./cmd/..."
|
case "setup":
|
||||||
if flag.NArg() > 2 {
|
setup()
|
||||||
pkg = flag.Arg(1)
|
|
||||||
|
case "install":
|
||||||
|
pkg := "./cmd/..."
|
||||||
|
install(pkg)
|
||||||
|
|
||||||
|
case "build":
|
||||||
|
pkg := "./cmd/syncthing"
|
||||||
|
var tags []string
|
||||||
|
if noupgrade {
|
||||||
|
tags = []string{"noupgrade"}
|
||||||
|
}
|
||||||
|
build(pkg, tags)
|
||||||
|
|
||||||
|
case "test":
|
||||||
|
pkg := "./..."
|
||||||
|
test(pkg)
|
||||||
|
|
||||||
|
case "assets":
|
||||||
|
assets()
|
||||||
|
|
||||||
|
case "xdr":
|
||||||
|
xdr()
|
||||||
|
|
||||||
|
case "translate":
|
||||||
|
translate()
|
||||||
|
|
||||||
|
case "transifex":
|
||||||
|
transifex()
|
||||||
|
|
||||||
|
case "deps":
|
||||||
|
deps()
|
||||||
|
|
||||||
|
case "tar":
|
||||||
|
buildTar()
|
||||||
|
|
||||||
|
case "zip":
|
||||||
|
buildZip()
|
||||||
|
|
||||||
|
case "clean":
|
||||||
|
clean()
|
||||||
|
|
||||||
|
default:
|
||||||
|
log.Fatalf("Unknown command %q", cmd)
|
||||||
}
|
}
|
||||||
install(pkg)
|
|
||||||
|
|
||||||
case "build":
|
|
||||||
pkg := "./cmd/syncthing"
|
|
||||||
if flag.NArg() > 2 {
|
|
||||||
pkg = flag.Arg(1)
|
|
||||||
}
|
|
||||||
var tags []string
|
|
||||||
if noupgrade {
|
|
||||||
tags = []string{"noupgrade"}
|
|
||||||
}
|
|
||||||
build(pkg, tags)
|
|
||||||
|
|
||||||
case "test":
|
|
||||||
pkg := "./..."
|
|
||||||
if flag.NArg() > 2 {
|
|
||||||
pkg = flag.Arg(1)
|
|
||||||
}
|
|
||||||
test(pkg)
|
|
||||||
|
|
||||||
case "assets":
|
|
||||||
assets()
|
|
||||||
|
|
||||||
case "xdr":
|
|
||||||
xdr()
|
|
||||||
|
|
||||||
case "translate":
|
|
||||||
translate()
|
|
||||||
|
|
||||||
case "transifex":
|
|
||||||
transifex()
|
|
||||||
|
|
||||||
case "deps":
|
|
||||||
deps()
|
|
||||||
|
|
||||||
case "tar":
|
|
||||||
buildTar()
|
|
||||||
|
|
||||||
case "zip":
|
|
||||||
buildZip()
|
|
||||||
|
|
||||||
case "clean":
|
|
||||||
clean()
|
|
||||||
|
|
||||||
default:
|
|
||||||
log.Fatalf("Unknown command %q", flag.Arg(0))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func check() error {
|
|
||||||
_, err := exec.LookPath("godep")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkRequiredGoVersion() {
|
func checkRequiredGoVersion() {
|
||||||
ver := run("go", "version")
|
ver := run("go", "version")
|
||||||
re := regexp.MustCompile(`go version go(\d+\.\d+)`)
|
re := regexp.MustCompile(`go version go(\d+\.\d+)`)
|
||||||
@@ -163,24 +150,25 @@ func setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test(pkg string) {
|
func test(pkg string) {
|
||||||
runPrint("godep", "go", "test", "-short", "-timeout", "10s", pkg)
|
setBuildEnv()
|
||||||
|
runPrint("go", "test", "-short", "-timeout", "10s", pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func install(pkg string) {
|
func install(pkg string) {
|
||||||
os.Setenv("GOBIN", "./bin")
|
os.Setenv("GOBIN", "./bin")
|
||||||
setBuildEnv()
|
setBuildEnv()
|
||||||
runPrint("godep", "go", "install", "-ldflags", ldflags(), pkg)
|
runPrint("go", "install", "-ldflags", ldflags(), pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func build(pkg string, tags []string) {
|
func build(pkg string, tags []string) {
|
||||||
rmr("syncthing", "syncthing.exe")
|
rmr("syncthing", "syncthing.exe")
|
||||||
args := []string{"go", "build", "-ldflags", ldflags()}
|
args := []string{"build", "-ldflags", ldflags()}
|
||||||
if len(tags) > 0 {
|
if len(tags) > 0 {
|
||||||
args = append(args, "-tags", strings.Join(tags, ","))
|
args = append(args, "-tags", strings.Join(tags, ","))
|
||||||
}
|
}
|
||||||
args = append(args, pkg)
|
args = append(args, pkg)
|
||||||
setBuildEnv()
|
setBuildEnv()
|
||||||
runPrint("godep", args...)
|
runPrint("go", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildTar() {
|
func buildTar() {
|
||||||
@@ -230,10 +218,18 @@ func setBuildEnv() {
|
|||||||
if goarch == "386" {
|
if goarch == "386" {
|
||||||
os.Setenv("GO386", "387")
|
os.Setenv("GO386", "387")
|
||||||
}
|
}
|
||||||
|
wd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Warning: can't determine current dir:", err)
|
||||||
|
log.Println("Build might not work as expected")
|
||||||
|
}
|
||||||
|
os.Setenv("GOPATH", fmt.Sprintf("%s%c%s", filepath.Join(wd, "Godeps", "_workspace"), os.PathListSeparator, os.Getenv("GOPATH")))
|
||||||
|
log.Println("GOPATH=" + os.Getenv("GOPATH"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func assets() {
|
func assets() {
|
||||||
runPipe("internal/auto/gui.files.go", "godep", "go", "run", "cmd/genassets/main.go", "gui")
|
setBuildEnv()
|
||||||
|
runPipe("internal/auto/gui.files.go", "go", "run", "cmd/genassets/main.go", "gui")
|
||||||
}
|
}
|
||||||
|
|
||||||
func xdr() {
|
func xdr() {
|
||||||
|
|||||||
@@ -620,6 +620,10 @@ nextRepo:
|
|||||||
go standbyMonitor()
|
go standbyMonitor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.Options.AutoUpgradeIntervalH > 0 {
|
||||||
|
go autoUpgrade()
|
||||||
|
}
|
||||||
|
|
||||||
events.Default.Log(events.StartupComplete, nil)
|
events.Default.Log(events.StartupComplete, nil)
|
||||||
go generateEvents()
|
go generateEvents()
|
||||||
|
|
||||||
@@ -1172,3 +1176,36 @@ func standbyMonitor() {
|
|||||||
now = time.Now()
|
now = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoUpgrade() {
|
||||||
|
var skipped bool
|
||||||
|
interval := time.Duration(cfg.Options.AutoUpgradeIntervalH) * time.Hour
|
||||||
|
for {
|
||||||
|
if skipped {
|
||||||
|
time.Sleep(interval)
|
||||||
|
} else {
|
||||||
|
skipped = true
|
||||||
|
}
|
||||||
|
|
||||||
|
rel, err := upgrade.LatestRelease(strings.Contains(Version, "-beta"))
|
||||||
|
if err != nil {
|
||||||
|
l.Warnln("Automatic upgrade:", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if upgrade.CompareVersions(rel.Tag, Version) <= 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
l.Infof("Automatic upgrade (current %q < latest %q)", Version, rel.Tag)
|
||||||
|
err = upgrade.UpgradeTo(rel, GoArchExtra)
|
||||||
|
if err != nil {
|
||||||
|
l.Warnln("Automatic upgrade:", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
l.Warnf("Automatically upgraded to version %q. Restarting in 1 minute.", rel.Tag)
|
||||||
|
time.Sleep(time.Minute)
|
||||||
|
stop <- exitUpgrading
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
|
|||||||
$scope.tmpOptions = angular.copy($scope.config.Options);
|
$scope.tmpOptions = angular.copy($scope.config.Options);
|
||||||
$scope.tmpOptions.UREnabled = ($scope.tmpOptions.URAccepted > 0);
|
$scope.tmpOptions.UREnabled = ($scope.tmpOptions.URAccepted > 0);
|
||||||
$scope.tmpOptions.NodeName = $scope.thisNode().Name;
|
$scope.tmpOptions.NodeName = $scope.thisNode().Name;
|
||||||
|
$scope.tmpOptions.AutoUpgradeEnabled = ($scope.tmpOptions.AutoUpgradeIntervalH > 0);
|
||||||
$scope.tmpGUI = angular.copy($scope.config.GUI);
|
$scope.tmpGUI = angular.copy($scope.config.GUI);
|
||||||
$('#settings').modal();
|
$('#settings').modal();
|
||||||
};
|
};
|
||||||
@@ -563,6 +564,13 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
|
|||||||
$scope.tmpOptions.URAccepted = -1;
|
$scope.tmpOptions.URAccepted = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if auto-upgrade has been enabled or disabled
|
||||||
|
if ($scope.tmpOptions.AutoUpgradeEnabled) {
|
||||||
|
$scope.tmpOptions.AutoUpgradeIntervalH = $scope.tmpOptions.AutoUpgradeIntervalH || 12;
|
||||||
|
} else {
|
||||||
|
$scope.tmpOptions.AutoUpgradeIntervalH = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if protocol will need to be changed on restart
|
// Check if protocol will need to be changed on restart
|
||||||
if ($scope.config.GUI.UseTLS !== $scope.tmpGUI.UseTLS) {
|
if ($scope.config.GUI.UseTLS !== $scope.tmpGUI.UseTLS) {
|
||||||
$scope.protocolChanged = true;
|
$scope.protocolChanged = true;
|
||||||
|
|||||||
+33
-23
@@ -383,13 +383,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label translate for="name">Node Name</label>
|
<label translate for="name">Node Name</label>
|
||||||
<input placeholder="Home Server" id="name" class="form-control" type="text" ng-model="currentNode.Name"></input>
|
<input id="name" class="form-control" type="text" ng-model="currentNode.Name"></input>
|
||||||
<p translate ng-if="currentNode.NodeID == myID" class="help-block">Shown instead of Node ID in the cluster status. Will be advertised to other nodes as an optional default name.</p>
|
<p translate ng-if="currentNode.NodeID == myID" class="help-block">Shown instead of Node ID in the cluster status. Will be advertised to other nodes as an optional default name.</p>
|
||||||
<p translate ng-if="currentNode.NodeID != myID" class="help-block">Shown instead of Node ID in the cluster status. Will be updated to the name the node advertises if left empty.</p>
|
<p translate ng-if="currentNode.NodeID != myID" class="help-block">Shown instead of Node ID in the cluster status. Will be updated to the name the node advertises if left empty.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label translate for="addresses">Addresses</label>
|
<label translate for="addresses">Addresses</label>
|
||||||
<input placeholder="dynamic" ng-disabled="currentNode.NodeID == myID" id="addresses" class="form-control" type="text" ng-model="currentNode.AddressesStr"></input>
|
<input ng-disabled="currentNode.NodeID == myID" id="addresses" class="form-control" type="text" ng-model="currentNode.AddressesStr"></input>
|
||||||
<p translate class="help-block">Enter comma separated "ip:port" addresses or "dynamic" to perform automatic discovery of the address.</p>
|
<p translate class="help-block">Enter comma separated "ip:port" addresses or "dynamic" to perform automatic discovery of the address.</p>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="!editingSelf" class="form-group">
|
<div ng-if="!editingSelf" class="form-group">
|
||||||
@@ -434,7 +434,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group" ng-class="{'has-error': repoEditor.repoID.$invalid && repoEditor.repoID.$dirty}">
|
<div class="form-group" ng-class="{'has-error': repoEditor.repoID.$invalid && repoEditor.repoID.$dirty}">
|
||||||
<label for="repoID"><span translate>Repository ID</span></label>
|
<label for="repoID"><span translate>Repository ID</span></label>
|
||||||
<input name="repoID" placeholder="documents" ng-disabled="editingExisting" id="repoID" class="form-control" type="text" ng-model="currentRepo.ID" required unique-repo ng-pattern="/^[a-zA-Z0-9-_.]{1,64}$/"></input>
|
<input name="repoID" ng-disabled="editingExisting" id="repoID" class="form-control" type="text" ng-model="currentRepo.ID" required unique-repo ng-pattern="/^[a-zA-Z0-9-_.]{1,64}$/"></input>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
<span translate ng-if="repoEditor.repoID.$valid || repoEditor.repoID.$pristine">Short identifier for the repository. Must be the same on all cluster nodes.</span>
|
<span translate ng-if="repoEditor.repoID.$valid || repoEditor.repoID.$pristine">Short identifier for the repository. Must be the same on all cluster nodes.</span>
|
||||||
<span translate ng-if="repoEditor.repoID.$error.uniqueRepo">The repository ID must be unique.</span>
|
<span translate ng-if="repoEditor.repoID.$error.uniqueRepo">The repository ID must be unique.</span>
|
||||||
@@ -444,7 +444,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-class="{'has-error': repoEditor.repoPath.$invalid && repoEditor.repoPath.$dirty}">
|
<div class="form-group" ng-class="{'has-error': repoEditor.repoPath.$invalid && repoEditor.repoPath.$dirty}">
|
||||||
<label translate for="repoPath">Repository Path</label>
|
<label translate for="repoPath">Repository Path</label>
|
||||||
<input name="repoPath" placeholder="~/Documents" ng-disabled="editingExisting" id="repoPath" class="form-control" type="text" ng-model="currentRepo.Directory" required></input>
|
<input name="repoPath" ng-disabled="editingExisting" id="repoPath" class="form-control" type="text" ng-model="currentRepo.Directory" required></input>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
<span translate ng-if="repoEditor.repoPath.$valid || repoEditor.repoPath.$pristine">Path to the repository on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for</span> <code>{{system.tilde}}</code>.
|
<span translate ng-if="repoEditor.repoPath.$valid || repoEditor.repoPath.$pristine">Path to the repository on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for</span> <code>{{system.tilde}}</code>.
|
||||||
<span translate ng-if="repoEditor.repoPath.$error.required && repoEditor.repoPath.$dirty">The repository path cannot be blank.</span>
|
<span translate ng-if="repoEditor.repoPath.$error.required && repoEditor.repoPath.$dirty">The repository path cannot be blank.</span>
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-class="{'has-error': repoEditor.rescanIntervalS.$invalid && repoEditor.rescanIntervalS.$dirty}">
|
<div class="form-group" ng-class="{'has-error': repoEditor.rescanIntervalS.$invalid && repoEditor.rescanIntervalS.$dirty}">
|
||||||
<label for="rescanIntervalS"><span translate>Rescan Interval</span> (s)</label>
|
<label for="rescanIntervalS"><span translate>Rescan Interval</span> (s)</label>
|
||||||
<input name="rescanIntervalS" placeholder="60" id="rescanIntervalS" class="form-control" type="number" ng-model="currentRepo.RescanIntervalS" required min="5"></input>
|
<input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentRepo.RescanIntervalS" required min="5"></input>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
<span translate ng-if="!repoEditor.rescanIntervalS.$valid && repoEditor.rescanIntervalS.$dirty">The rescan interval must be at least 5 seconds.</span>
|
<span translate ng-if="!repoEditor.rescanIntervalS.$valid && repoEditor.rescanIntervalS.$dirty">The rescan interval must be at least 5 seconds.</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -528,7 +528,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-if="currentRepo.FileVersioningSelector == 'staggered'">
|
<div class="form-group" ng-if="currentRepo.FileVersioningSelector == 'staggered'">
|
||||||
<label translate for="staggeredVersionsPath">Versions Path</label>
|
<label translate for="staggeredVersionsPath">Versions Path</label>
|
||||||
<input name="staggeredVersionsPath" placeholder="" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentRepo.staggeredVersionsPath"></input>
|
<input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentRepo.staggeredVersionsPath"></input>
|
||||||
<p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions folder in the repository).</p>
|
<p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions folder in the repository).</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -606,26 +606,36 @@
|
|||||||
<label translate for="MaxSendKbps">Outgoing Rate Limit (KiB/s)</label>
|
<label translate for="MaxSendKbps">Outgoing Rate Limit (KiB/s)</label>
|
||||||
<input id="MaxSendKbps" class="form-control" type="number" ng-model="tmpOptions.MaxSendKbps">
|
<input id="MaxSendKbps" class="form-control" type="number" ng-model="tmpOptions.MaxSendKbps">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="col-md-6">
|
||||||
<div class="checkbox">
|
<div class="form-group">
|
||||||
<label>
|
<div class="checkbox">
|
||||||
<span translate>Enable UPnP</span> <input id="UPnPEnabled" type="checkbox" ng-model="tmpOptions.UPnPEnabled">
|
<label>
|
||||||
</label>
|
<span translate>Enable UPnP</span> <input id="UPnPEnabled" type="checkbox" ng-model="tmpOptions.UPnPEnabled">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<span translate>Global Discovery</span> <input id="GlobalAnnEnabled" type="checkbox" ng-model="tmpOptions.GlobalAnnEnabled">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<span translate>Local Discovery</span> <input id="LocalAnnEnabled" type="checkbox" ng-model="tmpOptions.LocalAnnEnabled">
|
<span translate>Automatic upgrades</span> <input id="AutoUpgradeEnabled" type="checkbox" ng-model="tmpOptions.AutoUpgradeEnabled">
|
||||||
</label>
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<div class="checkbox">
|
||||||
<div class="checkbox">
|
<label>
|
||||||
<label>
|
<span translate>Local Discovery</span> <input id="LocalAnnEnabled" type="checkbox" ng-model="tmpOptions.LocalAnnEnabled">
|
||||||
<span translate>Global Discovery</span> <input id="GlobalAnnEnabled" type="checkbox" ng-model="tmpOptions.GlobalAnnEnabled">
|
</label>
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+17
-16
@@ -112,22 +112,23 @@ type RepositoryNodeConfiguration struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OptionsConfiguration struct {
|
type OptionsConfiguration struct {
|
||||||
ListenAddress []string `xml:"listenAddress" default:"0.0.0.0:22000"`
|
ListenAddress []string `xml:"listenAddress" default:"0.0.0.0:22000"`
|
||||||
GlobalAnnServer string `xml:"globalAnnounceServer" default:"announce.syncthing.net:22026"`
|
GlobalAnnServer string `xml:"globalAnnounceServer" default:"announce.syncthing.net:22026"`
|
||||||
GlobalAnnEnabled bool `xml:"globalAnnounceEnabled" default:"true"`
|
GlobalAnnEnabled bool `xml:"globalAnnounceEnabled" default:"true"`
|
||||||
LocalAnnEnabled bool `xml:"localAnnounceEnabled" default:"true"`
|
LocalAnnEnabled bool `xml:"localAnnounceEnabled" default:"true"`
|
||||||
LocalAnnPort int `xml:"localAnnouncePort" default:"21025"`
|
LocalAnnPort int `xml:"localAnnouncePort" default:"21025"`
|
||||||
LocalAnnMCAddr string `xml:"localAnnounceMCAddr" default:"[ff32::5222]:21026"`
|
LocalAnnMCAddr string `xml:"localAnnounceMCAddr" default:"[ff32::5222]:21026"`
|
||||||
ParallelRequests int `xml:"parallelRequests" default:"16"`
|
ParallelRequests int `xml:"parallelRequests" default:"16"`
|
||||||
MaxSendKbps int `xml:"maxSendKbps"`
|
MaxSendKbps int `xml:"maxSendKbps"`
|
||||||
MaxRecvKbps int `xml:"maxRecvKbps"`
|
MaxRecvKbps int `xml:"maxRecvKbps"`
|
||||||
ReconnectIntervalS int `xml:"reconnectionIntervalS" default:"60"`
|
ReconnectIntervalS int `xml:"reconnectionIntervalS" default:"60"`
|
||||||
StartBrowser bool `xml:"startBrowser" default:"true"`
|
StartBrowser bool `xml:"startBrowser" default:"true"`
|
||||||
UPnPEnabled bool `xml:"upnpEnabled" default:"true"`
|
UPnPEnabled bool `xml:"upnpEnabled" default:"true"`
|
||||||
UPnPLease int `xml:"upnpLeaseMinutes" default:"0"`
|
UPnPLease int `xml:"upnpLeaseMinutes" default:"0"`
|
||||||
UPnPRenewal int `xml:"upnpRenewalMinutes" default:"30"`
|
UPnPRenewal int `xml:"upnpRenewalMinutes" default:"30"`
|
||||||
URAccepted int `xml:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently)
|
URAccepted int `xml:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently)
|
||||||
RestartOnWakeup bool `xml:"restartOnWakeup" default:"true"`
|
RestartOnWakeup bool `xml:"restartOnWakeup" default:"true"`
|
||||||
|
AutoUpgradeIntervalH int `xml:"autoUpgradeIntervalH" default:"12"` // 0 for off
|
||||||
|
|
||||||
Deprecated_RescanIntervalS int `xml:"rescanIntervalS,omitempty" json:"-"`
|
Deprecated_RescanIntervalS int `xml:"rescanIntervalS,omitempty" json:"-"`
|
||||||
Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"`
|
Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"`
|
||||||
|
|||||||
@@ -23,21 +23,22 @@ func init() {
|
|||||||
|
|
||||||
func TestDefaultValues(t *testing.T) {
|
func TestDefaultValues(t *testing.T) {
|
||||||
expected := OptionsConfiguration{
|
expected := OptionsConfiguration{
|
||||||
ListenAddress: []string{"0.0.0.0:22000"},
|
ListenAddress: []string{"0.0.0.0:22000"},
|
||||||
GlobalAnnServer: "announce.syncthing.net:22026",
|
GlobalAnnServer: "announce.syncthing.net:22026",
|
||||||
GlobalAnnEnabled: true,
|
GlobalAnnEnabled: true,
|
||||||
LocalAnnEnabled: true,
|
LocalAnnEnabled: true,
|
||||||
LocalAnnPort: 21025,
|
LocalAnnPort: 21025,
|
||||||
LocalAnnMCAddr: "[ff32::5222]:21026",
|
LocalAnnMCAddr: "[ff32::5222]:21026",
|
||||||
ParallelRequests: 16,
|
ParallelRequests: 16,
|
||||||
MaxSendKbps: 0,
|
MaxSendKbps: 0,
|
||||||
MaxRecvKbps: 0,
|
MaxRecvKbps: 0,
|
||||||
ReconnectIntervalS: 60,
|
ReconnectIntervalS: 60,
|
||||||
StartBrowser: true,
|
StartBrowser: true,
|
||||||
UPnPEnabled: true,
|
UPnPEnabled: true,
|
||||||
UPnPLease: 0,
|
UPnPLease: 0,
|
||||||
UPnPRenewal: 30,
|
UPnPRenewal: 30,
|
||||||
RestartOnWakeup: true,
|
RestartOnWakeup: true,
|
||||||
|
AutoUpgradeIntervalH: 12,
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := New("test", node1)
|
cfg := New("test", node1)
|
||||||
@@ -115,21 +116,22 @@ func TestNoListenAddress(t *testing.T) {
|
|||||||
|
|
||||||
func TestOverriddenValues(t *testing.T) {
|
func TestOverriddenValues(t *testing.T) {
|
||||||
expected := OptionsConfiguration{
|
expected := OptionsConfiguration{
|
||||||
ListenAddress: []string{":23000"},
|
ListenAddress: []string{":23000"},
|
||||||
GlobalAnnServer: "syncthing.nym.se:22026",
|
GlobalAnnServer: "syncthing.nym.se:22026",
|
||||||
GlobalAnnEnabled: false,
|
GlobalAnnEnabled: false,
|
||||||
LocalAnnEnabled: false,
|
LocalAnnEnabled: false,
|
||||||
LocalAnnPort: 42123,
|
LocalAnnPort: 42123,
|
||||||
LocalAnnMCAddr: "quux:3232",
|
LocalAnnMCAddr: "quux:3232",
|
||||||
ParallelRequests: 32,
|
ParallelRequests: 32,
|
||||||
MaxSendKbps: 1234,
|
MaxSendKbps: 1234,
|
||||||
MaxRecvKbps: 2341,
|
MaxRecvKbps: 2341,
|
||||||
ReconnectIntervalS: 6000,
|
ReconnectIntervalS: 6000,
|
||||||
StartBrowser: false,
|
StartBrowser: false,
|
||||||
UPnPEnabled: false,
|
UPnPEnabled: false,
|
||||||
UPnPLease: 60,
|
UPnPLease: 60,
|
||||||
UPnPRenewal: 15,
|
UPnPRenewal: 15,
|
||||||
RestartOnWakeup: false,
|
RestartOnWakeup: false,
|
||||||
|
AutoUpgradeIntervalH: 24,
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg, err := Load("testdata/overridenvalues.xml", node1)
|
cfg, err := Load("testdata/overridenvalues.xml", node1)
|
||||||
|
|||||||
@@ -16,5 +16,6 @@
|
|||||||
<upnpLeaseMinutes>60</upnpLeaseMinutes>
|
<upnpLeaseMinutes>60</upnpLeaseMinutes>
|
||||||
<upnpRenewalMinutes>15</upnpRenewalMinutes>
|
<upnpRenewalMinutes>15</upnpRenewalMinutes>
|
||||||
<restartOnWakeup>false</restartOnWakeup>
|
<restartOnWakeup>false</restartOnWakeup>
|
||||||
|
<autoUpgradeIntervalH>24</autoUpgradeIntervalH>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -26,8 +26,29 @@ var (
|
|||||||
ErrVersionUpToDate = errors.New("current version is up to date")
|
ErrVersionUpToDate = errors.New("current version is up to date")
|
||||||
ErrVersionUnknown = errors.New("couldn't fetch release information")
|
ErrVersionUnknown = errors.New("couldn't fetch release information")
|
||||||
ErrUpgradeUnsupported = errors.New("upgrade unsupported")
|
ErrUpgradeUnsupported = errors.New("upgrade unsupported")
|
||||||
|
ErrUpgradeInProgress = errors.New("upgrade already in progress")
|
||||||
|
upgradeUnlocked = make(chan bool, 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
upgradeUnlocked <- true
|
||||||
|
}
|
||||||
|
|
||||||
|
// A wrapper around actual implementations
|
||||||
|
func UpgradeTo(rel Release, archExtra string) error {
|
||||||
|
select {
|
||||||
|
case <-upgradeUnlocked:
|
||||||
|
err := upgradeTo(rel, archExtra)
|
||||||
|
// If we've failed to upgrade, unlock so that another attempt could be made
|
||||||
|
if err != nil {
|
||||||
|
upgradeUnlocked <- true
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
default:
|
||||||
|
return ErrUpgradeInProgress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns 1 if a>b, -1 if a<b and 0 if they are equal
|
// Returns 1 if a>b, -1 if a<b and 0 if they are equal
|
||||||
func CompareVersions(a, b string) int {
|
func CompareVersions(a, b string) int {
|
||||||
arel, apre := versionParts(a)
|
arel, apre := versionParts(a)
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
||||||
func UpgradeTo(rel Release, archExtra string) error {
|
func upgradeTo(rel Release, archExtra string) error {
|
||||||
path, err := osext.Executable()
|
path, err := osext.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
osName := runtime.GOOS
|
osName := runtime.GOOS
|
||||||
if osName == "darwin" {
|
if osName == "darwin" {
|
||||||
// We call the darwin release bundles macosx because that makes more
|
// We call the darwin release bundles macosx because that makes more
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
package upgrade
|
package upgrade
|
||||||
|
|
||||||
func UpgradeTo(rel Release, extra string) error {
|
func upgradeTo(rel Release, extra string) error {
|
||||||
return ErrUpgradeUnsupported
|
return ErrUpgradeUnsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
// Upgrade to the given release, saving the previous binary with a ".old" extension.
|
||||||
func UpgradeTo(rel Release, archExtra string) error {
|
func upgradeTo(rel Release, archExtra string) error {
|
||||||
path, err := osext.Executable()
|
path, err := osext.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedRelease := fmt.Sprintf("syncthing-%s-%s%s-%s.", runtime.GOOS, runtime.GOARCH, archExtra, rel.Tag)
|
expectedRelease := fmt.Sprintf("syncthing-%s-%s%s-%s.", runtime.GOOS, runtime.GOARCH, archExtra, rel.Tag)
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugf("expected release asset %q", expectedRelease)
|
l.Debugf("expected release asset %q", expectedRelease)
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
go test -tags integration -v
|
go test -tags integration -v -short
|
||||||
./test-http.sh
|
./test-http.sh
|
||||||
./test-merge.sh
|
./test-merge.sh
|
||||||
./test-delupd.sh
|
./test-delupd.sh
|
||||||
|
|||||||
+8
-4
@@ -17,10 +17,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
rand.Seed(42)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadRand(bs []byte) (int, error) {
|
func ReadRand(bs []byte) (int, error) {
|
||||||
var r uint32
|
var r uint32
|
||||||
for i := range bs {
|
for i := range bs {
|
||||||
@@ -42,12 +38,20 @@ func main() {
|
|||||||
var files int
|
var files int
|
||||||
var maxexp int
|
var maxexp int
|
||||||
var srcname string
|
var srcname string
|
||||||
|
var random bool
|
||||||
|
|
||||||
flag.IntVar(&files, "files", 1000, "Number of files")
|
flag.IntVar(&files, "files", 1000, "Number of files")
|
||||||
flag.IntVar(&maxexp, "maxexp", 20, "Maximum file size (max = 2^n + 128*1024 B)")
|
flag.IntVar(&maxexp, "maxexp", 20, "Maximum file size (max = 2^n + 128*1024 B)")
|
||||||
flag.StringVar(&srcname, "src", "/usr/share/dict/words", "Source material")
|
flag.StringVar(&srcname, "src", "/usr/share/dict/words", "Source material")
|
||||||
|
flag.BoolVar(&random, "random", true, "When false, always generate the same set of file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if random {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
} else {
|
||||||
|
rand.Seed(42)
|
||||||
|
}
|
||||||
|
|
||||||
fd, err := os.Open(srcname)
|
fd, err := os.Open(srcname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBenchmarkTransfer(t *testing.T) {
|
func TestBenchmarkTransfer(t *testing.T) {
|
||||||
|
nfiles := 10000
|
||||||
|
if testing.Short() {
|
||||||
|
nfiles = 1000
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("Cleaning...")
|
log.Println("Cleaning...")
|
||||||
err := removeAll("s1", "s2", "h1/index", "h2/index")
|
err := removeAll("s1", "s2", "h1/index", "h2/index")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -21,7 +26,7 @@ func TestBenchmarkTransfer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Generating files...")
|
log.Println("Generating files...")
|
||||||
err = generateFiles("s1", 10000, 22, "../bin/syncthing")
|
err = generateFiles("s1", nfiles, 22, "../bin/syncthing")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user