Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] How to make all clients mutually visible to each other? #301

Open
hexclann opened this issue May 19, 2024 · 5 comments
Open
Labels

Comments

@hexclann
Copy link

hexclann commented May 19, 2024

I have a private pairdrop instance with coturn on a VPS behind Cloudflare proxy. Since I use it for my own devices, I would like to have all the clients visible to each other by default even if they are on different networks.

In my nginx config I've commented out the X-Forwarded-For and during the docker deployment I have set the IPV6_LOCALIZE=7 but I'm unable to see the devices which are on different networks.

Im aware of the room sharing feature but I want to have the above setup for easy access. How can I achieve this?

@hexclann hexclann added the enhancement New feature or request label May 19, 2024
@schlagmichdoch
Copy link
Owner

The IPV6_LOCALIZE variable only works, if PairDrop only sees v6 IP addresses. Probably, this is not the case for your setup.

There might be a hackish way to do it: Setting the x-forwarded-for header to a static value should have the desired effect. Then PairDrop gets the same (fake) IP address for all devices, so they should be mutually visible:

proxy_set_header X-Forwarded-For "127.0.0.1";

Enabling this behavior via env var is not implemented yet, but I’ll probably add it soon as more users have requested something along these lines.

Todo:

  • Implement environment variable(s) to switch on/off pairing and public rooms
    • This hides the buttons and dialogs from users and deactivates the api on the backend
  • Implement environment variable to make all devices see each other mutually
    • if set to true this should set environment variables for pairing and public rooms to false (if not set by user)
  • Add docs and example as docker-compose-local-network.yml

@hexclann
Copy link
Author

I added the header but I couldn't see clients if they are not in the same network. This is my nginx proxy config:

location / {
        proxy_http_version          1.1;
        proxy_set_header            Host $host;
        proxy_set_header            Connection "";
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For "127.0.0.1";
        proxy_pass http://127.0.0.1:20000;
    }

I restarted the docker container and nginx but no luck. Do I need to recreate the container without the IPV6_LOCALIZE variable?

@schlagmichdoch
Copy link
Owner

You don’t need the IPv6 localize variable.
Try to set DEBUG_MODE=true and take a look at the docker log when connecting two devices on different networks. It should hint in the right direction:
https://github.com/schlagmichdoch/PairDrop/blob/master/docs/host-your-own.md#debug-mode

@hexclann
Copy link
Author

I relaunched the container with debug mode enabled, here's the log:

When clients are on different networks (invisible):


PairDrop is running on port 3000


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: MY.VPS.IP.ADDRESS
PairDrop uses: MY.VPS.IP.ADDRESS
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----
Connection to localhost (::1) 3000 port [tcp/*] succeeded!
[ls.io-init] done.


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: undefined
PairDrop uses: 127.0.0.1
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: MY.VPS.IP.ADDRESS
PairDrop uses: MY.VPS.IP.ADDRESS
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: MY.VPS.IP.ADDRESS
PairDrop uses: MY.VPS.IP.ADDRESS
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: undefined
PairDrop uses: 127.0.0.1
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----

when clients are on the same network: (visible)

----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: undefined
PairDrop uses: 127.0.0.1
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----


----DEBUGGING-PEER-IP-START----
remoteAddress: ::ffff:172.17.0.1
x-forwarded-for: 127.0.0.1
cf-connecting-ip: undefined
PairDrop uses: 127.0.0.1
IP is private: false
if IP is private, '127.0.0.1' is used instead
----DEBUGGING-PEER-IP-END----

@schlagmichdoch
Copy link
Owner

Thanks for the logs!

Is MY.VPS.IP.ADDRESS the ip of the server you are running PairDrop on?
Is this after you added the overwrite to the nginx conf? If yes, could you please also provide logs without the overwrite?

When behind cloudflare, the CF-Connecting-IP header should normally include the real visitor ip address of the clients. This does not seem to work. Can you take a look whether Remove visitor IP headers is correctly disabled?
https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-connecting-ip

As CF-Connecting-IP is prioritized over X-Forwarded-For the easiest would be to use that instead:

proxy_set_header CF-Connecting-IP "127.0.0.1";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants