Compare commits

...

29 Commits

Author SHA1 Message Date
Jakob Borg
7b3fa8da60 Update translations & docs 2015-12-27 13:26:14 +01:00
Jakob Borg
2fae7ccf5c Ignore error on os.Chtimes in config archiving 2015-12-26 18:25:36 +01:00
Audrius Butkevicius
f36f48c2cf Merge pull request #2596 from andersonvom/load_config
Centralize config loading logic (also fixes #2509)
2015-12-26 16:12:16 +00:00
Jakob Borg
8b726c7e8b Correct GUI asset dir handling (fixes #2621) 2015-12-26 13:32:46 +01:00
Anderson Mesquita
8eb0687407 Update mtime of config file before upgrading (fixes #2509)
This updates the modified time of the config file before archiving it
during an update so that the clean up routine doesn't delete it if it's
too old, preventing the user from being able to rollback after an
upgrade.
2015-12-24 09:27:31 -05:00
Anderson Mesquita
9b9912ba9e Centralize config loading logic
This gets rid of redundant checks and centralizes the logic of loading
the config files so that we don't have to keep doing the same thing in
multiple places.
2015-12-24 09:27:31 -05:00
Anderson Mesquita
22d0ed8225 Fix typo 2015-12-24 09:27:31 -05:00
Jakob Borg
b7a58d2f87 Merge pull request #2620 from andersonvom/issue-2454
Remove fixed footer at first media break (fixes #2454)
2015-12-24 11:26:40 +01:00
Anderson Mesquita
219ece22fc Remove fixed footer at first media break (fixes #2454)
After the first media break (under 1200px), the footer is too long to
fit in a single line, taking up too much space in small screen devices.
This makes it so that it will stop being fixed at the bottom, freeing up
valuable screen real estate.
2015-12-23 22:19:41 -05:00
Jakob Borg
4874301615 Merge pull request #2618 from AudriusButkevicius/svc
Svc -> Service
2015-12-23 21:33:42 +01:00
Audrius Butkevicius
1827dda0c6 Svc -> Service 2015-12-23 15:31:12 +00:00
Jakob Borg
d088b01f75 Rebuild assets 2015-12-23 16:09:42 +01:00
Jakob Borg
00c5062eab Merge branch 'pr/2613'
* pr/2613:
  Add an icon for Safari's pinned tabs
2015-12-23 16:09:31 +01:00
Jakob Borg
84eacde63a Add jgke 2015-12-23 16:09:11 +01:00
Jakob Borg
d98290c17f Merge pull request #2617 from andersonvom/issue-2598
Refactor rwfolder tests
2015-12-23 07:55:47 +01:00
Anderson Mesquita
6d94a3be05 Refactor rwfolder tests
This creates a few utility functions to avoid repetition and removes
some redundant checks.
2015-12-22 23:43:07 -05:00
Audrius Butkevicius
a2833d18ed Merge pull request #2615 from calmh/jsonvv
Humanize serialization of version vectors
2015-12-22 21:12:23 +00:00
Jakob Borg
6f95afdc59 Humanize serialization of version vectors 2015-12-22 21:53:25 +01:00
Jakob Borg
aaa75a32a5 Temporarily patch kardianos/osext to build on FreeBSD 2015-12-22 13:41:04 +01:00
Jaakko Hannikainen
c300015ac2 Add an icon for Safari's pinned tabs
Safari has its own standard for handling icons for pinned tabs,
which requires a black-and-white .svg and a special tag.
Without using this, pinning a tab to localhost will show just
a blank square, instead of a pre-generated letter.
2015-12-22 12:29:59 +02:00
Jakob Borg
eb4f5e9faa Update deps, step two (because I suck) 2015-12-22 09:43:47 +01:00
Jakob Borg
c7aec839ae Merge pull request #2614 from andersonvom/issue-2598
WIP: Consider tempfile when checking for free space (fixes #2598)
2015-12-22 09:42:34 +01:00
Jakob Borg
37aa89b19d Update kardianos/osext (ref #1272) 2015-12-22 09:39:47 +01:00
Anderson Mesquita
3f94e70488 WIP: Consider tempfile when checking for free space (fixes #2598)
Checks the existing blocks that can be reused when downloading a file so
that it only requires the space corresponding to the missing blocks.
This will prevent syncthing from claiming the folder doesn't have enough
space when resuming download of large files after they have been
partially downloaded.
2015-12-21 13:36:08 -05:00
Jakob Borg
435afa0eea Merge pull request #2610 from calmh/fix2608-2
Correctly set default logfile location on Windows (fixes #2608)
2015-12-21 12:26:49 +01:00
Jakob Borg
fb82a5e086 Correctly set default logfile location on Windows (fixes #2608) 2015-12-21 12:19:28 +01:00
Audrius Butkevicius
71d98c2f26 Merge pull request #2609 from calmh/fix2608
Don't crash on stat error in ensureDir (fixes #2608)
2015-12-21 10:35:55 +00:00
Jakob Borg
4a97aa12d6 Don't crash on stat error in ensureDir (fixes #2608)
I'm not really sure under what circumstances MkdirAll returns a nil
error but a subsequent stat fails, but apparently it can happen and we
need to handle it. The "mode >= 0" was a no-op, and we never call
ensureDir anyway without the intention of ensuring the mode, so removed
that.
2015-12-21 09:35:43 +01:00
Audrius Butkevicius
c9e67fb460 Log when we fail to connect to relay 2015-12-20 22:14:13 +00:00
45 changed files with 714 additions and 557 deletions

View File

@@ -35,6 +35,7 @@ Felix Unterpaintner <bigbear2nd@gmail.com>
Francois-Xavier Gsell <fxgsell@gmail.com>
Frank Isemann <frank@isemann.name>
Gilli Sigurdsson <gilli@vx.is>
Jaakko Hannikainen <jgke@jgke.fi>
Jacek Szafarkiewicz <szafar@linux.pl>
Jake Peterson <jake@acogdev.com>
Jakob Borg <jakob@nym.se>

4
Godeps/Godeps.json generated
View File

@@ -1,6 +1,6 @@
{
"ImportPath": "github.com/syncthing/syncthing",
"GoVersion": "go1.5.1",
"GoVersion": "go1.5.2",
"Packages": [
"./cmd/..."
],
@@ -31,7 +31,7 @@
},
{
"ImportPath": "github.com/kardianos/osext",
"Rev": "345163ffe35aa66560a4cd7dddf00f3ae21c9fda"
"Rev": "431e263e413efe4446ede50cec4819b26659fbe7"
},
{
"ImportPath": "github.com/rcrowley/go-metrics",

View File

@@ -7,12 +7,18 @@ package osext
import "path/filepath"
var cx, ce = executableClean()
func executableClean() (string, error) {
p, err := executable()
return filepath.Clean(p), err
}
// Executable returns an absolute path that can be used to
// re-invoke the current program.
// It may not be valid after the current program exits.
func Executable() (string, error) {
p, err := executable()
return filepath.Clean(p), err
return cx, ce
}
// Returns same path as Executable, returns just the folder

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux netbsd solaris dragonfly
// +build linux netbsd solaris dragonfly freebsd
package osext
@@ -27,6 +27,8 @@ func executable() (string, error) {
return execpath, nil
case "netbsd":
return os.Readlink("/proc/curproc/exe")
case "freebsd":
return os.Readlink("/proc/curproc/file")
case "dragonfly":
return os.Readlink("/proc/curproc/file")
case "solaris":

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd openbsd
// +build darwin openbsd
package osext
@@ -53,30 +53,30 @@ func executable() (string, error) {
// NULL terminated arguments.
var args []string
argv := uintptr(unsafe.Pointer(&buf[0]))
Loop:
for {
argp := *(**[1<<20]byte)(unsafe.Pointer(argv))
if argp == nil {
break
}
for i := 0; uintptr(i) < n; i++ {
// we don't want the full arguments list
if string(argp[i]) == " " {
break Loop
}
if argp[i] != 0 {
continue
}
args = append(args, string(argp[:i]))
n -= uintptr(i)
break
}
if n < unsafe.Sizeof(argv) {
break
}
argv += unsafe.Sizeof(argv)
n -= unsafe.Sizeof(argv)
Loop:
for {
argp := *(**[1 << 20]byte)(unsafe.Pointer(argv))
if argp == nil {
break
}
for i := 0; uintptr(i) < n; i++ {
// we don't want the full arguments list
if string(argp[i]) == " " {
break Loop
}
if argp[i] != 0 {
continue
}
args = append(args, string(argp[:i]))
n -= uintptr(i)
break
}
if n < unsafe.Sizeof(argv) {
break
}
argv += unsafe.Sizeof(argv)
n -= unsafe.Sizeof(argv)
}
execPath = args[0]
// There is no canonical way to get an executable path on
// OpenBSD, so check PATH in case we are called directly

1
NICKS
View File

@@ -32,6 +32,7 @@ gillisig <gilli@vx.is>
hadogenes <szafar@linux.pl>
jarlebring <jarlebring@gmail.com>
jedie <github.com@jensdiemer.de> <git@jensdiemer.de>
jgke <jgke@jgke.fi>
jpjp <jamespatterson@operamail.com> <jpjp@users.noreply.github.com>
kamadak <kamada@nanohz.org>
KayoticSully <kayoticsully@gmail.com>

View File

@@ -15,14 +15,14 @@ import (
)
type addressLister struct {
upnpSvc *upnpSvc
cfg *config.Wrapper
upnpService *upnpService
cfg *config.Wrapper
}
func newAddressLister(upnpSvc *upnpSvc, cfg *config.Wrapper) *addressLister {
func newAddressLister(upnpService *upnpService, cfg *config.Wrapper) *addressLister {
return &addressLister{
upnpSvc: upnpSvc,
cfg: cfg,
upnpService: upnpService,
cfg: cfg,
}
}
@@ -73,10 +73,10 @@ func (e *addressLister) addresses(includePrivateIPV4 bool) []string {
}
}
// Get an external port mapping from the upnpSvc, if it has one. If so,
// Get an external port mapping from the upnpService, if it has one. If so,
// add it as another unspecified address.
if e.upnpSvc != nil {
if port := e.upnpSvc.ExternalPort(); port != 0 {
if e.upnpService != nil {
if port := e.upnpService.ExternalPort(); port != 0 {
addrs = append(addrs, fmt.Sprintf("tcp://:%d", port))
}
}

View File

@@ -13,17 +13,17 @@ import (
"github.com/syncthing/syncthing/lib/events"
)
// The auditSvc subscribes to events and writes these in JSON format, one
// The auditService subscribes to events and writes these in JSON format, one
// event per line, to the specified writer.
type auditSvc struct {
type auditService struct {
w io.Writer // audit destination
stop chan struct{} // signals time to stop
started chan struct{} // signals startup complete
stopped chan struct{} // signals stop complete
}
func newAuditSvc(w io.Writer) *auditSvc {
return &auditSvc{
func newAuditService(w io.Writer) *auditService {
return &auditService{
w: w,
stop: make(chan struct{}),
started: make(chan struct{}),
@@ -32,7 +32,7 @@ func newAuditSvc(w io.Writer) *auditSvc {
}
// Serve runs the audit service.
func (s *auditSvc) Serve() {
func (s *auditService) Serve() {
defer close(s.stopped)
sub := events.Default.Subscribe(events.AllEvents)
defer events.Default.Unsubscribe(sub)
@@ -52,18 +52,18 @@ func (s *auditSvc) Serve() {
}
// Stop stops the audit service.
func (s *auditSvc) Stop() {
func (s *auditService) Stop() {
close(s.stop)
}
// WaitForStart returns once the audit service is ready to receive events, or
// immediately if it's already running.
func (s *auditSvc) WaitForStart() {
func (s *auditService) WaitForStart() {
<-s.started
}
// WaitForStop returns once the audit service has stopped.
// (Needed by the tests.)
func (s *auditSvc) WaitForStop() {
func (s *auditService) WaitForStop() {
<-s.stopped
}

View File

@@ -17,13 +17,13 @@ import (
func TestAuditService(t *testing.T) {
buf := new(bytes.Buffer)
svc := newAuditSvc(buf)
service := newAuditService(buf)
// Event sent before start, will not be logged
events.Default.Log(events.Ping, "the first event")
go svc.Serve()
svc.WaitForStart()
go service.Serve()
service.WaitForStart()
// Event that should end up in the audit log
events.Default.Log(events.Ping, "the second event")
@@ -31,8 +31,8 @@ func TestAuditService(t *testing.T) {
// We need to give the events time to arrive, since the channels are buffered etc.
time.Sleep(10 * time.Millisecond)
svc.Stop()
svc.WaitForStop()
service.Stop()
service.WaitForStop()
// This event should not be logged, since we have stopped.
events.Default.Log(events.Ping, "the third event")

View File

@@ -48,16 +48,16 @@ var (
startTime = time.Now()
)
type apiSvc struct {
type apiService struct {
id protocol.DeviceID
cfg *config.Wrapper
assetDir string
model *model.Model
eventSub *events.BufferedSubscription
discoverer *discover.CachingMux
relaySvc *relay.Svc
relayService *relay.Service
listener net.Listener
fss *folderSummarySvc
fss *folderSummaryService
stop chan struct{}
systemConfigMut sync.Mutex
@@ -65,26 +65,26 @@ type apiSvc struct {
systemLog *logger.Recorder
}
func newAPISvc(id protocol.DeviceID, cfg *config.Wrapper, assetDir string, m *model.Model, eventSub *events.BufferedSubscription, discoverer *discover.CachingMux, relaySvc *relay.Svc, errors, systemLog *logger.Recorder) (*apiSvc, error) {
svc := &apiSvc{
func newAPIService(id protocol.DeviceID, cfg *config.Wrapper, assetDir string, m *model.Model, eventSub *events.BufferedSubscription, discoverer *discover.CachingMux, relayService *relay.Service, errors, systemLog *logger.Recorder) (*apiService, error) {
service := &apiService{
id: id,
cfg: cfg,
assetDir: assetDir,
model: m,
eventSub: eventSub,
discoverer: discoverer,
relaySvc: relaySvc,
relayService: relayService,
systemConfigMut: sync.NewMutex(),
guiErrors: errors,
systemLog: systemLog,
}
var err error
svc.listener, err = svc.getListener(cfg.GUI())
return svc, err
service.listener, err = service.getListener(cfg.GUI())
return service, err
}
func (s *apiSvc) getListener(guiCfg config.GUIConfiguration) (net.Listener, error) {
func (s *apiService) getListener(guiCfg config.GUIConfiguration) (net.Listener, error) {
cert, err := tls.LoadX509KeyPair(locations[locHTTPSCertFile], locations[locHTTPSKeyFile])
if err != nil {
l.Infoln("Loading HTTPS certificate:", err)
@@ -135,7 +135,7 @@ func sendJSON(w http.ResponseWriter, jsonObject interface{}) {
json.NewEncoder(w).Encode(jsonObject)
}
func (s *apiSvc) Serve() {
func (s *apiService) Serve() {
s.stop = make(chan struct{})
// The GET handlers
@@ -229,7 +229,7 @@ func (s *apiSvc) Serve() {
ReadTimeout: 10 * time.Second,
}
s.fss = newFolderSummarySvc(s.cfg, s.model)
s.fss = newFolderSummaryService(s.cfg, s.model)
defer s.fss.Stop()
s.fss.ServeBackground()
@@ -247,20 +247,20 @@ func (s *apiSvc) Serve() {
}
}
func (s *apiSvc) Stop() {
func (s *apiService) Stop() {
close(s.stop)
s.listener.Close()
}
func (s *apiSvc) String() string {
return fmt.Sprintf("apiSvc@%p", s)
func (s *apiService) String() string {
return fmt.Sprintf("apiService@%p", s)
}
func (s *apiSvc) VerifyConfiguration(from, to config.Configuration) error {
func (s *apiService) VerifyConfiguration(from, to config.Configuration) error {
return nil
}
func (s *apiSvc) CommitConfiguration(from, to config.Configuration) bool {
func (s *apiService) CommitConfiguration(from, to config.Configuration) bool {
if to.GUI == from.GUI {
return true
}
@@ -370,11 +370,11 @@ func withDetailsMiddleware(id protocol.DeviceID, h http.Handler) http.Handler {
})
}
func (s *apiSvc) restPing(w http.ResponseWriter, r *http.Request) {
func (s *apiService) restPing(w http.ResponseWriter, r *http.Request) {
sendJSON(w, map[string]string{"ping": "pong"})
}
func (s *apiSvc) getSystemVersion(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemVersion(w http.ResponseWriter, r *http.Request) {
sendJSON(w, map[string]string{
"version": Version,
"codename": Codename,
@@ -384,7 +384,7 @@ func (s *apiSvc) getSystemVersion(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) getSystemDebug(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemDebug(w http.ResponseWriter, r *http.Request) {
names := l.Facilities()
enabled := l.FacilityDebugging()
sort.Strings(enabled)
@@ -394,7 +394,7 @@ func (s *apiSvc) getSystemDebug(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) postSystemDebug(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemDebug(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
q := r.URL.Query()
for _, f := range strings.Split(q.Get("enable"), ",") {
@@ -413,7 +413,7 @@ func (s *apiSvc) postSystemDebug(w http.ResponseWriter, r *http.Request) {
}
}
func (s *apiSvc) getDBBrowse(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBBrowse(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
prefix := qs.Get("prefix")
@@ -427,7 +427,7 @@ func (s *apiSvc) getDBBrowse(w http.ResponseWriter, r *http.Request) {
sendJSON(w, s.model.GlobalDirectoryTree(folder, prefix, levels, dirsonly))
}
func (s *apiSvc) getDBCompletion(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBCompletion(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
var folder = qs.Get("folder")
var deviceStr = qs.Get("device")
@@ -443,7 +443,7 @@ func (s *apiSvc) getDBCompletion(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) getDBStatus(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBStatus(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
sendJSON(w, folderSummary(s.cfg, s.model, folder))
@@ -488,13 +488,13 @@ func folderSummary(cfg *config.Wrapper, m *model.Model, folder string) map[strin
return res
}
func (s *apiSvc) postDBOverride(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postDBOverride(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
var folder = qs.Get("folder")
go s.model.Override(folder)
}
func (s *apiSvc) getDBNeed(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBNeed(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
@@ -521,19 +521,19 @@ func (s *apiSvc) getDBNeed(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) getSystemConnections(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemConnections(w http.ResponseWriter, r *http.Request) {
sendJSON(w, s.model.ConnectionStats())
}
func (s *apiSvc) getDeviceStats(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDeviceStats(w http.ResponseWriter, r *http.Request) {
sendJSON(w, s.model.DeviceStatistics())
}
func (s *apiSvc) getFolderStats(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getFolderStats(w http.ResponseWriter, r *http.Request) {
sendJSON(w, s.model.FolderStatistics())
}
func (s *apiSvc) getDBFile(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBFile(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
file := qs.Get("file")
@@ -548,11 +548,11 @@ func (s *apiSvc) getDBFile(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) getSystemConfig(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemConfig(w http.ResponseWriter, r *http.Request) {
sendJSON(w, s.cfg.Raw())
}
func (s *apiSvc) postSystemConfig(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemConfig(w http.ResponseWriter, r *http.Request) {
s.systemConfigMut.Lock()
defer s.systemConfigMut.Unlock()
@@ -595,16 +595,16 @@ func (s *apiSvc) postSystemConfig(w http.ResponseWriter, r *http.Request) {
s.cfg.Save()
}
func (s *apiSvc) getSystemConfigInsync(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemConfigInsync(w http.ResponseWriter, r *http.Request) {
sendJSON(w, map[string]bool{"configInSync": configInSync})
}
func (s *apiSvc) postSystemRestart(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemRestart(w http.ResponseWriter, r *http.Request) {
s.flushResponse(`{"ok": "restarting"}`, w)
go restart()
}
func (s *apiSvc) postSystemReset(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemReset(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
folder := qs.Get("folder")
@@ -630,12 +630,12 @@ func (s *apiSvc) postSystemReset(w http.ResponseWriter, r *http.Request) {
go restart()
}
func (s *apiSvc) postSystemShutdown(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemShutdown(w http.ResponseWriter, r *http.Request) {
s.flushResponse(`{"ok": "shutting down"}`, w)
go shutdown()
}
func (s *apiSvc) flushResponse(resp string, w http.ResponseWriter) {
func (s *apiService) flushResponse(resp string, w http.ResponseWriter) {
w.Write([]byte(resp + "\n"))
f := w.(http.Flusher)
f.Flush()
@@ -644,7 +644,7 @@ func (s *apiSvc) flushResponse(resp string, w http.ResponseWriter) {
var cpuUsagePercent [10]float64 // The last ten seconds
var cpuUsageLock = sync.NewRWMutex()
func (s *apiSvc) getSystemStatus(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemStatus(w http.ResponseWriter, r *http.Request) {
var m runtime.MemStats
runtime.ReadMemStats(&m)
@@ -668,12 +668,12 @@ func (s *apiSvc) getSystemStatus(w http.ResponseWriter, r *http.Request) {
res["discoveryMethods"] = discoMethods
res["discoveryErrors"] = discoErrors
}
if s.relaySvc != nil {
if s.relayService != nil {
res["relaysEnabled"] = true
relayClientStatus := make(map[string]bool)
relayClientLatency := make(map[string]int)
for _, relay := range s.relaySvc.Relays() {
latency, ok := s.relaySvc.RelayStatus(relay)
for _, relay := range s.relayService.Relays() {
latency, ok := s.relayService.RelayStatus(relay)
relayClientStatus[relay] = ok
relayClientLatency[relay] = int(latency / time.Millisecond)
}
@@ -694,23 +694,23 @@ func (s *apiSvc) getSystemStatus(w http.ResponseWriter, r *http.Request) {
sendJSON(w, res)
}
func (s *apiSvc) getSystemError(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemError(w http.ResponseWriter, r *http.Request) {
sendJSON(w, map[string][]logger.Line{
"errors": s.guiErrors.Since(time.Time{}),
})
}
func (s *apiSvc) postSystemError(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemError(w http.ResponseWriter, r *http.Request) {
bs, _ := ioutil.ReadAll(r.Body)
r.Body.Close()
l.Warnln(string(bs))
}
func (s *apiSvc) postSystemErrorClear(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemErrorClear(w http.ResponseWriter, r *http.Request) {
s.guiErrors.Clear()
}
func (s *apiSvc) getSystemLog(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemLog(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
since, err := time.Parse(time.RFC3339, q.Get("since"))
l.Debugln(err)
@@ -719,7 +719,7 @@ func (s *apiSvc) getSystemLog(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) getSystemLogTxt(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemLogTxt(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
since, err := time.Parse(time.RFC3339, q.Get("since"))
l.Debugln(err)
@@ -730,7 +730,7 @@ func (s *apiSvc) getSystemLogTxt(w http.ResponseWriter, r *http.Request) {
}
}
func (s *apiSvc) getSystemHTTPMetrics(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemHTTPMetrics(w http.ResponseWriter, r *http.Request) {
stats := make(map[string]interface{})
metrics.Each(func(name string, intf interface{}) {
if m, ok := intf.(*metrics.StandardTimer); ok {
@@ -750,7 +750,7 @@ func (s *apiSvc) getSystemHTTPMetrics(w http.ResponseWriter, r *http.Request) {
w.Write(bs)
}
func (s *apiSvc) getSystemDiscovery(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemDiscovery(w http.ResponseWriter, r *http.Request) {
devices := make(map[string]discover.CacheEntry)
if s.discoverer != nil {
@@ -765,11 +765,11 @@ func (s *apiSvc) getSystemDiscovery(w http.ResponseWriter, r *http.Request) {
sendJSON(w, devices)
}
func (s *apiSvc) getReport(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getReport(w http.ResponseWriter, r *http.Request) {
sendJSON(w, reportData(s.cfg, s.model))
}
func (s *apiSvc) getDBIgnores(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBIgnores(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
ignores, patterns, err := s.model.GetIgnores(qs.Get("folder"))
@@ -784,7 +784,7 @@ func (s *apiSvc) getDBIgnores(w http.ResponseWriter, r *http.Request) {
})
}
func (s *apiSvc) postDBIgnores(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postDBIgnores(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
var data map[string][]string
@@ -805,7 +805,7 @@ func (s *apiSvc) postDBIgnores(w http.ResponseWriter, r *http.Request) {
s.getDBIgnores(w, r)
}
func (s *apiSvc) getEvents(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getEvents(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
sinceStr := qs.Get("since")
limitStr := qs.Get("limit")
@@ -827,7 +827,7 @@ func (s *apiSvc) getEvents(w http.ResponseWriter, r *http.Request) {
sendJSON(w, evs)
}
func (s *apiSvc) getSystemUpgrade(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemUpgrade(w http.ResponseWriter, r *http.Request) {
if noUpgrade {
http.Error(w, upgrade.ErrUpgradeUnsupported.Error(), 500)
return
@@ -846,7 +846,7 @@ func (s *apiSvc) getSystemUpgrade(w http.ResponseWriter, r *http.Request) {
sendJSON(w, res)
}
func (s *apiSvc) getDeviceID(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDeviceID(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
idStr := qs.Get("id")
id, err := protocol.DeviceIDFromString(idStr)
@@ -862,7 +862,7 @@ func (s *apiSvc) getDeviceID(w http.ResponseWriter, r *http.Request) {
}
}
func (s *apiSvc) getLang(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getLang(w http.ResponseWriter, r *http.Request) {
lang := r.Header.Get("Accept-Language")
var langs []string
for _, l := range strings.Split(lang, ",") {
@@ -872,7 +872,7 @@ func (s *apiSvc) getLang(w http.ResponseWriter, r *http.Request) {
sendJSON(w, langs)
}
func (s *apiSvc) postSystemUpgrade(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemUpgrade(w http.ResponseWriter, r *http.Request) {
rel, err := upgrade.LatestRelease(s.cfg.Options().ReleasesURL, Version)
if err != nil {
l.Warnln("getting latest release:", err)
@@ -894,7 +894,7 @@ func (s *apiSvc) postSystemUpgrade(w http.ResponseWriter, r *http.Request) {
}
}
func (s *apiSvc) postSystemPause(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemPause(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
var deviceStr = qs.Get("device")
@@ -907,7 +907,7 @@ func (s *apiSvc) postSystemPause(w http.ResponseWriter, r *http.Request) {
s.model.PauseDevice(device)
}
func (s *apiSvc) postSystemResume(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postSystemResume(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
var deviceStr = qs.Get("device")
@@ -920,7 +920,7 @@ func (s *apiSvc) postSystemResume(w http.ResponseWriter, r *http.Request) {
s.model.ResumeDevice(device)
}
func (s *apiSvc) postDBScan(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postDBScan(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
if folder != "" {
@@ -946,7 +946,7 @@ func (s *apiSvc) postDBScan(w http.ResponseWriter, r *http.Request) {
}
}
func (s *apiSvc) postDBPrio(w http.ResponseWriter, r *http.Request) {
func (s *apiService) postDBPrio(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
folder := qs.Get("folder")
file := qs.Get("file")
@@ -954,7 +954,7 @@ func (s *apiSvc) postDBPrio(w http.ResponseWriter, r *http.Request) {
s.getDBNeed(w, r)
}
func (s *apiSvc) getQR(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getQR(w http.ResponseWriter, r *http.Request) {
var qs = r.URL.Query()
var text = qs.Get("text")
code, err := qr.Encode(text, qr.M)
@@ -967,7 +967,7 @@ func (s *apiSvc) getQR(w http.ResponseWriter, r *http.Request) {
w.Write(code.PNG())
}
func (s *apiSvc) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
tot := map[string]float64{}
count := map[string]float64{}
@@ -991,7 +991,7 @@ func (s *apiSvc) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
sendJSON(w, comp)
}
func (s *apiSvc) getSystemBrowse(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getSystemBrowse(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
current := qs.Get("current")
search, _ := osutil.ExpandTilde(current)
@@ -1097,7 +1097,7 @@ func (s embeddedStatic) mimeTypeForFile(file string) string {
}
}
func (s *apiSvc) toNeedSlice(fs []db.FileInfoTruncated) []jsonDBFileInfo {
func (s *apiService) toNeedSlice(fs []db.FileInfoTruncated) []jsonDBFileInfo {
res := make([]jsonDBFileInfo, len(fs))
for i, f := range fs {
res[i] = jsonDBFileInfo(f)

View File

@@ -222,20 +222,19 @@ func defaultRuntimeOptions() RuntimeOptions {
assetDir: os.Getenv("STGUIASSETS"),
cpuProfile: os.Getenv("STCPUPROFILE") != "",
stRestarting: os.Getenv("STRESTART") != "",
logFile: "-", // Output to stdout
logFlags: log.Ltime,
}
if options.assetDir != "" {
options.assetDir = locations[locGUIAssets]
}
if os.Getenv("STTRACE") != "" {
options.logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile
}
if runtime.GOOS == "windows" {
options.logFile = locations[locLogFile]
if runtime.GOOS != "windows" {
// On non-Windows, we explicitly default to "-" which means stdout. On
// Windows, the blank options.logFile will later be replaced with the
// default path, unless the user has manually specified "-" or
// something else.
options.logFile = "-"
}
return options
@@ -299,6 +298,18 @@ func main() {
l.Fatalln(err)
}
if options.logFile == "" {
// Blank means use the default logfile location. We must set this
// *after* expandLocations above.
options.logFile = locations[locLogFile]
}
if options.assetDir == "" {
// The asset dir is blank if STGUIASSETS wasn't set, in which case we
// should look for extra assets in the default place.
options.assetDir = locations[locGUIAssets]
}
if options.showVersion {
fmt.Println(LongVersion)
return
@@ -350,10 +361,7 @@ func main() {
}
func openGUI() {
cfg, _, err := loadConfig(locations[locConfigFile])
if err != nil {
l.Fatalln("Config:", err)
}
cfg, _ := loadConfig()
if cfg.GUI().Enabled {
openURL(cfg.GUI().URL())
} else {
@@ -424,10 +432,8 @@ func debugFacilities() string {
}
func checkUpgrade() upgrade.Release {
releasesURL := "https://api.github.com/repos/syncthing/syncthing/releases?per_page=30"
if cfg, _, err := loadConfig(locations[locConfigFile]); err == nil {
releasesURL = cfg.Options().ReleasesURL
}
cfg, _ := loadConfig()
releasesURL := cfg.Options().ReleasesURL
release, err := upgrade.LatestRelease(releasesURL, Version)
if err != nil {
l.Fatalln("Upgrade:", err)
@@ -464,10 +470,7 @@ func performUpgrade(release upgrade.Release) {
}
func upgradeViaRest() error {
cfg, err := config.Load(locations[locConfigFile], protocol.LocalDeviceID)
if err != nil {
return err
}
cfg, _ := loadConfig()
target := cfg.GUI().URL()
r, _ := http.NewRequest("POST", target+"/rest/system/upgrade", nil)
r.Header.Set("X-API-Key", cfg.GUI().APIKey())
@@ -502,23 +505,23 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Create a main service manager. We'll add things to this as we go along.
// We want any logging it does to go through our log system.
mainSvc := suture.New("main", suture.Spec{
mainService := suture.New("main", suture.Spec{
Log: func(line string) {
l.Debugln(line)
},
})
mainSvc.ServeBackground()
mainService.ServeBackground()
// Set a log prefix similar to the ID we will have later on, or early log
// lines look ugly.
l.SetPrefix("[start] ")
if runtimeOptions.auditEnabled {
startAuditing(mainSvc)
startAuditing(mainService)
}
if runtimeOptions.verbose {
mainSvc.Add(newVerboseSvc())
mainService.Add(newVerboseService())
}
errors := logger.NewRecorder(l, logger.LevelWarn, maxSystemErrors, 0)
@@ -564,37 +567,10 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
"myID": myID.String(),
})
// Prepare to be able to save configuration
cfgFile := locations[locConfigFile]
// Load the configuration file, if it exists.
// If it does not, create a template.
cfg, myName, err := loadConfig(cfgFile)
if err != nil {
if os.IsNotExist(err) {
l.Infoln("No config file; starting with empty defaults")
myName, _ = os.Hostname()
newCfg := defaultConfig(myName)
cfg = config.Wrap(cfgFile, newCfg)
cfg.Save()
l.Infof("Edit %s to taste or use the GUI\n", cfgFile)
} else {
l.Fatalln("Loading config:", err)
}
}
if cfg.Raw().OriginalVersion != config.CurrentVersion {
l.Infoln("Archiving a copy of old config file format")
// Archive a copy
osutil.Rename(cfgFile, cfgFile+fmt.Sprintf(".v%d", cfg.Raw().OriginalVersion))
// Save the new version
cfg.Save()
}
cfg := loadOrCreateConfig()
if err := checkShortIDs(cfg); err != nil {
l.Fatalln("Short device IDs are in conflict. Unlucky!\n Regenerate the device ID of one if the following:\n ", err)
l.Fatalln("Short device IDs are in conflict. Unlucky!\n Regenerate the device ID of one of the following:\n ", err)
}
if len(runtimeOptions.profiler) > 0 {
@@ -684,7 +660,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
l.Infoln("Compacting database:", err)
}
m := model.NewModel(cfg, myID, myName, "syncthing", Version, ldb, protectedFiles)
m := model.NewModel(cfg, myID, myDeviceName(cfg), "syncthing", Version, ldb, protectedFiles)
cfg.Subscribe(m)
if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 {
@@ -722,7 +698,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
}
}
mainSvc.Add(m)
mainService.Add(m)
// The default port we announce, possibly modified by setupUPnP next.
@@ -743,33 +719,33 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Start UPnP
if opts.UPnPEnabled {
upnpSvc := newUPnPSvc(cfg, addr.Port)
mainSvc.Add(upnpSvc)
upnpService := newUPnPService(cfg, addr.Port)
mainService.Add(upnpService)
// The external address tracker needs to know about the UPnP service
// so it can check for an external mapped port.
addrList = newAddressLister(upnpSvc, cfg)
addrList = newAddressLister(upnpService, cfg)
} else {
addrList = newAddressLister(nil, cfg)
}
// Start relay management
var relaySvc *relay.Svc
var relayService *relay.Service
if opts.RelaysEnabled && (opts.GlobalAnnEnabled || opts.RelayWithoutGlobalAnn) {
relaySvc = relay.NewSvc(cfg, tlsCfg)
mainSvc.Add(relaySvc)
relayService = relay.NewService(cfg, tlsCfg)
mainService.Add(relayService)
}
// Start discovery
cachedDiscovery := discover.NewCachingMux()
mainSvc.Add(cachedDiscovery)
mainService.Add(cachedDiscovery)
if cfg.Options().GlobalAnnEnabled {
for _, srv := range cfg.GlobalDiscoveryServers() {
l.Infoln("Using discovery server", srv)
gd, err := discover.NewGlobal(srv, cert, addrList, relaySvc)
gd, err := discover.NewGlobal(srv, cert, addrList, relayService)
if err != nil {
l.Warnln("Global discovery:", err)
continue
@@ -784,14 +760,14 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
if cfg.Options().LocalAnnEnabled {
// v4 broadcasts
bcd, err := discover.NewLocal(myID, fmt.Sprintf(":%d", cfg.Options().LocalAnnPort), addrList, relaySvc)
bcd, err := discover.NewLocal(myID, fmt.Sprintf(":%d", cfg.Options().LocalAnnPort), addrList, relayService)
if err != nil {
l.Warnln("IPv4 local discovery:", err)
} else {
cachedDiscovery.Add(bcd, 0, 0, ipv4LocalDiscoveryPriority)
}
// v6 multicasts
mcd, err := discover.NewLocal(myID, cfg.Options().LocalAnnMCAddr, addrList, relaySvc)
mcd, err := discover.NewLocal(myID, cfg.Options().LocalAnnMCAddr, addrList, relayService)
if err != nil {
l.Warnln("IPv6 local discovery:", err)
} else {
@@ -801,12 +777,12 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// GUI
setupGUI(mainSvc, cfg, m, apiSub, cachedDiscovery, relaySvc, errors, systemLog, runtimeOptions)
setupGUI(mainService, cfg, m, apiSub, cachedDiscovery, relayService, errors, systemLog, runtimeOptions)
// Start connection management
connectionSvc := connections.NewConnectionSvc(cfg, myID, m, tlsCfg, cachedDiscovery, relaySvc, bepProtocolName, tlsDefaultCommonName, lans)
mainSvc.Add(connectionSvc)
connectionService := connections.NewConnectionService(cfg, myID, m, tlsCfg, cachedDiscovery, relayService, bepProtocolName, tlsDefaultCommonName, lans)
mainService.Add(connectionService)
if runtimeOptions.cpuProfile {
f, err := os.Create(fmt.Sprintf("cpu-%d.pprof", os.Getpid()))
@@ -866,7 +842,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
code := <-stop
mainSvc.Stop()
mainService.Stop()
l.Okln("Exiting")
@@ -877,6 +853,15 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
os.Exit(code)
}
func myDeviceName(cfg *config.Wrapper) string {
devices := cfg.Devices()
myName := devices[myID].Name
if myName == "" {
myName, _ = os.Hostname()
}
return myName
}
func setupSignalHandling() {
// Exit cleanly with "restarting" code on SIGHUP.
@@ -915,47 +900,71 @@ func printHashRate() {
l.Infof("Single thread hash performance is ~%.*f MB/s", decimals, hashRate)
}
func loadConfig(cfgFile string) (*config.Wrapper, string, error) {
info, err := os.Stat(cfgFile)
if err != nil {
return nil, "", err
}
if !info.Mode().IsRegular() {
return nil, "", errors.New("configuration is not a file")
}
func loadConfig() (*config.Wrapper, error) {
cfgFile := locations[locConfigFile]
cfg, err := config.Load(cfgFile, myID)
if err != nil {
return nil, "", err
l.Infoln("Error loading config file; using defaults for now")
myName, _ := os.Hostname()
newCfg := defaultConfig(myName)
cfg = config.Wrap(cfgFile, newCfg)
}
myCfg := cfg.Devices()[myID]
myName := myCfg.Name
if myName == "" {
myName, _ = os.Hostname()
}
return cfg, myName, nil
return cfg, err
}
func startAuditing(mainSvc *suture.Supervisor) {
func loadOrCreateConfig() *config.Wrapper {
cfg, err := loadConfig()
if os.IsNotExist(err) {
cfg.Save()
l.Infof("Defaults saved. Edit %s to taste or use the GUI\n", cfg.ConfigPath())
} else if err != nil {
l.Fatalln("Config:", err)
}
if cfg.Raw().OriginalVersion != config.CurrentVersion {
err = archiveAndSaveConfig(cfg)
if err != nil {
l.Fatalln("Config archive:", err)
}
}
return cfg
}
func archiveAndSaveConfig(cfg *config.Wrapper) error {
// To prevent previous config from being cleaned up, quickly touch it too
now := time.Now()
_ = os.Chtimes(cfg.ConfigPath(), now, now) // May return error on Android etc; no worries
archivePath := cfg.ConfigPath() + fmt.Sprintf(".v%d", cfg.Raw().OriginalVersion)
l.Infoln("Archiving a copy of old config file format at:", archivePath)
if err := osutil.Rename(cfg.ConfigPath(), archivePath); err != nil {
return err
}
return cfg.Save()
}
func startAuditing(mainService *suture.Supervisor) {
auditFile := timestampedLoc(locAuditLog)
fd, err := os.OpenFile(auditFile, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
if err != nil {
l.Fatalln("Audit:", err)
}
auditSvc := newAuditSvc(fd)
mainSvc.Add(auditSvc)
auditService := newAuditService(fd)
mainService.Add(auditService)
// We wait for the audit service to fully start before we return, to
// ensure we capture all events from the start.
auditSvc.WaitForStart()
auditService.WaitForStart()
l.Infoln("Audit log in", auditFile)
}
func setupGUI(mainSvc *suture.Supervisor, cfg *config.Wrapper, m *model.Model, apiSub *events.BufferedSubscription, discoverer *discover.CachingMux, relaySvc *relay.Svc, errors, systemLog *logger.Recorder, runtimeOptions RuntimeOptions) {
func setupGUI(mainService *suture.Supervisor, cfg *config.Wrapper, m *model.Model, apiSub *events.BufferedSubscription, discoverer *discover.CachingMux, relayService *relay.Service, errors, systemLog *logger.Recorder, runtimeOptions RuntimeOptions) {
guiCfg := cfg.GUI()
if !guiCfg.Enabled {
@@ -966,12 +975,12 @@ func setupGUI(mainSvc *suture.Supervisor, cfg *config.Wrapper, m *model.Model, a
l.Warnln("Insecure admin access is enabled.")
}
api, err := newAPISvc(myID, cfg, runtimeOptions.assetDir, m, apiSub, discoverer, relaySvc, errors, systemLog)
api, err := newAPIService(myID, cfg, runtimeOptions.assetDir, m, apiSub, discoverer, relayService, errors, systemLog)
if err != nil {
l.Fatalln("Cannot start GUI:", err)
}
cfg.Subscribe(api)
mainSvc.Add(api)
mainService.Add(api)
if cfg.Options().StartBrowser && !runtimeOptions.noBrowser && !runtimeOptions.stRestarting {
// Can potentially block if the utility we are invoking doesn't
@@ -1036,13 +1045,17 @@ func ensureDir(dir string, mode os.FileMode) {
l.Fatalln(err)
}
fi, _ := os.Stat(dir)
currentMode := fi.Mode() & 0777
if mode >= 0 && currentMode != mode {
err := os.Chmod(dir, mode)
// This can fail on crappy filesystems, nothing we can do about it.
if err != nil {
l.Warnln(err)
if fi, err := os.Stat(dir); err == nil {
// Apprently the stat may fail even though the mkdirall passed. If it
// does, we'll just assume things are in order and let other things
// fail (like loading or creating the config...).
currentMode := fi.Mode() & 0777
if currentMode != mode {
err := os.Chmod(dir, mode)
// This can fail on crappy filesystems, nothing we can do about it.
if err != nil {
l.Warnln(err)
}
}
}
}

View File

@@ -16,9 +16,9 @@ import (
"github.com/thejerf/suture"
)
// The folderSummarySvc adds summary information events (FolderSummary and
// The folderSummaryService adds summary information events (FolderSummary and
// FolderCompletion) into the event stream at certain intervals.
type folderSummarySvc struct {
type folderSummaryService struct {
*suture.Supervisor
cfg *config.Wrapper
@@ -35,9 +35,9 @@ type folderSummarySvc struct {
lastEventReqMut sync.Mutex
}
func newFolderSummarySvc(cfg *config.Wrapper, m *model.Model) *folderSummarySvc {
svc := &folderSummarySvc{
Supervisor: suture.NewSimple("folderSummarySvc"),
func newFolderSummaryService(cfg *config.Wrapper, m *model.Model) *folderSummaryService {
service := &folderSummaryService{
Supervisor: suture.NewSimple("folderSummaryService"),
cfg: cfg,
model: m,
stop: make(chan struct{}),
@@ -47,20 +47,20 @@ func newFolderSummarySvc(cfg *config.Wrapper, m *model.Model) *folderSummarySvc
lastEventReqMut: sync.NewMutex(),
}
svc.Add(serviceFunc(svc.listenForUpdates))
svc.Add(serviceFunc(svc.calculateSummaries))
service.Add(serviceFunc(service.listenForUpdates))
service.Add(serviceFunc(service.calculateSummaries))
return svc
return service
}
func (c *folderSummarySvc) Stop() {
func (c *folderSummaryService) Stop() {
c.Supervisor.Stop()
close(c.stop)
}
// listenForUpdates subscribes to the event bus and makes note of folders that
// need their data recalculated.
func (c *folderSummarySvc) listenForUpdates() {
func (c *folderSummaryService) listenForUpdates() {
sub := events.Default.Subscribe(events.LocalIndexUpdated | events.RemoteIndexUpdated | events.StateChanged)
defer events.Default.Unsubscribe(sub)
@@ -110,7 +110,7 @@ func (c *folderSummarySvc) listenForUpdates() {
// calculateSummaries periodically recalculates folder summaries and
// completion percentage, and sends the results on the event bus.
func (c *folderSummarySvc) calculateSummaries() {
func (c *folderSummaryService) calculateSummaries() {
const pumpInterval = 2 * time.Second
pump := time.NewTimer(pumpInterval)
@@ -139,7 +139,7 @@ func (c *folderSummarySvc) calculateSummaries() {
// foldersToHandle returns the list of folders needing a summary update, and
// clears the list.
func (c *folderSummarySvc) foldersToHandle() []string {
func (c *folderSummaryService) foldersToHandle() []string {
// We only recalculate summaries if someone is listening to events
// (a request to /rest/events has been made within the last
// pingEventInterval).
@@ -162,7 +162,7 @@ func (c *folderSummarySvc) foldersToHandle() []string {
}
// sendSummary send the summary events for a single folder
func (c *folderSummarySvc) sendSummary(folder string) {
func (c *folderSummaryService) sendSummary(folder string) {
// The folder summary contains how many bytes, files etc
// are in the folder and how in sync we are.
data := folderSummary(c.cfg, c.model, folder)
@@ -192,7 +192,7 @@ func (c *folderSummarySvc) sendSummary(folder string) {
}
}
func (c *folderSummarySvc) gotEventRequest() {
func (c *folderSummaryService) gotEventRequest() {
c.lastEventReqMut.Lock()
c.lastEventReq = time.Now()
c.lastEventReqMut.Unlock()

View File

@@ -18,7 +18,7 @@ import (
// The UPnP service runs a loop for discovery of IGDs (Internet Gateway
// Devices) and setup/renewal of a port mapping.
type upnpSvc struct {
type upnpService struct {
cfg *config.Wrapper
localPort int
extPort int
@@ -26,15 +26,15 @@ type upnpSvc struct {
stop chan struct{}
}
func newUPnPSvc(cfg *config.Wrapper, localPort int) *upnpSvc {
return &upnpSvc{
func newUPnPService(cfg *config.Wrapper, localPort int) *upnpService {
return &upnpService{
cfg: cfg,
localPort: localPort,
extPortMut: sync.NewMutex(),
}
}
func (s *upnpSvc) Serve() {
func (s *upnpService) Serve() {
foundIGD := true
s.stop = make(chan struct{})
@@ -72,18 +72,18 @@ func (s *upnpSvc) Serve() {
}
}
func (s *upnpSvc) Stop() {
func (s *upnpService) Stop() {
close(s.stop)
}
func (s *upnpSvc) ExternalPort() int {
func (s *upnpService) ExternalPort() int {
s.extPortMut.Lock()
port := s.extPort
s.extPortMut.Unlock()
return port
}
func (s *upnpSvc) tryIGDs(igds []upnp.IGD, prevExtPort int) int {
func (s *upnpService) tryIGDs(igds []upnp.IGD, prevExtPort int) int {
// Lets try all the IGDs we found and use the first one that works.
// TODO: Use all of them, and sort out the resulting mess to the
// discovery announcement code...
@@ -105,7 +105,7 @@ func (s *upnpSvc) tryIGDs(igds []upnp.IGD, prevExtPort int) int {
return 0
}
func (s *upnpSvc) tryIGD(igd upnp.IGD, suggestedPort int) (int, error) {
func (s *upnpService) tryIGD(igd upnp.IGD, suggestedPort int) (int, error) {
var err error
leaseTime := s.cfg.Options().UPnPLeaseM * 60

View File

@@ -60,9 +60,9 @@ func (m *usageReportingManager) VerifyConfiguration(from, to config.Configuratio
func (m *usageReportingManager) CommitConfiguration(from, to config.Configuration) bool {
if to.Options.URAccepted >= usageReportVersion && m.sup == nil {
// Usage reporting was turned on; lets start it.
svc := newUsageReportingService(m.cfg, m.model)
service := newUsageReportingService(m.cfg, m.model)
m.sup = suture.NewSimple("usageReporting")
m.sup.Add(svc)
m.sup.Add(service)
m.sup.ServeBackground()
} else if to.Options.URAccepted < usageReportVersion && m.sup != nil {
// Usage reporting was turned off
@@ -78,7 +78,7 @@ func (m *usageReportingManager) String() string {
}
// reportData returns the data to be sent in a usage report. It's used in
// various places, so not part of the usageReportingSvc object.
// various places, so not part of the usageReportingManager object.
func reportData(cfg *config.Wrapper, m *model.Model) map[string]interface{} {
res := make(map[string]interface{})
res["urVersion"] = usageReportVersion

View File

@@ -15,20 +15,20 @@ import (
// The verbose logging service subscribes to events and prints these in
// verbose format to the console using INFO level.
type verboseSvc struct {
type verboseService struct {
stop chan struct{} // signals time to stop
started chan struct{} // signals startup complete
}
func newVerboseSvc() *verboseSvc {
return &verboseSvc{
func newVerboseService() *verboseService {
return &verboseService{
stop: make(chan struct{}),
started: make(chan struct{}),
}
}
// Serve runs the verbose logging service.
func (s *verboseSvc) Serve() {
func (s *verboseService) Serve() {
sub := events.Default.Subscribe(events.AllEvents)
defer events.Default.Unsubscribe(sub)
@@ -55,17 +55,17 @@ func (s *verboseSvc) Serve() {
}
// Stop stops the verbose logging service.
func (s *verboseSvc) Stop() {
func (s *verboseService) Stop() {
close(s.stop)
}
// WaitForStart returns once the verbose logging service is ready to receive
// events, or immediately if it's already running.
func (s *verboseSvc) WaitForStart() {
func (s *verboseService) WaitForStart() {
<-s.started
}
func (s *verboseSvc) formatEvent(ev events.Event) string {
func (s *verboseService) formatEvent(ev events.Event) string {
switch ev.Type {
case events.Ping, events.DownloadProgress, events.LocalIndexUpdated:
// Skip

View File

@@ -245,7 +245,7 @@ ul.three-columns li, ul.two-columns li {
/** Footer nav on small devices **/
@media (max-width: 991px) {
@media (max-width: 1199px) {
body {
padding-bottom: 0;
}

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -1,5 +1,5 @@
{
"A negative number of days doesn't make sense.": "A negative number of days doesn't make sense.",
"A negative number of days doesn't make sense.": "Un nombre negatiu de dies no té sentit.",
"A new major version may not be compatible with previous versions.": "Una nova versió major pot ser incompatible amb versions anteriors.",
"API Key": "Clau API",
"About": "Sobre",
@@ -10,8 +10,8 @@
"Add new folder?": "Afegir nova carpeta?",
"Address": "Adreça",
"Addresses": "Adreces",
"Advanced": "Advanced",
"Advanced Configuration": "Advanced Configuration",
"Advanced": "Avançat",
"Advanced Configuration": "Configuració Avançada",
"All Data": "Totes les dades",
"Allow Anonymous Usage Reporting?": "Permetre l'enviament anònim d'informes d'ús?",
"Alphabetic": "Alfabètic",
@@ -19,11 +19,11 @@
"Anonymous Usage Reporting": "Informe anònim d'ús",
"Any devices configured on an introducer device will be added to this device as well.": "Qualsevol dispositiu configurat en un dispositiu introductor també s'afegirà a aquest dispositiu.",
"Automatic upgrades": "Actualitzacions automàtiques",
"Be careful!": "Be careful!",
"Be careful!": "Ves amb compte!",
"Bugs": "Bugs",
"CPU Utilization": "Utilització del CPU",
"Changelog": "Historial de canvis",
"Clean out after": "Clean out after",
"Clean out after": "Netejar després",
"Close": "Tancar",
"Command": "Comando",
"Comment, when used at the start of a line": "Comentari quan és usat al principi d'una línia",
@@ -32,16 +32,16 @@
"Copied from elsewhere": "Copiat d'un altre lloc",
"Copied from original": "Copiat de l'original",
"Copyright © 2015 the following Contributors:": "Copyright © 2015 els següents col·laboradors:",
"Danger!": "Danger!",
"Danger!": "Perill!",
"Delete": "Esborrar",
"Deleted": "Deleted",
"Deleted": "Esborrat",
"Device ID": "ID del dispositiu",
"Device Identification": "Identificació del dispositiu",
"Device Name": "Nom del dispositiu",
"Device {%device%} ({%address%}) wants to connect. Add new device?": "El dispositiu {{device}} ({{address}}) vol conectar-se. Afegir nou dispositiu?",
"Devices": "Dispositius",
"Disconnected": "Desconnectat",
"Discovery": "Discovery",
"Discovery": "Descobriment",
"Documentation": "Documentació",
"Download Rate": "Tasca de descarrega",
"Downloaded": "Descarregat",
@@ -51,18 +51,18 @@
"Edit Folder": "Modificar carpeta",
"Editing": "Modificant",
"Enable UPnP": "Habilitat UPnP",
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.",
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Introdueix adreces separades per comes (\"tcp://ip:port\", \"tcp://host:port\") o \"dinàmic\" per realitzar descobriments automàtics de l'adreça.",
"Enter ignore patterns, one per line.": "Introduex patrons a ignorar, un per línia.",
"Error": "Error",
"External File Versioning": "Versionat de fitxers extern",
"Failed Items": "Failed Items",
"Failed Items": "Elements fallats",
"File Pull Order": "Ordre d'agafar fitxers",
"File Versioning": "Versionat de Fitxers",
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Els bits de permisos dels fitxers son ignorats quan es cerquen canvis. Utilitzar en sistemes de fitxers FAT.",
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Files are moved to .stversions folder when replaced or deleted by Syncthing.",
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Els fitxers són moguts a la carpeta .stversions quan són reemplaçats o esborrats per Syncthing.",
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Els fitxers es mouen amb l'estampat de la data a la carpeta .stversions quan son substituïts o esborrats per syncthing.",
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "Els fitxers estan protegits de canvis fets per altres dispositius, però els canvis fets en aquest dispositiu seran enviats a la resta del cluster.",
"Folder": "Folder",
"Folder": "Carpeta",
"Folder ID": "ID de carpeta",
"Folder Master": "Carpeta mestre",
"Folder Path": "Camí de carpeta",
@@ -76,12 +76,12 @@
"Global Discovery Server": "Servidor de Descobriment Global",
"Global State": "Estat global",
"Help": "Ajuda",
"Home page": "Home page",
"Home page": "Pàgina d'inici",
"Ignore": "Ignorar",
"Ignore Patterns": "Patrons d'ignoració",
"Ignore Permissions": "Ignora Permisos",
"Incoming Rate Limit (KiB/s)": "Tasca Límit d'Entrada (KiB/s)",
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "Incorrect configuration may damage your folder contents and render Syncthing inoperable.",
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "Una configuració incorrecta pot malmetre els continguts de la teva carpeta i que Syncthing esdevingui inoperatiu.",
"Introducer": "Introductor",
"Inversion of the given condition (i.e. do not exclude)": "Inversió del patrò introduït",
"Keep Versions": "Mantenir Versions",
@@ -91,11 +91,11 @@
"Later": "Després",
"Local Discovery": "Descobriment Local",
"Local State": "Estat local",
"Local State (Total)": "Local State (Total)",
"Local State (Total)": "Estat local (Total)",
"Major Upgrade": "Actualització major",
"Maximum Age": "Antiguitat Màxima",
"Metadata Only": "Només metadades",
"Minimum Free Disk Space": "Minimum Free Disk Space",
"Minimum Free Disk Space": "Espai de disc lliure mínim",
"Move to top of queue": "Moure al primer de la cua",
"Multi level wildcard (matches multiple directory levels)": "Caràcter comodí de nivell múltiple (aparella en carpetes de nivells múltiples)",
"Never": "Mai",
@@ -108,37 +108,37 @@
"OK": "OK",
"Off": "Desactivar",
"Oldest First": "Més antic primer",
"Options": "Options",
"Out of Sync": "Out of Sync",
"Options": "Opcions",
"Out of Sync": "Fora de sincronia",
"Out of Sync Items": "Arxius encara no sincronitzats",
"Outgoing Rate Limit (KiB/s)": "Tasca Límit de Sortida (KiB/s)",
"Override Changes": "Sobreescriure Canvis",
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Ruta de la carpeta a l'equip local. Si no existeix serà creada. El caràcter (~) es pot fer servir com a drecera de",
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Ruta on les versions s'haurien de guardar (deixa-ho buit per fer servir el directori .stversions per defecte a la carpeta)",
"Pause": "Pause",
"Paused": "Paused",
"Pause": "Pausa",
"Paused": "Pausat",
"Please consult the release notes before performing a major upgrade.": "Si us plau consulta les notes de llançament abans de realitzar una actualització major.",
"Please set a GUI Authentication User and Password in the Settings dialog.": "Please set a GUI Authentication User and Password in the Settings dialog.",
"Please set a GUI Authentication User and Password in the Settings dialog.": "Si us plau, estableix un usuari i contrasenya al GUI a través del quadre de diàleg de configuració.",
"Please wait": "Si-us-plau espera",
"Preview": "Vista prèvia",
"Preview Usage Report": "Vista Prèvia de l'Informe d'Ús",
"Quick guide to supported patterns": "Guia ràpida per als possibles patrons",
"RAM Utilization": "Utilització de la RAM",
"Random": "Aleatori",
"Relayed via": "Relayed via",
"Relays": "Relays",
"Relayed via": "Retransmés a través",
"Relays": "Repetidors",
"Release Notes": "Notes de llançament",
"Remove": "Remove",
"Remove": "Esborrar",
"Rescan": "Re-escanejar",
"Rescan All": "Re-escanejar tot",
"Rescan Interval": "Interval de re-escaneig",
"Restart": "Reiniciar",
"Restart Needed": "És Necessari Reiniciar",
"Restarting": "Reiniciant",
"Resume": "Resume",
"Resume": "Reprendre",
"Reused": "Reutilitzat",
"Save": "Guardar",
"Scan Time Remaining": "Scan Time Remaining",
"Scan Time Remaining": "Temps d'escanejat restant",
"Scanning": "Escanejant",
"Select the devices to share this folder with.": "Selecciona els dispositius en els quals compartir aquesta carpeta.",
"Select the folders to share with this device.": "Selecciona la carpeta per a compartir en aquest dispositiu.",
@@ -161,7 +161,7 @@
"Source Code": "Codi Font",
"Staggered File Versioning": "Versionat de Fitxers Esglaonat",
"Start Browser": "Arrancar Navegador",
"Statistics": "Statistics",
"Statistics": "Estadístiques",
"Stopped": "Aturat",
"Support": "Suport",
"Sync Protocol Listen Addresses": "Adreça d'escolta del Protocol Sync",
@@ -172,7 +172,7 @@
"Syncthing is upgrading.": "Actualitzant syncthing.",
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Synthing sembla parat, o hi ha algun problema amb la connexió a Internet. Reintentant...",
"Syncthing seems to be experiencing a problem processing your request. Please refresh the page or restart Syncthing if the problem persists.": "Sembla ser que Syncthing està tinguent problemes per processar la teva petició. Si us plau, refresca la pàgina o reinicia Syncthing si el problema persisteix.",
"The Syncthing admin interface is configured to allow remote access without a password.": "The Syncthing admin interface is configured to allow remote access without a password.",
"The Syncthing admin interface is configured to allow remote access without a password.": "La interfície d'administració de Syncthing està configurada per permetre l'accés remot sense contrasenya.",
"The aggregated statistics are publicly available at {%url%}.": "Les estadístiques agregades estan públicament disponibles a {{url}}.",
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "La configuració s'ha guardar però no s'ha activat. S'ha de reiniciar el synthing per activar la nova configuració.",
"The device ID cannot be blank.": "El ID del dispositiu no pot estar en blanc.",
@@ -185,26 +185,26 @@
"The folder ID must be unique.": "El ID de la carpeta ha de ser únic.",
"The folder path cannot be blank.": "El camí a la carpeta no pot estar en blanc.",
"The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.": "Es fan servir els següents intervals: per la primera hora es manté una versió cada 30 segons, pel primer dia es manté una versió cada hora, pel primer cada 30 dies es manté una versió cada dia, fins el màxim d'antiguitat es manté una versió cada setmana.",
"The following items could not be synchronized.": "The following items could not be synchronized.",
"The following items could not be synchronized.": "Els següents elements no es poden sincronitzar.",
"The maximum age must be a number and cannot be blank.": "La màxima antiguitat ha de ser un número i no pot estar en blanc.",
"The maximum time to keep a version (in days, set to 0 to keep versions forever).": "Temps màxim en mantenir una versió (en dies, si es deixa en 0 es mantenen les versions per sempre).",
"The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).": "The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).",
"The number of days must be a number and cannot be blank.": "The number of days must be a number and cannot be blank.",
"The number of days to keep files in the trash can. Zero means forever.": "The number of days to keep files in the trash can. Zero means forever.",
"The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).": "El percentatge d'espai de disc lliure mínim ha de ser un nombre positiu entre 0 i 100 (inclosos).",
"The number of days must be a number and cannot be blank.": "El nombre de dies ha de ser un número i no pot estar en blanc.",
"The number of days to keep files in the trash can. Zero means forever.": "El nombre de dies per guardar els fitxers a la paperera. Zero significa per sempre.",
"The number of old versions to keep, per file.": "El nombre de versions antigues que es mantenen per fitxer.",
"The number of versions must be a number and cannot be blank.": "El nombre de versions ha de ser un número i no es pot deixar en blanc.",
"The path cannot be blank.": "El camí no pot estar en blanc.",
"The rate limit must be a non-negative number (0: no limit)": "The rate limit must be a non-negative number (0: no limit)",
"The rate limit must be a non-negative number (0: no limit)": "El límit de velocitat ha de ser un nombre positiu (0: sense límit)",
"The rescan interval must be a non-negative number of seconds.": "El interval de re-escaneig ha der ser un nombre positiu de segons.",
"They are retried automatically and will be synced when the error is resolved.": "They are retried automatically and will be synced when the error is resolved.",
"This can easily give hackers access to read and change any files on your computer.": "This can easily give hackers access to read and change any files on your computer.",
"They are retried automatically and will be synced when the error is resolved.": "Són reintentats automàticament i seran sincronitzats quan l'error estigui resolt.",
"This can easily give hackers access to read and change any files on your computer.": "Això pot donar facilment accés a hackers per llegir i canviar qualsevol fitxer del teu ordinador.",
"This is a major version upgrade.": "Aquesta és una actualització de versió major.",
"Trash Can File Versioning": "Trash Can File Versioning",
"Trash Can File Versioning": "Paperera de versionat de fitxers",
"Unknown": "Desconegut",
"Unshared": "No compartit",
"Unused": "No usat",
"Up to Date": "Actualitzat",
"Updated": "Updated",
"Updated": "Actualitzat",
"Upgrade": "Actualització",
"Upgrade To {%version%}": "Actualitzar a {{version}}",
"Upgrading": "Actualitzant",
@@ -218,7 +218,7 @@
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Quan s'afegeix una nova carpeta recorda que el ID d'aquesta s'utilitza per lligar repositoris entre els dispositius. Es distingeix entre majúscules i minúscules i ha de ser exactament iguals entre tots els dispositius.",
"Yes": "Si",
"You must keep at least one version.": "Has de mantenir com a mínim una versió.",
"days": "days",
"days": "dies",
"full documentation": "documentació sencera",
"items": "Elements",
"{%device%} wants to share folder \"{%folder%}\".": "{{device}} vol compartir la carpeta \"{{folder}}\"."

View File

@@ -32,7 +32,7 @@
"Copied from elsewhere": "Kopiert fra et annet sted",
"Copied from original": "Kopiert fra original",
"Copyright © 2015 the following Contributors:": "Opphavsrett © 2015 de følgende bidragsytere:",
"Danger!": "Danger!",
"Danger!": "Fare!",
"Delete": "Slett",
"Deleted": "Slettet",
"Device ID": "Enhets ID",
@@ -172,7 +172,7 @@
"Syncthing is upgrading.": "Syncthing oppgraderer.",
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Syncthing ser ut til å være nede, eller så er det et problem med nettforbindelsen din. Prøver på ny …",
"Syncthing seems to be experiencing a problem processing your request. Please refresh the page or restart Syncthing if the problem persists.": "Syncthing ser ut til å ha støtt på et problem under behandling av din forespørsel. Vennligst oppfrisk nettleseren eller start Syncthing på nytt dersom problemet vedvarer.",
"The Syncthing admin interface is configured to allow remote access without a password.": "The Syncthing admin interface is configured to allow remote access without a password.",
"The Syncthing admin interface is configured to allow remote access without a password.": "Grensesnittet for administrering av Syncthing er satt til å tillate ekstern tilgang uten et passord.",
"The aggregated statistics are publicly available at {%url%}.": "Samlet statistikk er åpent tilgjengelig på {{url}}.",
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "Innstillingene har blitt lagret men ikke aktivert. Syncthing må starte på ny for å aktivere de nye innstillingene.",
"The device ID cannot be blank.": "Enhets-ID kan ikke være tom.",
@@ -197,7 +197,7 @@
"The rate limit must be a non-negative number (0: no limit)": "Hastighetsbegrensningen kan ikke være et negativt tall (0: ingen begrensing)",
"The rescan interval must be a non-negative number of seconds.": "Antall sekund i skanneintervallet kan ikke være negativt.",
"They are retried automatically and will be synced when the error is resolved.": "Disse hentes automatisk og vil synkroniseres når feilen er blitt utbedret.",
"This can easily give hackers access to read and change any files on your computer.": "This can easily give hackers access to read and change any files on your computer.",
"This can easily give hackers access to read and change any files on your computer.": "Dette kan lett gi hackere tilgang til å lese og endre alle filer på datamaskinen din.",
"This is a major version upgrade.": "Dette er en hovedoppgradering",
"Trash Can File Versioning": "Papirkurv Versjonskontroll",
"Unknown": "Ukjent",

View File

@@ -0,0 +1,225 @@
{
"A negative number of days doesn't make sense.": "Số ngày không thể âm.",
"A new major version may not be compatible with previous versions.": "Phiên bản quan trọng mới có thể sẽ không tương thích với các bản cũ.",
"API Key": "Khoá API",
"About": "Thông tin về",
"Actions": "Hành động",
"Add": "Thêm",
"Add Device": "Thêm thiết bị",
"Add Folder": "Thêm thư mục",
"Add new folder?": "Thêm thư mục mới?",
"Address": "Địa chỉ",
"Addresses": "Các địa chỉ",
"Advanced": "Nâng cao",
"Advanced Configuration": "Cấu hình nâng cao",
"All Data": "Tất cả dữ liệu",
"Allow Anonymous Usage Reporting?": "Cho phép báo cáo sử dụng ẩn danh?",
"Alphabetic": "A-Z",
"An external command handles the versioning. It has to remove the file from the synced folder.": "Một lệnh ngoại vi xử lý việc phiên bản hoá. Nó phải loại bỏ tập tin này khỏi thư mục đã đồng bộ.",
"Anonymous Usage Reporting": "Báo cáo sử dụng ẩn danh",
"Any devices configured on an introducer device will be added to this device as well.": "Bất kỳ thiết bị nào liên kết với thiết bị giới thiệu cũng sẽ được thêm vào.",
"Automatic upgrades": "Cập nhật tự động",
"Be careful!": "Cẩn thận!",
"Bugs": "Lỗi",
"CPU Utilization": "Mức sử dụng CPU",
"Changelog": "Lược sử thay đổi",
"Clean out after": "Dọn dẹp sau",
"Close": "Đóng",
"Command": "Lệnh",
"Comment, when used at the start of a line": "Bình luận, khi dùng trước đầu dòng",
"Compression": "Nén",
"Connection Error": "Lỗi kết nối",
"Copied from elsewhere": "Đã sao chép từ nơi khác",
"Copied from original": "Đã sao chép từ nguồn",
"Copyright © 2015 the following Contributors:": "Bản quyền © 2015 theo các nhà cộng tác sau:",
"Danger!": "Nguy hiểm!",
"Delete": "Xoá",
"Deleted": "Đã xoá",
"Device ID": "ID thiết bị",
"Device Identification": "Danh tính thiết bị",
"Device Name": "Tên thiết bị",
"Device {%device%} ({%address%}) wants to connect. Add new device?": "Thiết bị {{thiết bị}} ({{địa chỉ}}) muốn kết nối. Thêm thiết bị mới?",
"Devices": "Các thiết bị",
"Disconnected": "Đã ngắt kết nối",
"Discovery": "Dò tìm",
"Documentation": "Tài liệu",
"Download Rate": "Tốc độ tải xuống",
"Downloaded": "Đã tải xuống",
"Downloading": "Đang tải xuống",
"Edit": "Chỉnh sửa",
"Edit Device": "Chỉnh sửa thiết bị",
"Edit Folder": "Chỉnh sửa thư mục",
"Editing": "Đang chỉnh sửa",
"Enable UPnP": "Bật UPnP",
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Nhập dấu phẩy ngăn cách các địa chỉ (\"tcp://ip:port\", \"tcp://host:port\") hoặc \"dynamic\" để tiến hành dò tìm địa chỉ tự động.",
"Enter ignore patterns, one per line.": "Nhập quy luật bỏ qua, từng dòng một.",
"Error": "Lỗi",
"External File Versioning": "Phiên bản hoá tập tin ngoại vi",
"Failed Items": "Các nội dung bị lỗi",
"File Pull Order": "Thứ tự pull tập tin",
"File Versioning": "Phiên bản hoá tập tin",
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Các phần tử giấy phép tập tin sẽ được bỏ qua khi tìm kiếm thay đổi. Dùng trên hệ thống tập tin FAT.",
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Các tập tin sẽ được chuyển tới thư mục .stversions khi bị thay thế hoặc xoá bởi Syncthing.",
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Các tập tin sẽ được chuyển tới các phiên bản được đánh dấu ngày tháng trong thư mục .stversions khi bị thay thế hoặc xoá bởi Syncthing.",
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "Các tập tin sẽ được bảo vệ khỏi những thay đổi trên các thiết bị khác, nhưng những thay đổi trên thiết bị này sẽ được chuyển tới những máy còn lại trong cụm.",
"Folder": "Thư mục",
"Folder ID": "ID thư mục",
"Folder Master": "Thư mục chính",
"Folder Path": "Đường dẫn thư mục",
"Folders": "Các thư mục",
"GUI": "GUI",
"GUI Authentication Password": "Mật khẩu xác minh GUI",
"GUI Authentication User": "Người dùng xác minh GUI",
"GUI Listen Addresses": "Các địa chỉ lắng nghe GUI",
"Generate": "Tạo mới",
"Global Discovery": "Dò tìm toàn cầu",
"Global Discovery Server": "Máy chủ dò tìm toàn cầu",
"Global State": "Hiện trạng toàn cầu",
"Help": "Trợ giúp",
"Home page": "Trang chủ",
"Ignore": "Bỏ qua",
"Ignore Patterns": "Bỏ qua các quy luật",
"Ignore Permissions": "Bỏ qua các giấy phép ",
"Incoming Rate Limit (KiB/s)": "Giới hạn tốc độ đầu vào (KiB/s)",
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "Cấu hình không đúng có thể gây mất mát nội dung và khiến Syncthing dừng hoạt động.",
"Introducer": "Thiết bị giới thiệu",
"Inversion of the given condition (i.e. do not exclude)": "Đảo ngược điều kiện cho trước (ví dụ: không được loại trừ)",
"Keep Versions": "Giữ các phiên bản",
"Largest First": "Lớn nhất trước tiên",
"Last File Received": "Tập tin nhận cuối cùng",
"Last seen": "Thấy lần cuối",
"Later": "Để sau",
"Local Discovery": "Dò tìm cục bộ",
"Local State": "Trạng thái cục bộ",
"Local State (Total)": "Trạng thái cục bộ (Tổng)",
"Major Upgrade": "Bản nâng cấp quan trọng",
"Maximum Age": "Thời hạn tối đa",
"Metadata Only": "Chỉ siêu dữ liệu",
"Minimum Free Disk Space": "Dung lượng ổ đĩa trống tối thiểu",
"Move to top of queue": "Chuyển đến đầu hàng chờ",
"Multi level wildcard (matches multiple directory levels)": "Ký tự thay thế đa cấp (phù hợp với đa cấp độ thư mục)",
"Never": "Không bao giờ",
"New Device": "Thiết bị mới",
"New Folder": "Thư mục mới",
"Newest First": "Mới nhất đầu tiên",
"No": "Không",
"No File Versioning": "Không phiên bản hoá tập tin",
"Notice": "Chú ý",
"OK": "OK",
"Off": "Tắt",
"Oldest First": "Cũ nhất đầu tiên",
"Options": "Tuỳ chọn",
"Out of Sync": "Mất đồng bộ",
"Out of Sync Items": "Các nội dung mất đồng bộ",
"Outgoing Rate Limit (KiB/s)": "Giới hạn tốc độ đầu ra (KiB/s)",
"Override Changes": "Ghi đè các thay đổi",
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Đường dẫn đến thư mục trên máy tính cục bộ. Sẽ tạo mới nếu chưa có sẵn. Dấu ngã (~) có thể được dùng làm lối tắt",
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Đường dẫn nơi các phiên bản được lưu trữ (để trống cho thư mục mặc định .stversions).",
"Pause": "Tạm dừng",
"Paused": "Đã tạm dừng",
"Please consult the release notes before performing a major upgrade.": "Hãy xem kỹ lược sử phát hành trước khi tiến hành bản cập nhật quan trọng.",
"Please set a GUI Authentication User and Password in the Settings dialog.": "Hãy thiết lập tên người dùng và mật khẩu xác minh GUI trong hộp thoại Cài đặt.",
"Please wait": "Xin chờ",
"Preview": "Xem trước",
"Preview Usage Report": "Xem trước báo cáo sử dụng",
"Quick guide to supported patterns": "Hướng dẫn sơ lược về các quy luật được hỗ trợ",
"RAM Utilization": "Mức sử dụng RAM",
"Random": "Ngẫu nhiên",
"Relayed via": "Chuyển tiếp qua",
"Relays": "Các máy chuyển tiếp",
"Release Notes": "Lược sử phát hành",
"Remove": "Loại bỏ",
"Rescan": "Quét lại",
"Rescan All": "Quét lại tất cả",
"Rescan Interval": "Khoảng cách thời gian quét lại",
"Restart": "Khởi động lại",
"Restart Needed": "Cần khởi động lại",
"Restarting": "Đang khởi động lại",
"Resume": "Tiếp tục",
"Reused": "Đã dùng lại",
"Save": "Sao lưu",
"Scan Time Remaining": "Thời gian quét còn lại",
"Scanning": "Đang quét",
"Select the devices to share this folder with.": "Chọn các thiết bị để chia sẻ thư mục này.",
"Select the folders to share with this device.": "Chọn các thư mục để chia sẻ với thiết bị này.",
"Settings": "Cài đặt",
"Share": "Chia sẻ",
"Share Folder": "Chia sẻ thư mục",
"Share Folders With Device": "Chia sẻ các thư mục với thiết bị",
"Share With Devices": "Chia sẻ với các thiết bị",
"Share this folder?": "Chia sẻ thư mục này?",
"Shared With": "Đã chia sẻ với",
"Short identifier for the folder. Must be the same on all cluster devices.": "Tên tắt cho thư mục. Phải trùng khớp trên tất cả thiết bị trong cụm.",
"Show ID": "Hiển thị ID",
"Shown instead of Device ID in the cluster status. Will be advertised to other devices as an optional default name.": "Hiển thị thay cho ID thiết bị trong trạng thái cụm. Sẽ được giới thiệu đến các thiết bị khác như tên mặc định tuỳ chọn.",
"Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.": "Hiển thị thay cho ID thiết bị trong trạng thái cụm. Nếu để trống sẽ được cập nhật thành tên mà thiết bị giới thiệu.",
"Shutdown": "Đóng",
"Shutdown Complete": "Hoàn tất đóng",
"Simple File Versioning": "Phiên bản hoá tập tin dạng đơn giản",
"Single level wildcard (matches within a directory only)": "Ký tự thay thế đơn cấp (phù hợp với chỉ một thư mục)",
"Smallest First": "Nhỏ nhất đầu tiên",
"Source Code": "Mã nguồn",
"Staggered File Versioning": "Phiên bản hoá tập tin theo thời gian",
"Start Browser": "Mở trình duyệt",
"Statistics": "Thống kê",
"Stopped": "Đã dừng",
"Support": "Hỗ trợ",
"Sync Protocol Listen Addresses": "Đồng bộ các địa chỉ lắng nghe giao thức",
"Syncing": "Đang đồng bộ",
"Syncthing has been shut down.": "Đã đóng Syncthing.",
"Syncthing includes the following software or portions thereof:": "Syncthing bao gồm phần mềm hoặc các phần tử của phần mềm sau:",
"Syncthing is restarting.": "Syncthing đang khởi động lại.",
"Syncthing is upgrading.": "Syncthing đang nâng cấp.",
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Có vẻ như Syncthing đang bị nghẽn hoặc là mạng của bạn có vấn đề. Đang thử lại...",
"Syncthing seems to be experiencing a problem processing your request. Please refresh the page or restart Syncthing if the problem persists.": "Có vẻ như Syncthing đang gặp phải vấn đề khi xử lý yêu cầu của bạn. Xin làm mới trang hoặc khởi động lại Syncthing nếu vấn đề vẫn còn tiếp diễn.",
"The Syncthing admin interface is configured to allow remote access without a password.": "Giao diện quản trị của Syncthing được cấu hình nhằm cho phép truy cập từ xa không cần mật mã.",
"The aggregated statistics are publicly available at {%url%}.": "Thống kê tổng hợp được đăng công khai trên {{url}}.",
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "Cấu hình đã được lưu nhưng chưa được kích hoạt. Syncthing phải khởi động lại để kích hoạt cấu hình mới. ",
"The device ID cannot be blank.": "ID thiết bị không thể trống.",
"The device ID to enter here can be found in the \"Edit > Show ID\" dialog on the other device. Spaces and dashes are optional (ignored).": "ID thiết bị cần nhập có thể được tìm thấy trong hộp thoại \"Chỉnh sửa > Hiển thị ID\" trên thiết bị kia. Khoảng trắng và gạch ngang là tuỳ chọn (bỏ qua).",
"The encrypted usage report is sent daily. It is used to track common platforms, folder sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "Báo cáo sử dụng đã mã khoá sẽ được gửi đi hằng ngày. Nó được dùng để thu thập số liệu về các hệ điều hành phổ biến, kích cỡ thư mục và phiên bản ứng dụng. Nếu bộ dữ liệu báo cáo có thay đổi, bạn sẽ được nhắc nhở thông qua hộp thoại này.",
"The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional.": "ID thiết bị đã nhập không hợp lệ. Nó phải là một chuỗi từ 52 đến 56 ký tự, bao gồm chữ cái và các con số, với khoảng trắng và gạch ngang là tuỳ chọn.",
"The first command line parameter is the folder path and the second parameter is the relative path in the folder.": "Tham số dòng lệnh đầu tiên là đường dẫn thư mục và tham số thứ hai là đường dẫn tương đối trong thư mục.",
"The folder ID cannot be blank.": "ID thư mục không thể trống.",
"The folder ID must be a short identifier (64 characters or less) consisting of letters, numbers and the dot (.), dash (-) and underscode (_) characters only.": "ID thư mục phải là một tên tắt (64 ký tự hoặc ít hơn) chỉ bao gồm chữ cái, các con số và dấu chấm (.), gạch ngang (-) và gạch chân (_).",
"The folder ID must be unique.": "ID thư mục phải là duy nhất.",
"The folder path cannot be blank.": "Đường dẫn thư mục không thể trống.",
"The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.": "Các khoảng thời gian sau đây được sử dụng: một phiên bản, trong giờ đầu tiên, được giữ lại mỗi 30 giây, trong ngày đầu tiên là mỗi giờ, trong 30 ngày đầu tiên là mỗi ngày, cho đến khi thời hạn tối đa mỗi phiên bản được giữ lại là mỗi tuần. ",
"The following items could not be synchronized.": "Những nội dung sau không thể đồng bộ được.",
"The maximum age must be a number and cannot be blank.": "Thời hạn tối đa phải là một con số và không thể để trống.",
"The maximum time to keep a version (in days, set to 0 to keep versions forever).": "Thời gian tối đa phiên bản được giữ lại (tính bằng ngày, từ 0 đến mãi mãi).",
"The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).": "Phần trăm dung lượng ổ đĩa còn trống tối thiểu phải là một số không âm (trong khoảng) từ 0 đến 100.",
"The number of days must be a number and cannot be blank.": "Số ngày phải là một con số và không thể để trống.",
"The number of days to keep files in the trash can. Zero means forever.": "Số ngày giữ tập tin trong thùng rác. Số 0 nghĩa là mãi mãi.",
"The number of old versions to keep, per file.": "Số phiên bản cũ cần giữ, với mỗi tập tin.",
"The number of versions must be a number and cannot be blank.": "Số phiên bản phải là một con số và không thể để trống.",
"The path cannot be blank.": "Đường dẫn không thể trống.",
"The rate limit must be a non-negative number (0: no limit)": "Giới hạn tốc độ phải là một số không âm (0: không giới hạn)",
"The rescan interval must be a non-negative number of seconds.": "Khoảng thời gian quét lại phải là một số giây không âm. ",
"They are retried automatically and will be synced when the error is resolved.": "Chúng sẽ được tự động thử lại và đồng bộ khi lỗi được khắc phục.",
"This can easily give hackers access to read and change any files on your computer.": "Thao tác này có thể khiến tin tặc truy cập để đọc và thay đổi bất kỳ tập tin nào trên máy tính của bạn một cách dễ dàng.",
"This is a major version upgrade.": "Đây là bản nâng cấp quan trọng.",
"Trash Can File Versioning": "Phiên bản hoá tập tin trong thùng rác",
"Unknown": "Không biết",
"Unshared": "Chưa chia sẻ",
"Unused": "Chưa sử dụng",
"Up to Date": "Đã cập nhật",
"Updated": "Đã cập nhật",
"Upgrade": "Nâng cấp",
"Upgrade To {%version%}": "Nâng cấp lên {{phiên bản}}",
"Upgrading": "Đang nâng cấp",
"Upload Rate": "Tốc độ tải lên",
"Uptime": "Thời gian hoạt động",
"Use HTTPS for GUI": "Sử dụng HTTPS cho GUI",
"Version": "Phiên bản",
"Versions Path": "Đường dẫn các phiên bản",
"Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.": "Các phiên bản sẽ tự động được xoá nếu chúng cũ hơn thời hạn tối đa hoặc vượt quá số tập tin cho phép trong một khoảng thời gian.",
"When adding a new device, keep in mind that this device must be added on the other side too.": "Khi thêm một thiết bị mới, hãy nhớ rằng thiết bị này cũng được thêm vào máy khác.",
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Khi thêm một thư mục mới, hãy nhớ rằng ID thư mục được dùng để gắn kết thư mục giữa các thiết bị với nhau. Chúng phải chính xác từng chữ, cả viết hoa và thường giữa tất cả thiết bị.",
"Yes": "Có",
"You must keep at least one version.": "Bạn phải giữ ít nhất một phiên bản.",
"days": "ngày",
"full documentation": "tài liệu đầy đủ",
"items": "các nội dung",
"{%device%} wants to share folder \"{%folder%}\".": "{{thiết bị}} muốn chia sẻ thư mục \"{{thư mục}}\"."
}

View File

@@ -1 +1 @@
var langPrettyprint = {"bg":"Bulgarian","ca":"Catalan","ca@valencia":"Catalan (Valencian)","cs":"Czech","da":"Danish","de":"German","el":"Greek","en":"English","en-GB":"English (United Kingdom)","es":"Spanish","es-ES":"Spanish (Spain)","fi":"Finnish","fr":"French","fr-CA":"French (Canada)","fy":"Western Frisian","hu":"Hungarian","it":"Italian","ja":"Japanese","ko-KR":"Korean (Korea)","lt":"Lithuanian","nb":"Norwegian Bokmål","nl":"Dutch","nn":"Norwegian Nynorsk","pl":"Polish","pt-BR":"Portuguese (Brazil)","pt-PT":"Portuguese (Portugal)","ro-RO":"Romanian (Romania)","ru":"Russian","sv":"Swedish","uk":"Ukrainian","zh-CN":"Chinese (China)","zh-TW":"Chinese (Taiwan)"}
var langPrettyprint = {"bg":"Bulgarian","ca":"Catalan","ca@valencia":"Catalan (Valencian)","cs":"Czech","da":"Danish","de":"German","el":"Greek","en":"English","en-GB":"English (United Kingdom)","es":"Spanish","es-ES":"Spanish (Spain)","fi":"Finnish","fr":"French","fr-CA":"French (Canada)","fy":"Western Frisian","hu":"Hungarian","it":"Italian","ja":"Japanese","ko-KR":"Korean (Korea)","lt":"Lithuanian","nb":"Norwegian Bokmål","nl":"Dutch","nn":"Norwegian Nynorsk","pl":"Polish","pt-BR":"Portuguese (Brazil)","pt-PT":"Portuguese (Portugal)","ro-RO":"Romanian (Romania)","ru":"Russian","sv":"Swedish","uk":"Ukrainian","vi":"Vietnamese","zh-CN":"Chinese (China)","zh-TW":"Chinese (Taiwan)"}

View File

@@ -1 +1 @@
var validLangs = ["bg","ca","ca@valencia","cs","da","de","el","en","en-GB","es","es-ES","fi","fr","fr-CA","fy","hu","it","ja","ko-KR","lt","nb","nl","nn","pl","pt-BR","pt-PT","ro-RO","ru","sv","uk","zh-CN","zh-TW"]
var validLangs = ["bg","ca","ca@valencia","cs","da","de","el","en","en-GB","es","es-ES","fi","fr","fr-CA","fy","hu","it","ja","ko-KR","lt","nb","nl","nn","pl","pt-BR","pt-PT","ro-RO","ru","sv","uk","vi","zh-CN","zh-TW"]

View File

@@ -15,6 +15,7 @@
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="assets/img/favicon.png">
<link rel="mask-icon" href="assets/img/safari-pinned-tab.svg" color="#0882c8">
<title ng-bind="thisDeviceName() + ' | Syncthing'"></title>
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

View File

@@ -47,6 +47,7 @@
<li class="auto-generated">Francois-Xavier Gsell</li>
<li class="auto-generated">Frank Isemann</li>
<li class="auto-generated">Gilli Sigurdsson</li>
<li class="auto-generated">Jaakko Hannikainen</li>
<li class="auto-generated">Jacek Szafarkiewicz</li>
<li class="auto-generated">Jake Peterson</li>
<li class="auto-generated">Jakob Borg</li>

View File

File diff suppressed because one or more lines are too long

View File

@@ -42,9 +42,9 @@ type Model interface {
IsPaused(remoteID protocol.DeviceID) bool
}
// The connection service listens on TLS and dials configured unconnected
// The connection connectionService listens on TLS and dials configured unconnected
// devices. Successful connections are handed to the model.
type connectionSvc struct {
type connectionService struct {
*suture.Supervisor
cfg *config.Wrapper
myID protocol.DeviceID
@@ -52,7 +52,7 @@ type connectionSvc struct {
tlsCfg *tls.Config
discoverer discover.Finder
conns chan model.IntermediateConnection
relaySvc *relay.Svc
relayService *relay.Service
bepProtocolName string
tlsDefaultCommonName string
lans []*net.IPNet
@@ -66,16 +66,16 @@ type connectionSvc struct {
relaysEnabled bool
}
func NewConnectionSvc(cfg *config.Wrapper, myID protocol.DeviceID, mdl Model, tlsCfg *tls.Config, discoverer discover.Finder, relaySvc *relay.Svc,
func NewConnectionService(cfg *config.Wrapper, myID protocol.DeviceID, mdl Model, tlsCfg *tls.Config, discoverer discover.Finder, relayService *relay.Service,
bepProtocolName string, tlsDefaultCommonName string, lans []*net.IPNet) suture.Service {
svc := &connectionSvc{
Supervisor: suture.NewSimple("connectionSvc"),
service := &connectionService{
Supervisor: suture.NewSimple("connectionService"),
cfg: cfg,
myID: myID,
model: mdl,
tlsCfg: tlsCfg,
discoverer: discoverer,
relaySvc: relaySvc,
relayService: relayService,
conns: make(chan model.IntermediateConnection),
bepProtocolName: bepProtocolName,
tlsDefaultCommonName: tlsDefaultCommonName,
@@ -85,20 +85,20 @@ func NewConnectionSvc(cfg *config.Wrapper, myID protocol.DeviceID, mdl Model, tl
relaysEnabled: cfg.Options().RelaysEnabled,
lastRelayCheck: make(map[protocol.DeviceID]time.Time),
}
cfg.Subscribe(svc)
cfg.Subscribe(service)
if svc.cfg.Options().MaxSendKbps > 0 {
svc.writeRateLimit = ratelimit.NewBucketWithRate(float64(1000*svc.cfg.Options().MaxSendKbps), int64(5*1000*svc.cfg.Options().MaxSendKbps))
if service.cfg.Options().MaxSendKbps > 0 {
service.writeRateLimit = ratelimit.NewBucketWithRate(float64(1000*service.cfg.Options().MaxSendKbps), int64(5*1000*service.cfg.Options().MaxSendKbps))
}
if svc.cfg.Options().MaxRecvKbps > 0 {
svc.readRateLimit = ratelimit.NewBucketWithRate(float64(1000*svc.cfg.Options().MaxRecvKbps), int64(5*1000*svc.cfg.Options().MaxRecvKbps))
if service.cfg.Options().MaxRecvKbps > 0 {
service.readRateLimit = ratelimit.NewBucketWithRate(float64(1000*service.cfg.Options().MaxRecvKbps), int64(5*1000*service.cfg.Options().MaxRecvKbps))
}
// There are several moving parts here; one routine per listening address
// to handle incoming connections, one routine to periodically attempt
// outgoing connections, one routine to the the common handling
// regardless of whether the connection was incoming or outgoing.
// Furthermore, a relay service which handles incoming requests to connect
// Furthermore, a relay connectionService which handles incoming requests to connect
// via the relays.
//
// TODO: Clean shutdown, and/or handling config changes on the fly. We
@@ -106,8 +106,8 @@ func NewConnectionSvc(cfg *config.Wrapper, myID protocol.DeviceID, mdl Model, tl
// not new listen addresses and we don't support disconnecting devices
// that are removed and so on...
svc.Add(serviceFunc(svc.connect))
for _, addr := range svc.cfg.Options().ListenAddress {
service.Add(serviceFunc(service.connect))
for _, addr := range service.cfg.Options().ListenAddress {
uri, err := url.Parse(addr)
if err != nil {
l.Infoln("Failed to parse listen address:", addr, err)
@@ -122,20 +122,20 @@ func NewConnectionSvc(cfg *config.Wrapper, myID protocol.DeviceID, mdl Model, tl
l.Debugln("listening on", uri)
svc.Add(serviceFunc(func() {
listener(uri, svc.tlsCfg, svc.conns)
service.Add(serviceFunc(func() {
listener(uri, service.tlsCfg, service.conns)
}))
}
svc.Add(serviceFunc(svc.handle))
service.Add(serviceFunc(service.handle))
if svc.relaySvc != nil {
svc.Add(serviceFunc(svc.acceptRelayConns))
if service.relayService != nil {
service.Add(serviceFunc(service.acceptRelayConns))
}
return svc
return service
}
func (s *connectionSvc) handle() {
func (s *connectionService) handle() {
next:
for c := range s.conns {
cs := c.Conn.ConnectionState()
@@ -257,7 +257,7 @@ next:
}
}
func (s *connectionSvc) connect() {
func (s *connectionService) connect() {
delay := time.Second
for {
l.Debugln("Reconnect loop")
@@ -340,7 +340,7 @@ func (s *connectionSvc) connect() {
}
}
func (s *connectionSvc) resolveAddresses(deviceID protocol.DeviceID, inAddrs []string) (addrs []string, relays []discover.Relay) {
func (s *connectionService) resolveAddresses(deviceID protocol.DeviceID, inAddrs []string) (addrs []string, relays []discover.Relay) {
for _, addr := range inAddrs {
if addr == "dynamic" {
if s.discoverer != nil {
@@ -356,7 +356,7 @@ func (s *connectionSvc) resolveAddresses(deviceID protocol.DeviceID, inAddrs []s
return
}
func (s *connectionSvc) connectDirect(deviceID protocol.DeviceID, addr string) *tls.Conn {
func (s *connectionService) connectDirect(deviceID protocol.DeviceID, addr string) *tls.Conn {
uri, err := url.Parse(addr)
if err != nil {
l.Infoln("Failed to parse connection url:", addr, err)
@@ -379,7 +379,7 @@ func (s *connectionSvc) connectDirect(deviceID protocol.DeviceID, addr string) *
return conn
}
func (s *connectionSvc) connectViaRelay(deviceID protocol.DeviceID, addr discover.Relay) *tls.Conn {
func (s *connectionService) connectViaRelay(deviceID protocol.DeviceID, addr discover.Relay) *tls.Conn {
uri, err := url.Parse(addr.URL)
if err != nil {
l.Infoln("Failed to parse relay connection url:", addr, err)
@@ -418,9 +418,9 @@ func (s *connectionSvc) connectViaRelay(deviceID protocol.DeviceID, addr discove
return tc
}
func (s *connectionSvc) acceptRelayConns() {
func (s *connectionService) acceptRelayConns() {
for {
conn := s.relaySvc.Accept()
conn := s.relayService.Accept()
s.conns <- model.IntermediateConnection{
Conn: conn,
Type: model.ConnectionTypeRelayAccept,
@@ -428,7 +428,7 @@ func (s *connectionSvc) acceptRelayConns() {
}
}
func (s *connectionSvc) shouldLimit(addr net.Addr) bool {
func (s *connectionService) shouldLimit(addr net.Addr) bool {
if s.cfg.Options().LimitBandwidthInLan {
return true
}
@@ -445,11 +445,11 @@ func (s *connectionSvc) shouldLimit(addr net.Addr) bool {
return !tcpaddr.IP.IsLoopback()
}
func (s *connectionSvc) VerifyConfiguration(from, to config.Configuration) error {
func (s *connectionService) VerifyConfiguration(from, to config.Configuration) error {
return nil
}
func (s *connectionSvc) CommitConfiguration(from, to config.Configuration) bool {
func (s *connectionService) CommitConfiguration(from, to config.Configuration) bool {
s.mut.Lock()
s.relaysEnabled = to.Options.RelaysEnabled
s.mut.Unlock()

View File

@@ -65,8 +65,8 @@ func (m *CachingMux) Add(finder Finder, cacheTime, negCacheTime time.Duration, p
m.caches = append(m.caches, newCache())
m.mut.Unlock()
if svc, ok := finder.(suture.Service); ok {
m.Supervisor.Add(svc)
if service, ok := finder.(suture.Service); ok {
m.Supervisor.Add(service)
}
}

View File

@@ -969,25 +969,11 @@ func (p *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks
}
}
if p.checkFreeSpace {
if free, err := osutil.DiskFreeBytes(p.dir); err == nil && free < file.Size() {
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, p.folder, p.dir, file.Name, float64(free)/1024/1024, float64(file.Size())/1024/1024)
p.newError(file.Name, errors.New("insufficient space"))
return
}
}
events.Default.Log(events.ItemStarted, map[string]string{
"folder": p.folder,
"item": file.Name,
"type": "file",
"action": "update",
})
scanner.PopulateOffsets(file.Blocks)
reused := 0
var blocks []protocol.BlockInfo
var blocksSize int64
// Check for an old temporary file which might have some blocks we could
// reuse.
@@ -1007,6 +993,7 @@ func (p *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks
_, ok := existingBlocks[block.String()]
if !ok {
blocks = append(blocks, block)
blocksSize += int64(block.Size)
}
}
@@ -1021,8 +1008,24 @@ func (p *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks
}
} else {
blocks = file.Blocks
blocksSize = file.Size()
}
if p.checkFreeSpace {
if free, err := osutil.DiskFreeBytes(p.dir); err == nil && free < blocksSize {
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, p.folder, p.dir, file.Name, float64(free)/1024/1024, float64(blocksSize)/1024/1024)
p.newError(file.Name, errors.New("insufficient space"))
return
}
}
events.Default.Log(events.ItemStarted, map[string]string{
"folder": p.folder,
"item": file.Name,
"type": "file",
"action": "update",
})
s := sharedPullerState{
file: file,
folder: p.folder,

View File

@@ -42,6 +42,40 @@ var blocks = []protocol.BlockInfo{
var folders = []string{"default"}
func setUpFile(filename string, blockNumbers []int) protocol.FileInfo {
// Create existing file
existingBlocks := make([]protocol.BlockInfo, len(blockNumbers))
for i := range blockNumbers {
existingBlocks[i] = blocks[blockNumbers[i]]
}
return protocol.FileInfo{
Name: filename,
Flags: 0,
Modified: 0,
Blocks: existingBlocks,
}
}
func setUpModel(file protocol.FileInfo) *Model {
db := db.OpenMemory()
model := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
model.AddFolder(defaultFolderConfig)
// Update index
model.updateLocals("default", []protocol.FileInfo{file})
return model
}
func setUpRwFolder(model *Model) rwFolder {
return rwFolder{
folder: "default",
dir: "testdata",
model: model,
errors: make(map[string]string),
errorsMut: sync.NewMutex(),
}
}
// Layout of the files: (indexes from the above array)
// 12345678 - Required file
// 02005008 - Existing file (currently in the index)
@@ -52,35 +86,13 @@ func TestHandleFile(t *testing.T) {
// Copy: 2, 5, 8
// Pull: 1, 3, 4, 6, 7
// Create existing file
existingFile := protocol.FileInfo{
Name: "filex",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{
blocks[0], blocks[2], blocks[0], blocks[0],
blocks[5], blocks[0], blocks[0], blocks[8],
},
}
// Create target file
existingBlocks := []int{0, 2, 0, 0, 5, 0, 0, 8}
existingFile := setUpFile("filex", existingBlocks)
requiredFile := existingFile
requiredFile.Blocks = blocks[1:]
db := db.OpenMemory()
m := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
m.AddFolder(defaultFolderConfig)
// Update index
m.updateLocals("default", []protocol.FileInfo{existingFile})
p := rwFolder{
folder: "default",
dir: "testdata",
model: m,
errors: make(map[string]string),
errorsMut: sync.NewMutex(),
}
m := setUpModel(existingFile)
p := setUpRwFolder(m)
copyChan := make(chan copyBlocksState, 1)
p.handleFile(requiredFile, copyChan, nil)
@@ -108,35 +120,13 @@ func TestHandleFileWithTemp(t *testing.T) {
// Copy: 5, 8
// Pull: 1, 6
// Create existing file
existingFile := protocol.FileInfo{
Name: "file",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{
blocks[0], blocks[2], blocks[0], blocks[0],
blocks[5], blocks[0], blocks[0], blocks[8],
},
}
// Create target file
existingBlocks := []int{0, 2, 0, 0, 5, 0, 0, 8}
existingFile := setUpFile("file", existingBlocks)
requiredFile := existingFile
requiredFile.Blocks = blocks[1:]
db := db.OpenMemory()
m := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
m.AddFolder(defaultFolderConfig)
// Update index
m.updateLocals("default", []protocol.FileInfo{existingFile})
p := rwFolder{
folder: "default",
dir: "testdata",
model: m,
errors: make(map[string]string),
errorsMut: sync.NewMutex(),
}
m := setUpModel(existingFile)
p := setUpRwFolder(m)
copyChan := make(chan copyBlocksState, 1)
p.handleFile(requiredFile, copyChan, nil)
@@ -169,47 +159,14 @@ func TestCopierFinder(t *testing.T) {
t.Error(err)
}
// Create existing file
existingFile := protocol.FileInfo{
Name: defTempNamer.TempName("file"),
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{
blocks[0], blocks[2], blocks[3], blocks[4],
blocks[0], blocks[0], blocks[7], blocks[0],
},
}
// Create target file
existingBlocks := []int{0, 2, 3, 4, 0, 0, 7, 0}
existingFile := setUpFile(defTempNamer.TempName("file"), existingBlocks)
requiredFile := existingFile
requiredFile.Blocks = blocks[1:]
requiredFile.Name = "file2"
db := db.OpenMemory()
m := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
m.AddFolder(defaultFolderConfig)
// Update index
m.updateLocals("default", []protocol.FileInfo{existingFile})
iterFn := func(folder, file string, index int32) bool {
return true
}
// Verify that the blocks we say exist on file, really exist in the db.
for _, idx := range []int{2, 3, 4, 7} {
if m.finder.Iterate(folders, blocks[idx].Hash, iterFn) == false {
t.Error("Didn't find block")
}
}
p := rwFolder{
folder: "default",
dir: "testdata",
model: m,
errors: make(map[string]string),
errorsMut: sync.NewMutex(),
}
m := setUpModel(existingFile)
p := setUpRwFolder(m)
copyChan := make(chan copyBlocksState)
pullChan := make(chan pullBlockState, 4)
finisherChan := make(chan *sharedPullerState, 1)
@@ -262,24 +219,9 @@ func TestCopierCleanup(t *testing.T) {
return true
}
db := db.OpenMemory()
m := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
m.AddFolder(defaultFolderConfig)
// Create a file
file := protocol.FileInfo{
Name: "test",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{blocks[0]},
}
// Add file to index
m.updateLocals("default", []protocol.FileInfo{file})
if !m.finder.Iterate(folders, blocks[0].Hash, iterFn) {
t.Error("Expected block not found")
}
file := setUpFile("test", []int{0})
m := setUpModel(file)
file.Blocks = []protocol.BlockInfo{blocks[1]}
file.Version = file.Version.Update(protocol.LocalDeviceID.Short())
@@ -311,19 +253,10 @@ func TestCopierCleanup(t *testing.T) {
// Make sure that the copier routine hashes the content when asked, and pulls
// if it fails to find the block.
func TestLastResortPulling(t *testing.T) {
db := db.OpenMemory()
m := NewModel(defaultConfig, protocol.LocalDeviceID, "device", "syncthing", "dev", db, nil)
m.AddFolder(defaultFolderConfig)
// Add a file to index (with the incorrect block representation, as content
// doesn't actually match the block list)
file := protocol.FileInfo{
Name: "empty",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{blocks[0]},
}
m.updateLocals("default", []protocol.FileInfo{file})
file := setUpFile("empty", []int{0})
m := setUpModel(file)
// Pretend that we are handling a new file of the same content but
// with a different name (causing to copy that particular block)
@@ -333,18 +266,7 @@ func TestLastResortPulling(t *testing.T) {
return true
}
// Check that that particular block is there
if !m.finder.Iterate(folders, blocks[0].Hash, iterFn) {
t.Error("Expected block not found")
}
p := rwFolder{
folder: "default",
dir: "testdata",
model: m,
errors: make(map[string]string),
errorsMut: sync.NewMutex(),
}
p := setUpRwFolder(m)
copyChan := make(chan copyBlocksState)
pullChan := make(chan pullBlockState, 1)
@@ -374,15 +296,7 @@ func TestLastResortPulling(t *testing.T) {
}
func TestDeregisterOnFailInCopy(t *testing.T) {
file := protocol.FileInfo{
Name: "filex",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{
blocks[0], blocks[2], blocks[0], blocks[0],
blocks[5], blocks[0], blocks[0], blocks[8],
},
}
file := setUpFile("filex", []int{0, 2, 0, 0, 5, 0, 0, 8})
defer os.Remove("testdata/" + defTempNamer.TempName("filex"))
db := db.OpenMemory()
@@ -467,15 +381,7 @@ func TestDeregisterOnFailInCopy(t *testing.T) {
}
func TestDeregisterOnFailInPull(t *testing.T) {
file := protocol.FileInfo{
Name: "filex",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{
blocks[0], blocks[2], blocks[0], blocks[0],
blocks[5], blocks[0], blocks[0], blocks[8],
},
}
file := setUpFile("filex", []int{0, 2, 0, 0, 5, 0, 0, 8})
defer os.Remove("testdata/" + defTempNamer.TempName("filex"))
db := db.OpenMemory()

View File

@@ -26,7 +26,7 @@ const (
eventBroadcasterCheckInterval = 10 * time.Second
)
type Svc struct {
type Service struct {
*suture.Supervisor
cfg *config.Wrapper
tlsCfg *tls.Config
@@ -38,11 +38,11 @@ type Svc struct {
conns chan *tls.Conn
}
func NewSvc(cfg *config.Wrapper, tlsCfg *tls.Config) *Svc {
func NewService(cfg *config.Wrapper, tlsCfg *tls.Config) *Service {
conns := make(chan *tls.Conn)
svc := &Svc{
Supervisor: suture.New("Svc", suture.Spec{
service := &Service{
Supervisor: suture.New("Service", suture.Spec{
Log: func(log string) {
l.Debugln(log)
},
@@ -61,28 +61,28 @@ func NewSvc(cfg *config.Wrapper, tlsCfg *tls.Config) *Svc {
}
rcfg := cfg.Raw()
svc.CommitConfiguration(rcfg, rcfg)
cfg.Subscribe(svc)
service.CommitConfiguration(rcfg, rcfg)
cfg.Subscribe(service)
receiver := &invitationReceiver{
tlsCfg: tlsCfg,
conns: conns,
invitations: svc.invitations,
invitations: service.invitations,
stop: make(chan struct{}),
}
eventBc := &eventBroadcaster{
svc: svc,
stop: make(chan struct{}),
Service: service,
stop: make(chan struct{}),
}
svc.Add(receiver)
svc.Add(eventBc)
service.Add(receiver)
service.Add(eventBc)
return svc
return service
}
func (s *Svc) VerifyConfiguration(from, to config.Configuration) error {
func (s *Service) VerifyConfiguration(from, to config.Configuration) error {
for _, addr := range to.Options.RelayServers {
_, err := url.Parse(addr)
if err != nil {
@@ -92,7 +92,7 @@ func (s *Svc) VerifyConfiguration(from, to config.Configuration) error {
return nil
}
func (s *Svc) CommitConfiguration(from, to config.Configuration) bool {
func (s *Service) CommitConfiguration(from, to config.Configuration) bool {
existing := make(map[string]*url.URL, len(to.Options.RelayServers))
for _, addr := range to.Options.RelayServers {
@@ -112,7 +112,7 @@ func (s *Svc) CommitConfiguration(from, to config.Configuration) bool {
l.Debugln("Connecting to relay", uri)
c, err := client.NewClient(uri, s.tlsCfg.Certificates, s.invitations, 10*time.Second)
if err != nil {
l.Debugln("Failed to connect to relay", uri, err)
l.Infoln("Failed to connect to relay", uri, err)
continue
}
s.tokens[key] = s.Add(c)
@@ -142,7 +142,7 @@ type Status struct {
}
// Relays return the list of relays that currently have an OK status.
func (s *Svc) Relays() []string {
func (s *Service) Relays() []string {
if s == nil {
// A nil client does not have a status, really. Yet we may be called
// this way, for raisins...
@@ -162,7 +162,7 @@ func (s *Svc) Relays() []string {
}
// RelayStatus returns the latency and OK status for a given relay.
func (s *Svc) RelayStatus(uri string) (time.Duration, bool) {
func (s *Service) RelayStatus(uri string) (time.Duration, bool) {
if s == nil {
// A nil client does not have a status, really. Yet we may be called
// this way, for raisins...
@@ -182,7 +182,7 @@ func (s *Svc) RelayStatus(uri string) (time.Duration, bool) {
}
// Accept returns a new *tls.Conn. The connection is already handshaken.
func (s *Svc) Accept() *tls.Conn {
func (s *Service) Accept() *tls.Conn {
return <-s.conns
}
@@ -234,8 +234,8 @@ func (r *invitationReceiver) Stop() {
// no way to get the event feed directly from the relay lib. This may be
// something to revisit later, possibly.
type eventBroadcaster struct {
svc *Svc
stop chan struct{}
Service *Service
stop chan struct{}
}
func (e *eventBroadcaster) Serve() {
@@ -247,7 +247,7 @@ func (e *eventBroadcaster) Serve() {
for {
select {
case <-timer.C:
curOKRelays := e.svc.Relays()
curOKRelays := e.Service.Relays()
changed := len(curOKRelays) != len(prevOKRelays)
if !changed {

View File

@@ -58,13 +58,9 @@ func (n *IGD) URL() *url.URL {
// An IGDService is a specific service provided by an IGD.
type IGDService struct {
serviceID string
serviceURL string
serviceURN string
}
func (s *IGDService) ID() string {
return s.serviceID
ID string
URL string
URN string
}
type Protocol string
@@ -75,9 +71,9 @@ const (
)
type upnpService struct {
ServiceID string `xml:"serviceId"`
ServiceType string `xml:"serviceType"`
ControlURL string `xml:"controlURL"`
ID string `xml:"serviceId"`
Type string `xml:"serviceType"`
ControlURL string `xml:"controlURL"`
}
type upnpDevice struct {
@@ -132,8 +128,8 @@ nextResult:
if existingResult.uuid == result.uuid {
if shouldDebug() {
l.Debugf("Skipping duplicate result %s with services:", result.uuid)
for _, svc := range result.services {
l.Debugf("* [%s] %s", svc.serviceID, svc.serviceURL)
for _, service := range result.services {
l.Debugf("* [%s] %s", service.ID, service.URL)
}
}
continue nextResult
@@ -143,8 +139,8 @@ nextResult:
results = append(results, result)
if shouldDebug() {
l.Debugf("UPnP discovery result %s with services:", result.uuid)
for _, svc := range result.services {
l.Debugf("* [%s] %s", svc.serviceID, svc.serviceURL)
for _, service := range result.services {
l.Debugf("* [%s] %s", service.ID, service.URL)
}
}
}
@@ -317,9 +313,9 @@ func getChildDevices(d upnpDevice, deviceType string) []upnpDevice {
func getChildServices(d upnpDevice, serviceType string) []upnpService {
var result []upnpService
for _, svc := range d.Services {
if svc.ServiceType == serviceType {
result = append(result, svc)
for _, service := range d.Services {
if service.Type == serviceType {
result = append(result, service)
}
}
return result
@@ -352,7 +348,7 @@ func getServiceDescriptions(rootURL string, device upnpDevice) ([]IGDService, er
return result, nil
}
func getIGDServices(rootURL string, device upnpDevice, wanDeviceURN string, wanConnectionURN string, serviceURNs []string) []IGDService {
func getIGDServices(rootURL string, device upnpDevice, wanDeviceURN string, wanConnectionURN string, URNs []string) []IGDService {
var result []IGDService
devices := getChildDevices(device, wanDeviceURN)
@@ -370,21 +366,21 @@ func getIGDServices(rootURL string, device upnpDevice, wanDeviceURN string, wanC
}
for _, connection := range connections {
for _, serviceURN := range serviceURNs {
services := getChildServices(connection, serviceURN)
for _, URN := range URNs {
services := getChildServices(connection, URN)
l.Debugln(rootURL, "- no services of type", serviceURN, " found on connection.")
l.Debugln(rootURL, "- no services of type", URN, " found on connection.")
for _, service := range services {
if len(service.ControlURL) == 0 {
l.Infoln(rootURL+"- malformed", service.ServiceType, "description: no control URL.")
l.Infoln(rootURL+"- malformed", service.Type, "description: no control URL.")
} else {
u, _ := url.Parse(rootURL)
replaceRawPath(u, service.ControlURL)
l.Debugln(rootURL, "- found", service.ServiceType, "with URL", u)
l.Debugln(rootURL, "- found", service.Type, "with URL", u)
service := IGDService{serviceID: service.ServiceID, serviceURL: u.String(), serviceURN: service.ServiceType}
service := IGDService{ID: service.ID, URL: u.String(), URN: service.Type}
result = append(result, service)
}
@@ -525,9 +521,9 @@ func (s *IGDService) AddPortMapping(localIPAddress string, protocol Protocol, ex
<NewPortMappingDescription>%s</NewPortMappingDescription>
<NewLeaseDuration>%d</NewLeaseDuration>
</u:AddPortMapping>`
body := fmt.Sprintf(tpl, s.serviceURN, externalPort, protocol, internalPort, localIPAddress, description, timeout)
body := fmt.Sprintf(tpl, s.URN, externalPort, protocol, internalPort, localIPAddress, description, timeout)
response, err := soapRequest(s.serviceURL, s.serviceURN, "AddPortMapping", body)
response, err := soapRequest(s.URL, s.URN, "AddPortMapping", body)
if err != nil && timeout > 0 {
// Try to repair error code 725 - OnlyPermanentLeasesSupported
envelope := &soapErrorResponse{}
@@ -549,9 +545,9 @@ func (s *IGDService) DeletePortMapping(protocol Protocol, externalPort int) erro
<NewExternalPort>%d</NewExternalPort>
<NewProtocol>%s</NewProtocol>
</u:DeletePortMapping>`
body := fmt.Sprintf(tpl, s.serviceURN, externalPort, protocol)
body := fmt.Sprintf(tpl, s.URN, externalPort, protocol)
_, err := soapRequest(s.serviceURL, s.serviceURN, "DeletePortMapping", body)
_, err := soapRequest(s.URL, s.URN, "DeletePortMapping", body)
if err != nil {
return err
@@ -566,9 +562,9 @@ func (s *IGDService) DeletePortMapping(protocol Protocol, externalPort int) erro
func (s *IGDService) GetExternalIPAddress() (net.IP, error) {
tpl := `<u:GetExternalIPAddress xmlns:u="%s" />`
body := fmt.Sprintf(tpl, s.serviceURN)
body := fmt.Sprintf(tpl, s.URN)
response, err := soapRequest(s.serviceURL, s.serviceURN, "GetExternalIPAddress", body)
response, err := soapRequest(s.URL, s.URN, "GetExternalIPAddress", body)
if err != nil {
return nil, err

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-BEP" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-BEP" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-bep \- Block Exchange Protocol v1
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-CONFIG" "5" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-CONFIG" "5" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-config \- Syncthing Configuration
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-DEVICE-IDS" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-DEVICE-IDS" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-device-ids \- Understanding Device IDs
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-EVENT-API" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-EVENT-API" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-event-api \- Event API
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-FAQ" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-FAQ" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-faq \- Frequently Asked Questions
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-GLOBALDISCO" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-GLOBALDISCO" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-globaldisco \- Global Discovery Protocol v3
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-LOCALDISCO" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-LOCALDISCO" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-localdisco \- Local Discovery Protocol v3
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-NETWORKING" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-NETWORKING" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-networking \- Firewall Setup
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-RELAY" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-RELAY" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-relay \- Relay Protocol v1
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-REST-API" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-REST-API" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-rest-api \- REST API
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-SECURITY" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-SECURITY" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-security \- Security Principles
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING-STIGNORE" "5" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING-STIGNORE" "5" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing-stignore \- Prevent files from being synchronized to other nodes
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "TODO" "7" "December 18, 2015" "v0.12" "Syncthing"
.TH "TODO" "7" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
Todo \- Keep automatic backups of deleted files by other nodes
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SYNCTHING" "1" "December 18, 2015" "v0.12" "Syncthing"
.TH "SYNCTHING" "1" "December 21, 2015" "v0.12" "Syncthing"
.SH NAME
syncthing \- Syncthing
.