schlagmichdoch / PairDrop

PairDrop: Transfer Files Cross-Platform. No Setup, No Signup.
https://pairdrop.net
GNU General Public License v3.0
4.4k stars 245 forks source link

[Bug] cf tunnel+device discovery not working #189

Closed rafalohaki closed 2 months ago

rafalohaki commented 11 months ago

I try to host pairdrop and using cloudflare tunnel i get log about connecting other device to network but its not loading fully and with error i tried some ways but still not working

this is what i get when i set up IPV6_LOCALIZE=true raw

this is when i set up IPV6_LOCALIZE=false

raw

with IPV6_LOCALIZE=4 i get raw its discovering device in console but not in gui and after 3 seconds, there is an error.

should i set true to Disable Chunked Encoding/No Happy Eyeballs? what env should i use which ip exposed/local should i reverse to make it work woth cloudflare tunnel I tried to solve problem looking through this issue https://github.com/schlagmichdoch/PairDrop/issues/69 but still no result

my docker compose:

version: "4" services: pairdrop: image: lscr.io/linuxserver/pairdrop container_name: pairdrop environment:

schlagmichdoch commented 11 months ago

As the error message explains you need to deploy a TURN server alongside PairDrop for it to work behind Cloudflare. See Deployment notes for instructions.

Probably I should also provide a docker-compose file that does it all at once. I will look into it.

alexonpeace commented 11 months ago

i got same issue i think only after recent update even without cf bypassed it wouldn't work on a different network

schlagmichdoch commented 11 months ago

@alexonpeace have you deployed a TURN server? If at least one device is behind a NAT you need that for connections:

TURN server for Internet Transfer

Beware that you have to host your own TURN server to enable transfers between different networks.

Follow this guide to either install coturn directly on your system (Step 1) \ or deploy it via docker-compose (Step 5).

Alternatively, use a free, pre-configured TURN server like OpenRelay

schlagmichdoch commented 11 months ago

I have refactored the documentation and fixed the Docker Compose file to host coturn alongside PairDrop.

@alexonpeace @rafalohaki Please checkout this branch to test if everything is as easy as expected:

  1. git clone https://github.com/schlagmichdoch/PairDrop.git
  2. cd PairDrop
  3. git checkout fix-turn-container
  4. Follow the guide at https://github.com/schlagmichdoch/PairDrop/blob/fix-turn-container/docs/host-your-own.md#coturn-and-pairdrop-via-docker-compose

After your feedback I would merge this into master.

schlagmichdoch commented 11 months ago

Corresponding PR: #195

schlagmichdoch commented 5 months ago

The following comments were deleted by GitHub (via hubot) as part of mistakenly marking this account as spam on 17th February 2024. The correct thread order and the creation date is unclear. I decided to manually restore them anyway in order to complete the information this issue holds even though the restored information might be outdated:

Comment by @schlagmichdoch:

The docker changes have since been released into v1.10.0 so your can also find the documentation on the master branch: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/host-your-own.md#coturn-and-pairdrop-via-docker-compose

Have you since had any luck in hosting your PairDrop instance? :)

rafalohaki commented 4 months ago

i used stun server from cloudflare. its working

dforel commented 2 months ago

i use stun,its not working, i don't know where is wrong.

i use google'turn server(stun.l.google.com), when i test webrtc on https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/,its work,but,when i use my deploy pairdrop,it show rtc connection failed。

schlagmichdoch commented 2 months ago

Closing this as stale. Feel free to reopen if the issue is still present.

andreapx commented 1 month ago

i used stun server from cloudflare. its working

@rafalohaki can you share some info on how you did it? I've added the variable RTC_CONFIG=/config/rtc_config.json into my docker-compose.yaml, I've created the file rtc_config.json like this:

{
  "sdpSemantics": "unified-plan",
  "iceServers": [
    {
      "urls": "stun:stun.cloudflare.com:3478"
    }
  ]
}

The files gets read because in the log I see:

----DEBUG ENVIRONMENT VARIABLES----
pairdrop    | {
pairdrop    |     "debugMode": true,
pairdrop    |     "port": 3000,
pairdrop    |     "wsFallback": false,
pairdrop    |     "rtcConfig": {
pairdrop    |         "sdpSemantics": "unified-plan",
pairdrop    |         "iceServers": [
pairdrop    |             {
pairdrop    |                 "urls": "stun:stun.cloudflare.com:3478"
pairdrop    |             }
pairdrop    |         ]
pairdrop    |     },
pairdrop    |     "signalingServer": false,
pairdrop    |     "ipv6Localize": false,
pairdrop    |     "rateLimit": false,
pairdrop    |     "buttons": {
pairdrop    |         "donation_button": {},
pairdrop    |         "twitter_button": {},
pairdrop    |         "mastodon_button": {},
pairdrop    |         "bluesky_button": {},
pairdrop    |         "custom_button": {},
pairdrop    |         "privacypolicy_button": {}
pairdrop    |     },
pairdrop    |     "autoStart": false,
pairdrop    |     "localhostOnly": false
pairdrop    | }

But it still doesn't see devices outside the same LAN that I pair.

schlagmichdoch commented 1 month ago

But it still doesn't see devices outside the same LAN that I pair.

You’ll need to run a turn server alongside PairDrop in order to achieve that: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/host-your-own.md#turn-server-for-internet-transfer

andreapx commented 1 month ago

But it still doesn't see devices outside the same LAN that I pair.

You’ll need to run a turn server alongside PairDrop in order to achieve that: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/host-your-own.md#turn-server-for-internet-transfer

Oh, I thought that a STUN server was enough (sorry, I don't know much about STUN/TURN). Thanks

schlagmichdoch commented 1 month ago

There’s more info on the topic here: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/technical-documentation.md#encryption-webrtc-stun-and-turn

andreapx commented 1 month ago

There’s more info on the topic here: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/technical-documentation.md#encryption-webrtc-stun-and-turn

Thanks a lot! That helped me understand how it works.

afly007 commented 2 weeks ago

i used stun server from cloudflare. its working

@rafalohaki any chance you have a config available to share?

rafalohaki commented 2 weeks ago

i used stun server from cloudflare. its working

@rafalohaki any chance you have a config available to share? rtc_config.json image

docker compose image