Repository navigation
Description
What happened?
I'm testing syncthing on a closed (not public) controlled environment heavily relying on DNS (split views and all). The test setup consists of 3 hosts, 2 fixed IP servers at different locations and a traveling laptop. I've set up a private discovery server on a publicly accessible address so hosts can find each other. The laptop is not yet involved in the process but I see potential problems with the next part.
On each fixed IP server the config.xml is configured as such
<listenAddress>tcp://sync.example.com:22000</listenAddress>
<listenAddress>quic://sync.example.com:22000</listenAddress>
<globalAnnounceServer>https://disco.example.com</globalAnnounceServer>
<globalAnnounceServer>https://disco.foobar.com</globalAnnounceServer>
<globalAnnounceEnabled>true</globalAnnounceEnabled>and
<listenAddress>tcp://sync.foobar.com:22000</listenAddress>
<listenAddress>quic://sync.foobar.com:22000</listenAddress>
<globalAnnounceServer>https://disco.example.com</globalAnnounceServer>
<globalAnnounceServer>https://disco.foobar.com</globalAnnounceServer>
<globalAnnounceEnabled>true</globalAnnounceEnabled>With the split DNS config, each server have an internal IP within the lab and the public one for everyone else.
When syncthing sends the announcement it goes like this
DBG send announcement (server=https://disco.example.com announcement="{[tcp://sync.example.com:22000 tcp://0.0.0.0:0 quic://sync.example.com:22000]}" log.pkg=discover log.type=globalclient log.src.file=global.go log.src.line=279)
and
DBG send announcement (server=https://disco.foobar.com announcement="{[tcp://sync.example.com:22000 tcp://0.0.0.0:0 quic://sync.example.com:22000]}" log.pkg=discover log.type=globalclient log.src.file=global.go log.src.line=279)
Why the extraneous tcp://0.0.0.0:0?
Then, requesting each discovery server shows the internal IP of each server which is not desired!
$ curl -s 'https://disco.foobar.com/?device=ID_OF_SERVER1' | jq .
{
"seen": "2025-12-21T18:07:29+01:00",
"addresses": [
"quic://sync.example.com:22000",
"tcp://10.1.1.63:22000",
"tcp://sync.example.com:22000"
]
}and the other way around of course. Each external discovery server gets the internal IP because syncthing sends it without being asked to do so.
If this is intended behavior, would it then be possible to add an option to disable that and only send what's specified on the listenAddress lines?
Syncthing version
v2.0.12
Platform & operating system
Linux amd64
Browser version
No response
Activity
calmh commentedon Dec 21, 2025
It's intended yes, the unspecified address is interpreted as the address the announcement comes from, which is effectively the only or most important one for normal dynamic clients. If I remember correctly it's sent when Syncthing listens on a wildcard address.
NealPierceGH commentedon Dec 22, 2025
Yeah but as I didn't specified
dynamicin the config, I'd like syncthing to respect that and not send this barebones IP.Only send
(server=https://disco.example.com announcement="{[tcp://sync.example.com:22000 quic://sync.example.com:22000]}"and nothing else.For my servers it's not a problem because I control them and there's no issue but for my laptop it's another story. When I work for sensitive clients inside their network where every single connection to their internal hosts is monitored, I may inadvertently raise some eyebrows because by some dumb luck, their network addressing and mine are too similar and they see my laptop trying to connect to their hosts. (Already happened that's why I mention it)
As mentioned in my first message, I'd vote for an option in the XML config to disable that and only advertise hostnames exactly as stated in
listenAddress, pretty please 😄fix(discover): only announce wildcard for TCP punching when listening…
Merge branch 'main' into db-drop-dev-vs-index
[codex] Merge upstream stable v2.1.1 into main (#23)