Check for CF-Connecting-IP and decreased timeout #544
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When hosting Snapdrop behind Cloudflare,
X-Forwarded-For
is useless. Furthermore, I'm hosting my installation behind another internal proxy, so, in the end,X-Forwarder-For
is set to the internal proxy's IP for all the peer, which can see each other regardless being on different networks. To fix this I made_setIP
check if the header "cf-connecting-ip" exists, then sets the IP accordingly.Lastly, when a peer changes network (e.g. a phone switches from wifi to mobile data), the function
_leaveRoom
is not called and the peer stays visible to others connected to the same room for a whole minute: I adjusted the timeout to what I think is a more reasonable value (500ms, so_leaveRoom
is called after 1s).