syncthing/lib/config
André Colomb b9c6d3ae09
fix(config): skip GUI port probing for UNIX sockets (fixes #9855) (#9858)
When creating an initial default config, we usually probe for a free
TCP port.  But when a UNIX socket is specified via the `STGUIADDRESS=`
override or the `--gui-address=unix:///...` command line syntax, parsing
that option will fail during port probing.

The solution is to just skip the port probing when the address is
determined to specify something other than a TCP socket.

### Testing

Start with a fresh home directory each time.
1. Specify a UNIX socket for the GUI (works with this PR):

TMPHOME=$(mktemp -d); ./syncthing --home=$TMPHOME
--gui-address=unix://$TMPHOME/socket

2. Specify no GUI address (probes for a free port if default is taken,
   as before):

       TMPHOME=$(mktemp -d); ./syncthing --home=$TMPHOME

3. Specify a TCP GUI address (probes whether the given port is taken,
   as before):

TMPHOME=$(mktemp -d); ./syncthing --home=$TMPHOME
--gui-address=127.0.0.1:8385
2024-12-09 07:24:42 +00:00
..
mocks lib, gui: Default ignores for new folders (fixes #7428) (#7530) 2022-01-13 23:38:21 +01:00
testdata lib/config, gui: Disallow some options in combination with "untrusted" (fixes #8920) (#8921) 2023-06-14 09:24:31 +02:00
authmode.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
blockpullorder.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
commit_test.go style: gofumpt all the things (#9829) 2024-11-19 11:32:56 +01:00
compression_test.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
compression.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
config_test.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
config.go fix(config): skip GUI port probing for UNIX sockets (fixes #9855) (#9858) 2024-12-09 07:24:42 +00:00
copyrangemethod.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
debug.go style: gofumpt all the things (#9829) 2024-11-19 11:32:56 +01:00
deviceconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
filesystemtype.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
folderconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
foldertype.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
guiconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
ldapconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
ldaptransport.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
migrations_test.go lib/api: Add /rest/config endpoint (fixes #6540) (#7001) 2020-10-22 19:54:35 +02:00
migrations.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
observed.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
optionsconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
pullorder.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
size_test.go all: Remove lib/util package (#9049) 2023-08-21 19:44:33 +02:00
size.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
tuning_test.go Implement database abstraction, error checking (ref #5907) (#6107) 2019-11-29 09:11:52 +01:00
tuning.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
versioningconfiguration.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00
wrapper.go refactor: use modern Protobuf encoder (#9817) 2024-12-01 16:50:17 +01:00