Commit Graph
853 Commits
Author SHA1 Message Date
Jakob Borg 7132c8fcdd wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-29 11:13:00 +01:00
Jakob Borg 9f5ea0a920 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-29 10:58:17 +01:00
Jakob Borg 1545f78ffc wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-25 22:58:04 +01:00
Jakob Borg 2ca16e130e wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-25 21:51:04 +01:00
Jakob Borg 75af469af3 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-25 21:47:47 +01:00
Jakob Borg c500677a2a remove excessive diags
Signed-off-by: Jakob Borg <[email protected]>
2026-11-25 21:34:15 +01:00
Jakob Borg 772f702a93 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-25 21:33:27 +01:00
Jakob Borg 16e431380a wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 19:32:49 +01:00
Jakob Borg 2783873ee8 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 19:32:16 +01:00
Jakob Borg bdb9178ed7 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 19:31:28 +01:00
Jakob Borg 75de21e3e8 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 19:27:30 +01:00
Jakob Borg 5fac38aaf8 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 13:02:45 +01:00
Jakob Borg 3d04cf99f2 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-24 07:55:55 +01:00
Jakob Borg 1afeed6001 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-21 16:19:30 +01:00
Jakob Borg 35bd981d07 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-21 08:53:53 +01:00
Jakob Borg 6fc9168a28 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-21 08:47:26 +01:00
Jakob Borg 449019fbf3 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-19 14:16:40 +01:00
Jakob Borg 975f2229b6 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-19 12:47:52 +01:00
Jakob Borg 7b0329c64a wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-19 12:14:44 +01:00
Jakob Borg 65b7ef649a wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-19 10:38:55 +01:00
Jakob Borg ea4b42aa38 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-19 10:32:32 +01:00
Jakob Borg 5a4f1f2547 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-18 23:56:13 +01:00
Jakob Borg 5f7f9811d4 diag
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 10:09:32 +01:00
Jakob Borg a79f88536b wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:55:51 +01:00
Jakob Borg b1202e472b wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:54:26 +01:00
Jakob Borg a30e2099f8 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:52:38 +01:00
Jakob Borg 6b1f6175b8 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:52:06 +01:00
Jakob Borg e6c7b64af4 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:47:13 +01:00
Jakob Borg 81898f0a65 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 07:39:30 +01:00
Jakob Borg 2bf36251af wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 06:46:04 +01:00
Jakob Borg 08004e61ae wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 05:33:18 +01:00
Jakob Borg 9299ece8d9 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 05:24:06 +01:00
Jakob Borg d05fbecc4f wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 05:20:21 +01:00
Jakob Borg 2854364c0b enc
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 05:16:55 +01:00
Jakob Borg a60e77eb6b wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-17 05:13:32 +01:00
Jakob Borg d21f613102 wip
Signed-off-by: Jakob Borg <[email protected]>
2026-11-13 07:38:50 +01:00
Jakob Borg 3f795834db feat: Peer-to-peer discovery (fixes #3388)
This implements a new peer-to-peer-based discovery protocol.

- The DHT is based on libp2p (of IPFS etc) and constitutes a new,
  separate Syncthing-specific network. It does not piggyback on any
  existing non-Syncthing nodes out there.
- It uses existing device IDs as the keys, and publishes discovery
  documents that include the device certificate and are signed by the
  same. This enables validation that the discovery data is _for_ the
  right device ID, as well as published _by_ that device.
- The DHT runs on the QUIC socket, so it shares UPnP/NAT-PMP whole
  punches and STUN discovery. (Unless the QUIC listener is disabled,
  then it runs on an ephemeral socket and can effectively do only
  queries and not participate as a full DHT node.)
- There is a hardcoded default pointing to three bootstrap nodes hosted
  in the usual manner.
- Currently it's strictly additive -- it runs separately and in
  parallell with the usual global discovery. Once proven and scaled, it
  will gradually take over the duties of the global discovery.
- There is a new command line tool `stdht` which just runs a DHT node to
  assist with discovery (the bootstrap nodes are this).

The diff is large and terrifying, but that's how it is.

Signed-off-by: Jakob Borg <[email protected]>
2026-11-05 22:43:18 +01:00
Jakob Borg ed38528d7f fix: invalid files on remote devices are not "available" (fixes #10943) (#10944)
Properly exclude them from the corresponding query.

Signed-off-by: Jakob Borg <[email protected]>
2026-10-27 12:25:15 +01:00
Jakob Borg 7eee65afc6 chore(protocol): add protovalidate validation of incoming messages, reasonable limits (#10838)
This adds pre-validation directly at the unmarshal step, of annotations
added to the protobuf definitions. This seeks to weed out unreasonable
situations early, by ensuring offsets are positive, string lengths are
limited, etc. Some of the limits are a bit subjective, but I think I've
put them above what is expected and reasonable...

---------

Signed-off-by: Jakob Borg <[email protected]>
2026-10-18 11:09:03 +02:00
Jakob Borg 5fb192176d fix(sqlite): do not generate unbounded prepared statements (ref #10913) (#10915)
The API can use arbitrary paging parameters, causing arbitrary numbers
of prepared statements, which becomes a memory leak.

Signed-off-by: Jakob Borg <[email protected]>
2026-10-07 19:08:43 +02:00
Jakob Borg 84329b277f fix(sqlite): avoid early garbage collection of deleted recv-enc files (#10916)
Signed-off-by: Jakob Borg <[email protected]>
2026-10-07 19:07:32 +02:00
Jakob Borg 529ced6c6b fix: handle missing max-sequence file entries (#10912)
This could happen when a folder has deleted files as the latest entries,
and nothing else happened for 180 days (the default tombstone cleanup
time).

Signed-off-by: Jakob Borg <[email protected]>
2026-10-07 18:32:44 +02:00
Jakob Borg 8ea09c0094 chore: style fixes from go fix (#10846)
Just `go fix ./...`

Signed-off-by: Jakob Borg <[email protected]>
2026-08-05 20:23:22 +02:00
Jakob Borg 946e2b83a1 fix(db, model): better handle db connections, puller concurrency, avoid deadlock (fixes #10841) (#10842)
There is a danger of deadlock wherever we have database operations
inside a database iterator. The iterator itself pins a connection, so
the nested operations need another connection; if we've reached
maxOpenConns then it blocks until a connection is released. If all
connections are consumed by such iterators then none can make progress.

Luckily, we have limited concurrency for most such iterator loops. They
are part of scanning, pulling, reverting, etc where there is only ever
one such routine per folder. The exception is block reuse in the copier
routine, which is limited by the `Copiers` setting per folder. This
could in practice deadlock since you could set copiers to eight and end
up with six `AllLocalBlocksWithHash` iterators when `maxDBConns=6`, all
of which need to make additional database calls inside the loop.

This PR fixes the problem twice;

- The problematic loop does not need to be reentrant. The set of blocks
that may be returned by the iterator is finite so we can easily just
collect them to a slice before we start processing them. This avoids the
problem entirely.
- We do not need to limit database connections as strictly as we
currently do. Increase the maximum allowed, while reducing the number of
held-open idle connections slightly. This is not an exact science, but
ideally we want "most" operations to be able to use the pinned
connections to avoid cache churn. Most operations are short lived
queries, or single-goroutine iterators with short lived queries inside,
so four connections seems like it should usually be enough. 🤷
- Additionally, set a cap on Copiers. Currently you could set it to an
arbitrarily large number, which is not advantageous. Limit it to
2*NumCPU which scales somewhat with system performance.

Signed-off-by: Jakob Borg <[email protected]>
2026-08-03 23:36:05 +02:00
Jakob Borg 44cbfcad56 fix(sqlite): update last migration to set schema version, counts (#10768)
The counts needs to be modified manually since we're not running
triggers during migrations. The schema version needed to be bumped.

Signed-off-by: Jakob Borg <[email protected]>
2026-06-26 07:22:40 +02:00
Simon Frei c9236b1adc chore: stop treating dirs as having size 128 (#10750)
Resp. directories for the database, and both dirs and symlinks for
`FileInfo.FileSize`. Instead handle it in the UI progress percentage. We
even already have special cases there for deletions, might as well
handle directories just like any other zero-sized needed item there.

This went through the very thorough testing of running it on my laptop,
the migration was applied and it seemed to be working fine after.

---------

Signed-off-by: Simon Frei <[email protected]>
2026-06-22 20:32:03 +02:00
e16b8013a6 chore(db, model): separate methods to drop a device vs its files (#10480)
Fixes #10469

---------

Signed-off-by: Simon Frei <[email protected]>
Signed-off-by: Jakob Borg <[email protected]>
Co-authored-by: Marcus B Spencer <[email protected]>
Co-authored-by: Jakob Borg <[email protected]>
2026-06-04 18:28:19 +00:00
mattn 8ca3cca0a0 chore: use path/filepath for local file system paths (#10705)
### Purpose

`path` is for slash-separated paths (URLs, BEP protocol); local file
system paths should use `path/filepath`. Fixed in
`cmd/stdiscosrv/database.go` (3 sites) and
`internal/db/sqlite/db_test.go` (1 site).

### Testing

`go build ./cmd/stdiscosrv/...` and `go vet` pass.

Signed-off-by: Yasuhiro Matsumoto <[email protected]>
2026-05-23 22:31:33 +02:00
Jakob Borg 86ac4e5017 feat: make block indexing configurable (#10608)
This adds a new folder-level configuration `FullBlockIndex`. It controls
whether we maintain the block index for a given folder -- currently
that's always true, now it becomes possible to turn off. The block index
is used for lookup of blocks across files and folders. Effectively, when
syncing a change, for each block, we check:

1. Is the block already present in the old version of the file? If so,
we can reuse (copy) it without network transfer. **This check is always
possible.**
2. Is the block already present in any other file in this folder or
other folders? If so we can copy it. **This check is only possible with
the full block index.**
3. We must transfer the block over the network.

Maintaining the full block index is costly in time, I/O and database
size. With this PR, maintaining the full block index becomes the default
for send-receive and receive-only folders only, with it disabled for
send-only and receive-encrypted folders. The block index is never useful
for encrypted folders, as blocks are encrypted separate for each file.
It is also not useful for send-only folders by themselves, though the
data in the send-only folder could be reused by other receive-type
folders if it were enabled.

For very large folders it may make sense to disable the full block index
regardless of folder type and just accept the resulting decrease in data
reuse.

Disabling or enabling the option in the GUI causes the index to be
destroyed or rebuilt accordingly.

https://github.com/syncthing/docs/pull/1005

---------

Signed-off-by: Jakob Borg <[email protected]>
2026-04-26 11:58:09 +02:00
Jakob Borg b39c56f82d chore: remove tracking inode change time (#10579)
Signed-off-by: Jakob Borg <[email protected]>
2026-03-22 20:24:03 -07:00