From 93e72cc83fac979bc23c201697491c5f824c3918 Mon Sep 17 00:00:00 2001 From: Ross Smith II Date: Fri, 25 Apr 2025 19:24:31 -0700 Subject: [PATCH 1/4] chore(gui): use go list --deps for dependency list (#10071) --- .../syncthing/core/aboutModalView.html | 40 ++-------- script/copyrights.go | 80 ++++++++++--------- 2 files changed, 49 insertions(+), 71 deletions(-) diff --git a/gui/default/syncthing/core/aboutModalView.html b/gui/default/syncthing/core/aboutModalView.html index 8e82ba32f..d7d4b4445 100644 --- a/gui/default/syncthing/core/aboutModalView.html +++ b/gui/default/syncthing/core/aboutModalView.html @@ -51,81 +51,57 @@ Jakob Borg, Audrius Butkevicius, Jesse Lucas, Simon Frei, Tomasz Wilczyński, Al
  • The Go Programming Language, Copyright © 2009 The Go Authors.
  • Prometheus, Copyright © 2012-2015 The Prometheus Authors.
  • AudriusButkevicius/recli, Copyright © 2019 Audrius Butkevicius.
  • -
  • Azure/azure-sdk-for-go, Copyright © Microsoft Corporation.
  • Azure/go-ntlmssp, Copyright © 2016 Microsoft.
  • alecthomas/kong, Copyright © 2018 Alec Thomas.
  • -
  • aws/aws-sdk-go, Copyright © 2015 Amazon.com, Inc. or its affiliates, Copyright 2014-2015 Stripe, Inc.
  • beorn7/perks, Copyright © 2013 Blake Mizerany.
  • calmh/incontainer, Copyright © 2022 calmh.
  • calmh/xdr, Copyright © 2014 Jakob Borg.
  • ccding/go-stun, Copyright © 2016 Cong Ding.
  • -
  • cenkalti/backoff, Copyright © 2014 Cenk Altı.
  • -
  • certifi/gocertifi, Copyright © 2025, the certifi/gocertifi authors.
  • -
  • cespare/xxhash, Copyright © 2016 Caleb Spare.
  • +
  • cespare/xxhash/v2, Copyright © 2016 Caleb Spare.
  • chmduquesne/rollinghash, Copyright © 2015 Christophe-Marie Duquesne.
  • -
  • cpuguy83/go-md2man, Copyright © 2014 Brian Goff.
  • -
  • d4l3k/messagediff, Copyright © 2015 Tristan Rice.
  • -
  • davecgh/go-spew, Copyright © 2012-2016 Dave Collins .
  • +
  • cpuguy83/go-md2man/v2, Copyright © 2014 Brian Goff.
  • +
  • davecgh/go-spew, Copyright © 2012-2016 Dave Collins.
  • ebitengine/purego, Copyright © 2022 The Ebitengine Authors.
  • -
  • fsnotify/fsnotify, Copyright © 2012 The Go Authors.
  • -
  • getsentry/raven-go, Copyright © 2013 Apollic Software, LLC.
  • go-asn1-ber/asn1-ber, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • go-ldap/ldap, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • -
  • go-ole/go-ole, Copyright © 2013-2017 Yasuhiro Matsumoto, .
  • -
  • go-task/slim-sprig, Copyright © 2013-2020 Masterminds.
  • go.uber.org/automaxprocs, Copyright © 2017 Uber Technologies, Inc.
  • -
  • go.uber.org/mock, Copyright © 2010-2022 Google LLC.
  • gobwas/glob, Copyright © 2016 Sergey Kamardin.
  • gofrs/flock, Copyright © 2018-2025, The Gofrs.
  • golang/snappy, Copyright © 2011 The Snappy-Go Authors.
  • google.golang.org/protobuf, Copyright © 2018 The Go Authors.
  • -
  • google/pprof, Copyright © 2016 Google Inc.
  • google/uuid, Copyright © 2009,2014 Google Inc.
  • -
  • gopkg.in/yaml.v3, Copyright © 2006-2010 Kirill Simonov.
  • +
  • gopkg.in/yaml.v3, Copyright © 2025, the gopkg.in/yaml.v3 authors.
  • greatroar/blobloom, Copyright © 2020-2024 the Blobloom authors.
  • hashicorp/errwrap, Copyright © 2014 HashiCorp, Inc.
  • hashicorp/go-multierror, Copyright © 2014 HashiCorp, Inc.
  • hashicorp/golang-lru, Copyright © 2014 HashiCorp, Inc.
  • jackpal/gateway, Copyright © 2010 Jack Palevich.
  • jackpal/go-nat-pmp, Copyright 2013 John Howard Palevich.
  • -
  • jmespath/go-jmespath, Copyright © 2015 James Saryerwinnie.
  • julienschmidt/httprouter, Copyright © 2013, Julien Schmidt.
  • kballard/go-shellquote, Copyright © 2014 Kevin Ballard.
  • klauspost/compress, Copyright © 2012 The Go Authors.
  • -
  • lufia/plan9stats, Copyright © 2019, KADOTA, Kyohei.
  • -
  • maruel/panicparse, Copyright 2015 Marc-Antoine Ruel.
  • -
  • maxbrunsfeld/counterfeiter, Copyright © 2014 maxbrunsfeld.
  • -
  • maxmind/geoipupdate, Copyright © 2018-2024 by MaxMind, Inc.
  • miscreant/miscreant.go, Copyright © 2017-2019 The Miscreant Developers.
  • munnerz/goautoneg, Copyright © 2011, Open Knowledge Foundation Ltd.
  • -
  • nxadm/tail, Copyright © 2014 ActiveState.
  • -
  • onsi/ginkgo, Copyright © 2013-2014 Onsi Fakhouri.
  • -
  • oschwald/geoip2-golang, Copyright © 2015, Gregory J. Oschwald.
  • -
  • oschwald/maxminddb-golang, Copyright © 2015, Gregory J. Oschwald.
  • pierrec/lz4, Copyright © 2015 Pierre Curto.
  • pkg/errors, Copyright © 2015, Dave Cheney.
  • pmezard/go-difflib, Copyright © 2013, Patrick Mezard.
  • posener/complete, Copyright © 2017 Eyal Posener.
  • -
  • power-devops/perfstat, Copyright © 2020 Power DevOps.
  • -
  • puzpuzpuz/xsync, Copyright © 2025, the puzpuzpuz/xsync authors.
  • +
  • prometheus/client_golang, Copyright 2012-2015 The Prometheus Authors.
  • +
  • prometheus/client_model, Copyright © 2025, the prometheus/client_model authors.
  • +
  • prometheus/common, Copyright © 2025, the prometheus/common authors.
  • quic-go/quic-go, Copyright © 2016 the quic-go authors & Google, Inc.
  • -
  • rabbitmq/amqp091-go, Copyright © 2021 VMware, Inc. or its affiliates.
  • rcrowley/go-metrics, Copyright © 2012 Richard Crowley.
  • riywo/loginshell, Copyright © 2019 Ryosuke IWANAGA.
  • -
  • russross/blackfriday, Copyright © 2011 Russ Ross.
  • +
  • russross/blackfriday/v2, Copyright © 2011 Russ Ross.
  • shirou/gopsutil, Copyright © 2014, WAKAYAMA Shirou.
  • -
  • sigs.k8s.io/yaml, Copyright © 2014 Sam Ghods.
  • stretchr/objx, Copyright © 2014 Stretchr, Inc.
  • stretchr/testify, Copyright © 2012-2020 Mat Ryer, Tyler Bunnell and contributors.
  • -
  • syncthing/notify, Copyright © 2014-2015 The Notify Authors.
  • syndtr/goleveldb, Copyright © 2012 Suryandaru Triandana.
  • thejerf/suture, Copyright © 2014-2015 Barracuda Networks, Inc.
  • tklauser/go-sysconf, Copyright © 2018-2022, Tobias Klauser.
  • -
  • tklauser/numcpus, Copyright © 2018-2024 Tobias Klauser.
  • urfave/cli, Copyright © 2016 Jeremy Saenz & Contributors.
  • vitrun/qart, Copyright © 2010-2011 The Go Authors.
  • willabides/kongplete, Copyright © 2020 WillAbides.
  • -
  • yusufpapurcu/wmi, Copyright © 2013 Stack Exchange.
  • diff --git a/script/copyrights.go b/script/copyrights.go index f192893c2..d0f171a72 100644 --- a/script/copyrights.go +++ b/script/copyrights.go @@ -13,8 +13,6 @@ package main import ( - "bufio" - "bytes" "encoding/base64" "encoding/json" "fmt" @@ -50,6 +48,8 @@ var copyrightMap = map[string]string{ "jmespath/go-jmespath": "Copyright © 2015 James Saryerwinnie", // https://github.com/maxmind/geoipupdate/blob/main/README.md?plain=1#L140 "maxmind/geoipupdate": "Copyright © 2018-2024 by MaxMind, Inc", + // https://github.com/search?q=repo%3Aprometheus%2Fclient_golang%20copyright&type=code + "prometheus/client_golang": "Copyright 2012-2015 The Prometheus Authors", // https://github.com/search?q=repo%3Apuzpuzpuz%2Fxsync%20copyright&type=code // "puzpuzpuz/xsync": "No copyrights found", // https://github.com/search?q=repo%3Atklauser%2Fnumcpus%20copyright&type=code @@ -59,13 +59,13 @@ var copyrightMap = map[string]string{ } var urlMap = map[string]string{ - "fontawesome.io": "https://github.com/FortAwesome/Font-Awesome", - "go.uber.org/automaxprocs": "https://github.com/uber-go/automaxprocs", - "go.uber.org/mock": "https://github.com/uber-go/mock", + "fontawesome.io": "https://github.com/FortAwesome/Font-Awesome", + "go.uber.org/automaxprocs": "https://github.com/uber-go/automaxprocs", + // "go.uber.org/mock": "https://github.com/uber-go/mock", "google.golang.org/protobuf": "https://github.com/protocolbuffers/protobuf-go", - "gopkg.in/yaml.v2": "", // ignore, as gopkg.in/yaml.v3 supersedes - "gopkg.in/yaml.v3": "https://github.com/go-yaml/yaml", - "sigs.k8s.io/yaml": "https://github.com/kubernetes-sigs/yaml", + // "gopkg.in/yaml.v2": "", // ignore, as gopkg.in/yaml.v3 supersedes + // "gopkg.in/yaml.v3": "https://github.com/go-yaml/yaml", + "sigs.k8s.io/yaml": "https://github.com/kubernetes-sigs/yaml", } const htmlFile = "gui/default/syncthing/core/aboutModalView.html" @@ -174,6 +174,7 @@ func main() { if n.Type != TypeNew { continue } + copyright, ok := copyrightMap[n.Name] if ok { notices[i].Copyright = copyright @@ -272,44 +273,43 @@ func writeFile(path string, data string) { } func getModules() []string { - cmd := exec.Command("go", "mod", "graph") - output, err := cmd.Output() + ignoreRe := regexp.MustCompile(`golang\.org/x/|github\.com/syncthing|^[^.]+(/|$)`) + + // List all modules (used for mapping packages to modules) + data, err := exec.Command("go", "list", "-m", "all").Output() if err != nil { - log.Fatal(err) + log.Fatalf("go list -m all: %v", err) } + modules := strings.Split(string(data), "\n") + for i := range modules { + modules[i], _, _ = strings.Cut(modules[i], " ") + } + modules = slices.DeleteFunc(modules, func(s string) bool { return s == "" }) + + // List all packages in use by the syncthing binary, map them to modules + data, err = exec.Command("go", "list", "-deps", "./cmd/syncthing").Output() + if err != nil { + log.Fatalf("go list -deps ./cmd/syncthing: %v", err) + } + packages := strings.Split(string(data), "\n") + packages = slices.DeleteFunc(packages, func(s string) bool { return s == "" }) seen := make(map[string]struct{}) - scanner := bufio.NewScanner(bytes.NewReader(output)) - - for scanner.Scan() { - line := scanner.Text() - fields := strings.Fields(line) - if len(fields) == 0 { + for _, pkg := range packages { + if ignoreRe.MatchString(pkg) { continue } - if !strings.HasPrefix(fields[0], "github.com/syncthing/syncthing") { + // Find module for package + modIdx := slices.IndexFunc(modules, func(mod string) bool { + return strings.HasPrefix(pkg, mod) + }) + if modIdx < 0 { + log.Println("no module for", pkg) continue } - - // Get left-hand side of dependency pair (before '@') - mod := strings.SplitN(fields[1], "@", 2)[0] - - // Keep only first 3 path components - parts := strings.Split(mod, "/") - if len(parts) == 1 { - continue - } - short := strings.Join(parts[:min(len(parts), 3)], "/") - - if strings.HasPrefix(short, "golang.org/x") || - strings.HasPrefix(short, "github.com/prometheus") || - short == "go" { - - continue - } - - seen[short] = struct{}{} + module := modules[modIdx] + seen[module] = struct{}{} } adds := make([]string, 0) @@ -404,7 +404,9 @@ func getLicenseText(owner, repo string) string { log.Fatal(err) } defer resp.Body.Close() - + if resp.StatusCode == 404 { + return "" + } var result struct { Content string `json:"content"` Encoding string `json:"encoding"` @@ -416,7 +418,7 @@ func getLicenseText(owner, repo string) string { } if result.Encoding != "base64" { - log.Fatal(fmt.Sprintf("unexpected encoding: %s", result.Encoding)) + log.Fatal(fmt.Sprintf("unexpected encoding: %q", result.Encoding)) } decoded, err := base64.StdEncoding.DecodeString(result.Content) From 23e8366f8ddf81f01c968b827ee3b71a028c3d77 Mon Sep 17 00:00:00 2001 From: Syncthing Release Automation Date: Mon, 28 Apr 2025 03:52:12 +0000 Subject: [PATCH 2/4] chore(gui, man, authors): update docs, translations, and contributors --- AUTHORS | 2 +- gui/default/assets/lang/lang-en-GB.json | 2 ++ gui/default/assets/lang/lang-sv.json | 2 ++ .../syncthing/core/aboutModalView.html | 3 ++- man/stdiscosrv.1 | 2 +- man/strelaysrv.1 | 2 +- man/syncthing-bep.7 | 2 +- man/syncthing-config.5 | 2 +- man/syncthing-device-ids.7 | 2 +- man/syncthing-event-api.7 | 2 +- man/syncthing-faq.7 | 15 ++++++++--- man/syncthing-globaldisco.7 | 2 +- man/syncthing-localdisco.7 | 2 +- man/syncthing-networking.7 | 2 +- man/syncthing-relay.7 | 27 ++++++++++++++++--- man/syncthing-rest-api.7 | 2 +- man/syncthing-security.7 | 2 +- man/syncthing-stignore.5 | 2 +- man/syncthing-versioning.7 | 2 +- man/syncthing.1 | 2 +- 20 files changed, 56 insertions(+), 23 deletions(-) diff --git a/AUTHORS b/AUTHORS index 89b21a3b4..2b996bd01 100644 --- a/AUTHORS +++ b/AUTHORS @@ -223,7 +223,7 @@ Marc Laporte (marclaporte) Marc Pujol (kilburn) Marcin Dziadus (marcindziadus) marco-m -Marcus B Spencer +Marcus B Spencer Marcus Legendre Mario Majila Mark Pulford (mpx) diff --git a/gui/default/assets/lang/lang-en-GB.json b/gui/default/assets/lang/lang-en-GB.json index 1602bc92a..1dfa94d78 100644 --- a/gui/default/assets/lang/lang-en-GB.json +++ b/gui/default/assets/lang/lang-en-GB.json @@ -27,6 +27,7 @@ "Allowed Networks": "Allowed Networks", "Alphabetic": "Alphabetic", "Altered by ignoring deletes.": "Altered by ignoring deletes.", + "Always turned on when the folder type is \"{%foldertype%}\".": "Always turned on when the folder type is \"{{foldertype}}\".", "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.": "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.", "Anonymous Usage Reporting": "Anonymous Usage Reporting", "Anonymous usage report format has changed. Would you like to move to the new format?": "Anonymous usage report format has changed. Would you like to move to the new format?", @@ -52,6 +53,7 @@ "Body:": "Body:", "Bugs": "Bugs", "Cancel": "Cancel", + "Cannot be enabled when the folder type is \"{%foldertype%}\".": "Cannot be enabled when the folder type is \"{{foldertype}}\".", "Changelog": "Changelog", "Clean out after": "Clean out after", "Cleaning Versions": "Cleaning Versions", diff --git a/gui/default/assets/lang/lang-sv.json b/gui/default/assets/lang/lang-sv.json index d04b1b79f..e748791a3 100644 --- a/gui/default/assets/lang/lang-sv.json +++ b/gui/default/assets/lang/lang-sv.json @@ -27,6 +27,7 @@ "Allowed Networks": "Tillåtna nätverk", "Alphabetic": "Alfabetisk", "Altered by ignoring deletes.": "Ändrad genom att ignorera borttagningar.", + "Always turned on when the folder type is \"{%foldertype%}\".": "Alltid på när mapptypen är \"{{foldertype}}\".", "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.": "Ett externt kommando hanterar versionen. Det måste ta bort filen från den delade mappen. Om sökvägen till applikationen innehåller mellanslag bör den citeras.", "Anonymous Usage Reporting": "Anonym användarstatistiksrapportering", "Anonymous usage report format has changed. Would you like to move to the new format?": "Anonymt användningsrapportformat har ändrats. Vill du flytta till det nya formatet?", @@ -52,6 +53,7 @@ "Body:": "Meddelande:", "Bugs": "Felrapporter", "Cancel": "Avbryt", + "Cannot be enabled when the folder type is \"{%foldertype%}\".": "Kan inte aktiveras när mapptypen är \"{{foldertype}}\".", "Changelog": "Ändringslogg", "Clean out after": "Rensa efteråt", "Cleaning Versions": "Rensningsversioner", diff --git a/gui/default/syncthing/core/aboutModalView.html b/gui/default/syncthing/core/aboutModalView.html index d7d4b4445..14a9f8be6 100644 --- a/gui/default/syncthing/core/aboutModalView.html +++ b/gui/default/syncthing/core/aboutModalView.html @@ -61,7 +61,6 @@ Jakob Borg, Audrius Butkevicius, Jesse Lucas, Simon Frei, Tomasz Wilczyński, Al
  • chmduquesne/rollinghash, Copyright © 2015 Christophe-Marie Duquesne.
  • cpuguy83/go-md2man/v2, Copyright © 2014 Brian Goff.
  • davecgh/go-spew, Copyright © 2012-2016 Dave Collins.
  • -
  • ebitengine/purego, Copyright © 2022 The Ebitengine Authors.
  • go-asn1-ber/asn1-ber, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • go-ldap/ldap, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • go.uber.org/automaxprocs, Copyright © 2017 Uber Technologies, Inc.
  • @@ -89,6 +88,7 @@ Jakob Borg, Audrius Butkevicius, Jesse Lucas, Simon Frei, Tomasz Wilczyński, Al
  • prometheus/client_golang, Copyright 2012-2015 The Prometheus Authors.
  • prometheus/client_model, Copyright © 2025, the prometheus/client_model authors.
  • prometheus/common, Copyright © 2025, the prometheus/common authors.
  • +
  • prometheus/procfs, Copyright © 2025, the prometheus/procfs authors.
  • quic-go/quic-go, Copyright © 2016 the quic-go authors & Google, Inc.
  • rcrowley/go-metrics, Copyright © 2012 Richard Crowley.
  • riywo/loginshell, Copyright © 2019 Ryosuke IWANAGA.
  • @@ -99,6 +99,7 @@ Jakob Borg, Audrius Butkevicius, Jesse Lucas, Simon Frei, Tomasz Wilczyński, Al
  • syndtr/goleveldb, Copyright © 2012 Suryandaru Triandana.
  • thejerf/suture, Copyright © 2014-2015 Barracuda Networks, Inc.
  • tklauser/go-sysconf, Copyright © 2018-2022, Tobias Klauser.
  • +
  • tklauser/numcpus, Copyright © 2018-2024 Tobias Klauser.
  • urfave/cli, Copyright © 2016 Jeremy Saenz & Contributors.
  • vitrun/qart, Copyright © 2010-2011 The Go Authors.
  • willabides/kongplete, Copyright © 2020 WillAbides.
  • diff --git a/man/stdiscosrv.1 b/man/stdiscosrv.1 index e641173bb..3933e31c6 100644 --- a/man/stdiscosrv.1 +++ b/man/stdiscosrv.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "STDISCOSRV" "1" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "STDISCOSRV" "1" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME stdiscosrv \- Syncthing Discovery Server .SH SYNOPSIS diff --git a/man/strelaysrv.1 b/man/strelaysrv.1 index 80b7c240e..dfdfd2718 100644 --- a/man/strelaysrv.1 +++ b/man/strelaysrv.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "STRELAYSRV" "1" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "STRELAYSRV" "1" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME strelaysrv \- Syncthing Relay Server .SH SYNOPSIS diff --git a/man/syncthing-bep.7 b/man/syncthing-bep.7 index c6e9dc065..5f4e62a69 100644 --- a/man/syncthing-bep.7 +++ b/man/syncthing-bep.7 @@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-BEP" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-BEP" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-bep \- Block Exchange Protocol v1 .SH INTRODUCTION AND DEFINITIONS diff --git a/man/syncthing-config.5 b/man/syncthing-config.5 index 5205488c1..6e47cba7d 100644 --- a/man/syncthing-config.5 +++ b/man/syncthing-config.5 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-CONFIG" "5" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-CONFIG" "5" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-config \- Syncthing Configuration .SH SYNOPSIS diff --git a/man/syncthing-device-ids.7 b/man/syncthing-device-ids.7 index 601b9a388..cf4c315d0 100644 --- a/man/syncthing-device-ids.7 +++ b/man/syncthing-device-ids.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-DEVICE-IDS" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-DEVICE-IDS" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-device-ids \- Understanding Device IDs .sp diff --git a/man/syncthing-event-api.7 b/man/syncthing-event-api.7 index f1b2fb80c..7d128ad54 100644 --- a/man/syncthing-event-api.7 +++ b/man/syncthing-event-api.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-EVENT-API" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-EVENT-API" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-event-api \- Event API .SH DESCRIPTION diff --git a/man/syncthing-faq.7 b/man/syncthing-faq.7 index 2c45e8597..3e241e2da 100644 --- a/man/syncthing-faq.7 +++ b/man/syncthing-faq.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-FAQ" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-FAQ" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-faq \- Frequently Asked Questions .INDENT 0.0 @@ -74,6 +74,8 @@ syncthing-faq \- Frequently Asked Questions \fI\%Why does Syncthing connect to this unknown/suspicious address?\fP .IP \(bu 2 \fI\%I am seeing the error message “folder marker missing”. What do I do?\fP +.IP \(bu 2 +\fI\%Why do my Windows computers always connect through a relay?\fP .UNINDENT .IP \(bu 2 \fI\%Usage\fP @@ -254,8 +256,7 @@ Syncthing logs to stdout by default. On Windows Syncthing by default also creates \fBsyncthing.log\fP in Syncthing’s home directory (run \fBsyncthing \-\-paths\fP to see where that is). The command line option \fB\-\-logfile\fP can be used to specify a user\-defined logfile. If you only have access to a running -instance’s GUI, check under the \fIActions\fP \- \fIAbout\fP menu item to see the used -paths. +instance’s GUI, click the \fIHelp\fP \-> \fIAbout\fP menu item, then the \fIPaths\fP tab. .sp If you’re running a process manager like systemd, check there. If you’re using a GUI wrapper integration, it may keep the logs for you. @@ -424,6 +425,14 @@ it will also reset the database state of this folder. It will be considered a will be merged with files from remote devices. .sp Also see the \fI\%marker FAQ\fP for more information about the folder marker. +.SS Why do my Windows computers always connect through a relay? +.sp +When connecting to a new network, Windows by default sets its profile to +“Public”. While being more secure, this setting commonly prevents applications +like Syncthing from being able to establish direct connections with the device +in question, forcing it to connect through a relay. If you would rather connect +your devices directly, please follow \X'tty: link https://support.microsoft.com/windows/essential-network-settings-and-tasks-in-windows-f21a9bbc-c582-55cd-35e0-73431160a1b9#bkmk_network_profile'\fI\%the official Microsoft instructions on how +to change the network profile to “Private”\fP <\fBhttps://support.microsoft.com/windows/essential-network-settings-and-tasks-in-windows-f21a9bbc-c582-55cd-35e0-73431160a1b9#bkmk_network_profile\fP>\X'tty: link'\&. .SH USAGE .SS What if there is a conflict? .sp diff --git a/man/syncthing-globaldisco.7 b/man/syncthing-globaldisco.7 index 0c598bdda..b73a00ce4 100644 --- a/man/syncthing-globaldisco.7 +++ b/man/syncthing-globaldisco.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-GLOBALDISCO" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-GLOBALDISCO" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-globaldisco \- Global Discovery Protocol v3 .SH ANNOUNCEMENTS diff --git a/man/syncthing-localdisco.7 b/man/syncthing-localdisco.7 index 9a5cddb55..fcda798dc 100644 --- a/man/syncthing-localdisco.7 +++ b/man/syncthing-localdisco.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-LOCALDISCO" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-LOCALDISCO" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-localdisco \- Local Discovery Protocol v4 .SH MODE OF OPERATION diff --git a/man/syncthing-networking.7 b/man/syncthing-networking.7 index a72a62b3c..92c6f72ec 100644 --- a/man/syncthing-networking.7 +++ b/man/syncthing-networking.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-NETWORKING" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-NETWORKING" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-networking \- Firewall Setup .SH ROUTER SETUP diff --git a/man/syncthing-relay.7 b/man/syncthing-relay.7 index ce61b30a8..0481f16b3 100644 --- a/man/syncthing-relay.7 +++ b/man/syncthing-relay.7 @@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-RELAY" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-RELAY" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-relay \- Relay Protocol v1 .SH WHAT IS A RELAY? @@ -105,8 +105,9 @@ If the client fails to send a message (even if it’s a ping message) every minu .SS Temporary protocol submode .sp A temporary protocol submode begins with ConnectRequest message, to which the -relay responds with either ResponseNotFound if the device the client it is after -is not available, or with a SessionInvitation, which contains the unique session +relay responds with ResponseNotFound if the device the client it is after +is not available, with a RelayFull if the relay has reached its limits, +or with a SessionInvitation, which contains the unique session key which then can be used to establish a connection in session mode. .sp The connection is terminated immediately after that. @@ -228,7 +229,7 @@ T} The first and only message the client sends in the session mode is the JoinSessionRequest message which contains the session key identifying which session you are trying to join. The relay responds with one of the following -Response messages: +messages: .INDENT 0.0 .IP 1. 3 ResponseNotFound \- Session key is invalid @@ -238,6 +239,9 @@ ResponseAlreadyConnected \- Session is full (both sides already connected) ResponseSuccess \- You have successfully joined the session .UNINDENT .sp +4. RelayFull \- Relay limits are too strict for you to be able to join the session. +The relay immediately terminates the connection after sending this. +.sp After the successful response, all the bytes written and received will be relayed between the two devices in the session directly. .SS Example Exchange @@ -570,6 +574,21 @@ connection this client should assume it’s getting. The value is inverted in the invitation which is sent to the other device, so that there is always one client socket, and one server socket. .UNINDENT +.SS RelayFull message (Type = 7) +.INDENT 0.0 +.INDENT 3.5 +.sp +.EX + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+\-+ + + +struct RelayFull { +} +.EE +.UNINDENT +.UNINDENT .SH HOW SYNCTHING USES RELAYS, AND GENERAL SECURITY .sp In the case of Syncthing and BEP, when two devices connect via relay, they diff --git a/man/syncthing-rest-api.7 b/man/syncthing-rest-api.7 index 3b8cf65c7..c877677e4 100644 --- a/man/syncthing-rest-api.7 +++ b/man/syncthing-rest-api.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-REST-API" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-REST-API" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-rest-api \- REST API .sp diff --git a/man/syncthing-security.7 b/man/syncthing-security.7 index 9e67f9430..f9dac00fe 100644 --- a/man/syncthing-security.7 +++ b/man/syncthing-security.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-SECURITY" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-SECURITY" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-security \- Security Principles .sp diff --git a/man/syncthing-stignore.5 b/man/syncthing-stignore.5 index 0e8148cc4..9d696b7e1 100644 --- a/man/syncthing-stignore.5 +++ b/man/syncthing-stignore.5 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-STIGNORE" "5" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-STIGNORE" "5" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-stignore \- Prevent files from being synchronized to other nodes .SH SYNOPSIS diff --git a/man/syncthing-versioning.7 b/man/syncthing-versioning.7 index 967a28d6b..f08536bf8 100644 --- a/man/syncthing-versioning.7 +++ b/man/syncthing-versioning.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING-VERSIONING" "7" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING-VERSIONING" "7" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing-versioning \- Keep automatic backups of deleted files by other nodes .sp diff --git a/man/syncthing.1 b/man/syncthing.1 index f939d5c7b..db6f76dbb 100644 --- a/man/syncthing.1 +++ b/man/syncthing.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SYNCTHING" "1" "Apr 21, 2025" "v1.29.3" "Syncthing" +.TH "SYNCTHING" "1" "Apr 26, 2025" "v1.29.3" "Syncthing" .SH NAME syncthing \- Syncthing .SH SYNOPSIS From f61843ef2e3033e44c4d3d4fbb951d98882f0db7 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 29 Apr 2025 14:01:25 -0500 Subject: [PATCH 3/4] build: artifact uploads destination OCI --- .github/workflows/build-syncthing.yaml | 54 +++++++++++++++++--------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-syncthing.yaml b/.github/workflows/build-syncthing.yaml index 84c52fff8..32dc07f98 100644 --- a/.github/workflows/build-syncthing.yaml +++ b/.github/workflows/build-syncthing.yaml @@ -726,10 +726,13 @@ jobs: - name: Push artifacts uses: docker://docker.io/rclone/rclone:latest env: - RCLONE_CONFIG_OBJSTORE_TYPE: ${{ secrets.AZUREBLOB_TYPE }} - RCLONE_CONFIG_OBJSTORE_ACCOUNT: ${{ secrets.AZUREBLOB_ACCOUNT }} - RCLONE_CONFIG_OBJSTORE_KEY: ${{ secrets.AZUREBLOB_KEY }} - RCLONE_AZUREBLOB_ACCESS_TIER: hot + RCLONE_CONFIG_OBJSTORE_TYPE: s3 + RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }} + RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }} + RCLONE_CONFIG_OBJSTORE_ACL: public-read with: args: sync -v packages objstore:nightly @@ -777,20 +780,26 @@ jobs: - name: Push to object store (${{ env.VERSION }}) uses: docker://docker.io/rclone/rclone:latest env: - RCLONE_CONFIG_OBJSTORE_TYPE: ${{ secrets.AZUREBLOB_TYPE }} - RCLONE_CONFIG_OBJSTORE_ACCOUNT: ${{ secrets.AZUREBLOB_ACCOUNT }} - RCLONE_CONFIG_OBJSTORE_KEY: ${{ secrets.AZUREBLOB_KEY }} - RCLONE_AZUREBLOB_ACCESS_TIER: cool + RCLONE_CONFIG_OBJSTORE_TYPE: s3 + RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }} + RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }} + RCLONE_CONFIG_OBJSTORE_ACL: public-read with: args: sync -v packages objstore:release/${{ env.VERSION }} - name: Push to object store (latest) uses: docker://docker.io/rclone/rclone:latest env: - RCLONE_CONFIG_OBJSTORE_TYPE: ${{ secrets.AZUREBLOB_TYPE }} - RCLONE_CONFIG_OBJSTORE_ACCOUNT: ${{ secrets.AZUREBLOB_ACCOUNT }} - RCLONE_CONFIG_OBJSTORE_KEY: ${{ secrets.AZUREBLOB_KEY }} - RCLONE_AZUREBLOB_ACCESS_TIER: hot + RCLONE_CONFIG_OBJSTORE_TYPE: s3 + RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }} + RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }} + RCLONE_CONFIG_OBJSTORE_ACL: public-read with: args: sync -v objstore:release/${{ env.VERSION }} objstore:release/latest @@ -839,9 +848,13 @@ jobs: - name: Pull archive uses: docker://docker.io/rclone/rclone:latest env: - RCLONE_CONFIG_OBJSTORE_TYPE: ${{ secrets.AZUREBLOB_TYPE }} - RCLONE_CONFIG_OBJSTORE_ACCOUNT: ${{ secrets.AZUREBLOB_ACCOUNT }} - RCLONE_CONFIG_OBJSTORE_KEY: ${{ secrets.AZUREBLOB_KEY }} + RCLONE_CONFIG_OBJSTORE_TYPE: s3 + RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }} + RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }} + RCLONE_CONFIG_OBJSTORE_ACL: public-read with: args: sync objstore:apt/dists dists @@ -858,10 +871,13 @@ jobs: - name: Push archive uses: docker://docker.io/rclone/rclone:latest env: - RCLONE_CONFIG_OBJSTORE_TYPE: ${{ secrets.AZUREBLOB_TYPE }} - RCLONE_CONFIG_OBJSTORE_ACCOUNT: ${{ secrets.AZUREBLOB_ACCOUNT }} - RCLONE_CONFIG_OBJSTORE_KEY: ${{ secrets.AZUREBLOB_KEY }} - RCLONE_AZUREBLOB_ACCESS_TIER: hot + RCLONE_CONFIG_OBJSTORE_TYPE: s3 + RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }} + RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }} + RCLONE_CONFIG_OBJSTORE_ACL: public-read with: args: sync -v dists objstore:apt/dists From 0bf21d9db21b9e94327b8d385cc9818b50cc8a14 Mon Sep 17 00:00:00 2001 From: domain <32405309+szu17dmy@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:25:01 +0800 Subject: [PATCH 4/4] fix(strelaysrv): make the session limiter session-dependent (fixes #10072) (#10073) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Purpose Make the session limiter only apply to current session. ### Testing Relay 2 or more sessions and check if the sum of the connection speed can exceed the specified per-session rate. 2 sessions (-global-rate=50000000 and -per-session-rate=6250000): ![图片](https://github.com/user-attachments/assets/133e531a-ed49-4890-aef7-821c628bcfc8) 1 session (-global-rate=50000000 and -per-session-rate=6250000): ![图片](https://github.com/user-attachments/assets/ac89ea53-2d8e-4347-9bbc-4780d85e38d7) --- cmd/strelaysrv/listener.go | 2 +- cmd/strelaysrv/main.go | 4 ---- cmd/strelaysrv/session.go | 8 +++++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/strelaysrv/listener.go b/cmd/strelaysrv/listener.go index 164769047..3c4a2e427 100644 --- a/cmd/strelaysrv/listener.go +++ b/cmd/strelaysrv/listener.go @@ -184,7 +184,7 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config, token strin continue } // requestedPeer is the server, id is the client - ses := newSession(requestedPeer, id, sessionLimiter, globalLimiter) + ses := newSession(requestedPeer, id, sessionLimitBps, globalLimiter) go ses.Serve() diff --git a/cmd/strelaysrv/main.go b/cmd/strelaysrv/main.go index e96e9af86..c1d264081 100644 --- a/cmd/strelaysrv/main.go +++ b/cmd/strelaysrv/main.go @@ -51,7 +51,6 @@ var ( globalLimitBps int overLimit atomic.Bool descriptorLimit int64 - sessionLimiter *rate.Limiter globalLimiter *rate.Limiter networkBufferSize int @@ -228,9 +227,6 @@ func main() { } } - if sessionLimitBps > 0 { - sessionLimiter = rate.NewLimiter(rate.Limit(sessionLimitBps), 2*sessionLimitBps) - } if globalLimitBps > 0 { globalLimiter = rate.NewLimiter(rate.Limit(globalLimitBps), 2*globalLimitBps) } diff --git a/cmd/strelaysrv/session.go b/cmd/strelaysrv/session.go index 1426216e5..79d1184fc 100644 --- a/cmd/strelaysrv/session.go +++ b/cmd/strelaysrv/session.go @@ -27,7 +27,7 @@ var ( bytesProxied atomic.Int64 ) -func newSession(serverid, clientid syncthingprotocol.DeviceID, sessionRateLimit, globalRateLimit *rate.Limiter) *session { +func newSession(serverid, clientid syncthingprotocol.DeviceID, sessionLimitBps int, globalRateLimit *rate.Limiter) *session { serverkey := make([]byte, 32) _, err := rand.Read(serverkey) if err != nil { @@ -40,12 +40,17 @@ func newSession(serverid, clientid syncthingprotocol.DeviceID, sessionRateLimit, return nil } + var sessionRateLimit *rate.Limiter + if sessionLimitBps > 0 { + sessionRateLimit = rate.NewLimiter(rate.Limit(sessionLimitBps), 2*sessionLimitBps) + } ses := &session{ serverkey: serverkey, serverid: serverid, clientkey: clientkey, clientid: clientid, rateLimit: makeRateLimitFunc(sessionRateLimit, globalRateLimit), + limiter: sessionRateLimit, connsChan: make(chan net.Conn), conns: make([]net.Conn, 0, 2), } @@ -109,6 +114,7 @@ type session struct { clientid syncthingprotocol.DeviceID rateLimit func(bytes int) + limiter *rate.Limiter connsChan chan net.Conn conns []net.Conn