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 · 7 comments · May be fixed by #267
Open

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

hexclann opened this issue May 19, 2024 · 7 comments · May be fixed by #267
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";

@schlagmichdoch
Copy link
Owner

This

  • 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

Draft

This will be implemented as a ENV VAR:

  • DEVICE_GROUPING
    Set how devices are finding each other. Can be combined as a comma separated list.
    • DEVICE_GROUPING=ALL: All devices find each other mutually. UI for Pairing and Public Rooms is disabled.
    • DEVICE_GROUPING=IP: Devices on the same network find each other automatically. No Pairing, No Public Rooms.
    • DEVICE_GROUPING=SECRET: Devices can only use Pairing to find each other. UI for Public Rooms is disabled.
    • DEVICE_GROUPING=PUBLIC_ROOM: Devices can only use Public Rooms to find each other. UI for Pairing is disabled.
    • DEVICE_GROUPING=IP,SECRET,PUBLIC_ROOM: Devices on the same network find each other automatically. Additionally, Pairing and Public Rooms are enabled (default)

@magicindex
Copy link

Yes, I also had a similar issue that has not been resolved.
Mobile phone networks and computer broadband networks cannot be discovered by any means. It's normal to be within the same network.

是的我也出现了类似的问题,一直没有得到解决。
手机移动网络和电脑宽带网络通过各种方式都不能相互发现。在同一网络内是正常的。

:-----------------------------请看下该配置是否有问题----------------------------------
version: "3"
services:
pairdrop:
image: "lscr.io/linuxserver/pairdrop:latest"
container_name: pairdrop
restart: unless-stopped
environment:
- PUID=1000 # UID to run the application as
- PGID=1000 # GID to run the application as
- IPV6_LOCALIZE=7 #客户端 IPv6 地址段作为对等体的 IP
- DETECT_PRIVATE_IPS=true #指定所有具有私有 IP 的设备是否应相互看到彼此
- DEVICE_GROUPING=ALL #所有设备相互查找。配对和公共房间的 UI 已禁用。
# - DEVICE_GROUPING=IP,SECRET,PUBLIC_ROOM #同一网络中的设备会自动找到彼此。此外,配对和公共房间已启用(默认)
- WS_FALLBACK=false # Set to true to enable websocket fallback if the peer to peer WebRTC connection is not available to the client.
- RATE_LIMIT=false # Set to true to limit clients to 1000 requests per 5 min.
- RTC_CONFIG=false # Set to the path of a file that specifies the STUN/TURN servers.
- DEBUG_MODE=false # Set to true to debug container and peer connections.
- TZ=Asia/ShanghaiC # Time Zone
ports:
# - "127.0.0.1:3000:3000" # Web UI
- 3000:3000

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

Successfully merging a pull request may close this issue.

3 participants