Can we control the types of messages exchanged over a relay?

Hello everyone,

I have been following Syncthing for slightly more than a year now. Its a wonderful platform and really fills a void in the world, kudos to the team!

I am using Syncthing as a platform for a P2P photo sharing Android app.

I need to create a Relay Server for this app, and I will be able to do it using the lovely documentation you guys maintain. Thank you for that, seriously. There is one piece of info I am not able to extract though,

Can I configure Syncthing to send only “Cluster Config”, “Index” and “Index Update” messages WHEN using a Relay?

The reason I want to do this, is to avoid internet data charges of transferring huge amounts of data. Quite a problem in India :slight_smile:

Hope this is a valid use case and would love to hear from @calmh, @AudriusButkevicius and @Nutomic

Could you explain why you want this, exactly?

The point of a relay is so that Syncthing can transfer data even when it can’t establish a direct connection between devices. If you don’t allow Syncthing to send all message types, then it won’t be able to transfer any data, which defeats the point of having a relay in the first place.

Either way, I rather suspect Syncthing hasn’t been written to cope with only some of its messages working. It expects to be able to send anything it wants.

Hi Antony,

Consider the following case:

A folder contains 5GB of data spread across 1000 image files. I would like a new device this folder is just shared with to know what is it missing over the internet, since, it would only cost a few KBs or may be MBs to know the indexes of other devices. However, the actual images would cost it GBs of mobile data, which may get expensive.

The actual data can be transferred when the devices come nearby.

Relay has no idea what messages is being exchange or even if its talking syncthing protocol, so no.

Agreed. That is why I asked if we can configure “Syncthing” to only share indexes and index updates when communicating via a relay. I think Syncthing knows if it is using a relay to connect to a device.

No you cannot. I suggest you use ip address whilelists blacklists and deal with this and face the music of not being able to connect at this period in time.

You are suggesting to use whitelist/blacklist at the relay server or syncthing?

One way out that I could think of is rejecting the data request messages at the relay server from any device. Is this what you were suggesting?

You would need to do this in syncthing, not the relay. That said, this sounds like a somewhat convoluted solution to a niche problem so I doubt we would implement it.

I am suggesting not to connect at all, if you do not have bandwidth.

@calmh I can implement this and then raise a pull request. Would that be acceptable?

I would be highly against merging it as it satisfies only your own use case. You could maintain your own fork, but I still don’t understand why can’t you just stay disconnected if you don’t have the bandwidth.

Yeah, no, I don’t think so either.

@AudriusButkevicius Staying disconnected won’t allow for exchanging index info of peers as well. This is critical for improving usability.

Anyways, will fork out and maintain a separate branch.

Thanks to all of you @canton7, @calmh and @AudriusButkevicius for your quick responses.

Is there an API to GET the index of each device-folder combination from the local index db?

I’m not sure exactly what you mean, but the API is documented here: https://docs.syncthing.net/dev/rest.html