mat-sz / filedrop

📲 WebRTC E2E encrypted file transfer - React + node.js
https://drop.lol
BSD 3-Clause Clear License
704 stars 62 forks source link

I tested an online example and found that file transfer from PC to mobile devices is not working properly #30

Closed yaomoshen520 closed 11 months ago

yaomoshen520 commented 11 months ago

I tested an online example and found that file transfer from PC to mobile devices is not working properly. However, I checked the official WebRTC documentation and found that it is supported. Now I am a bit confused. Do I need to implement something separately on the mobile side to support WebRTC?

mat-sz commented 11 months ago

Is this an issue on the public instance (drop.lol)? If yes, what mobile device are you using (manufacturer, OS version, browser)?

ibz0q commented 11 months ago

Can confirm. In my instance I have both services exposed via macvlan like so, sharing the same IP. Code is unchanged, just using docker-compose.yaml directly.


version: "3"
networks:
    macvlan0:
      external: true
services:
  filedrop:
    build:
      context: ./
      dockerfile: Dockerfile
      args:
        - VITE_APP_NAME=filedrop
    environment:
      - WS_HOST=10.0.0.212
      - WS_APP_NAME=filedrop
      - WS_ABUSE_EMAIL=none@none.com
      - WS_USE_X_FORWARDED_FOR=0
      - WS_REQUIRE_CRYPTO=0
      - TURN_MODE=hmac
      - TURN_SERVER=turn:filedrop
      - TURN_USERNAME=filedrop
      - TURN_SECRET=akfCR/iRxv265OS8dkBF8m36fB/K/LP3Ssahj5f94qc=
    mac_address: 4a:86:5d:c6:12:11
    networks:
      macvlan0:
        ipv4_address: 10.0.0.212

  coturn:
    image: coturn/coturn
    command:
      - --log-file=stdout
      - --use-auth-secret
      - --static-auth-secret=akfCR/iRxv265OS8dkBF8m36fB/K/LP3Ssahj5f94qc=
      - --no-multicast-peers
      - --no-tls
      - --no-dtls
      - --no-software-attribute
      - --fingerprint
      - --no-cli
    depends_on:
      - filedrop
    network_mode: "service:filedrop"
    deploy:
      resources:
        limits:
          memory: 100m

Each service can see it's IP inside the container when I check with hostname -i. I can telnet to 10.0.0.212 on TCP 3478. Both clients can open the site on 5000, and both show up with names. When adding the files nothing happens.

Logs:

filedrop-coturn-1    | 0: (1): INFO: System cpu num is 4
filedrop-coturn-1    | 0: (1): INFO: System cpu num is 4
filedrop-coturn-1    | 0: (1): INFO: System enable num is 4
filedrop-coturn-1    | 0: (1): WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used.
filedrop-coturn-1    | 0: (1): INFO: Coturn Version Coturn-4.6.2 'Gorst'
filedrop-coturn-1    | 0: (1): INFO: Max number of open files/sockets allowed for this process: 1048576
filedrop-coturn-1    | 0: (1): INFO: Due to the open files/sockets limitation, max supported number of TURN Sessions possible is: 524000 (approximately)
filedrop-coturn-1    | 0: (1): INFO:
filedrop-coturn-1    |
filedrop-coturn-1    | ==== Show him the instruments, Practical Frost: ====
filedrop-coturn-1    |
filedrop-coturn-1    | 0: (1): INFO: OpenSSL compile-time version: OpenSSL 3.0.11 19 Sep 2023 (0x300000b0)
filedrop-coturn-1    | 0: (1): INFO: TLS 1.3 supported
filedrop-coturn-1    | 0: (1): INFO: DTLS 1.2 supported
filedrop-coturn-1    | 0: (1): INFO: TURN/STUN ALPN supported
filedrop-coturn-1    | 0: (1): INFO: Third-party authorization (oAuth) supported
filedrop-coturn-1    | 0: (1): INFO: GCM (AEAD) supported
filedrop-coturn-1    | 0: (1): INFO: SQLite supported, default database location is /var/lib/coturn/turndb
filedrop-coturn-1    | 0: (1): INFO: Redis supported
filedrop-coturn-1    | 0: (1): INFO: PostgreSQL supported
filedrop-coturn-1    | 0: (1): INFO: MySQL supported
filedrop-coturn-1    | 0: (1): INFO: MongoDB supported
filedrop-coturn-1    | 0: (1): INFO: Default Net Engine version: 3 (UDP thread per CPU core)
filedrop-coturn-1    | 0: (1): INFO: Domain name:
filedrop-coturn-1    | 0: (1): INFO: Default realm:
filedrop-coturn-1    | 0: (1): WARNING: CONFIG: you did specify the long-term credentials usage
filedrop-coturn-1    |  but you did not specify the default realm option (-r option).
filedrop-coturn-1    |          Check your configuration.
filedrop-coturn-1    | 0: (1): INFO: Certificate file found: //turn_server_cert.pem
filedrop-coturn-1    | 0: (1): INFO: Private key file found: //turn_server_pkey.pem
filedrop-coturn-1    | 0: (1): WARNING: NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
filedrop-coturn-1    | 0: (1): INFO: ===========Discovering listener addresses: =========
filedrop-coturn-1    | 0: (1): INFO: Listener address to use: 127.0.0.1
filedrop-coturn-1    | 0: (1): INFO: Listener address to use: 10.0.0.212
filedrop-coturn-1    | 0: (1): INFO: =====================================================
filedrop-coturn-1    | 0: (1): INFO: Total: 1 'real' addresses discovered
filedrop-coturn-1    | 0: (1): INFO: =====================================================
filedrop-coturn-1    | 0: (1): WARNING: NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
filedrop-coturn-1    | 0: (1): INFO: ===========Discovering relay addresses: =============
filedrop-coturn-1    | 0: (1): INFO: Relay address to use: 10.0.0.212
filedrop-coturn-1    | 0: (1): INFO: =====================================================
filedrop-coturn-1    | 0: (1): INFO: Total: 1 relay addresses discovered
filedrop-coturn-1    | 0: (1): INFO: =====================================================
filedrop-coturn-1    | 0: (1): WARNING: Cannot create pid file: /var/run/turnserver.pid
filedrop-coturn-1    | 0: (1): INFO: pid file created: /var/tmp/turnserver.pid
filedrop-coturn-1    | 0: (1): INFO: IO method: epoll (with changelist)
filedrop-coturn-1    | 0: (1): INFO: Wait for relay ports initialization...
filedrop-coturn-1    | 0: (1): INFO:   relay 10.0.0.212 initialization...
filedrop-coturn-1    | 0: (1): INFO:   relay 10.0.0.212 initialization done
filedrop-coturn-1    | 0: (1): INFO: Relay ports initialization done
filedrop-coturn-1    | 2: (1): INFO: Total General servers: 4
filedrop-coturn-1    | 2: (18): DEBUG: turn server id=0 created
filedrop-coturn-1    | 2: (20): DEBUG: turn server id=2 created
filedrop-coturn-1    | 2: (21): DEBUG: turn server id=3 created
filedrop-coturn-1    | 2: (19): DEBUG: turn server id=1 created
filedrop-coturn-1    | 2: (1): INFO: Total auth threads: 3
filedrop-coturn-1    | 2: (1): INFO: prometheus collector disabled, not started
filedrop-filedrop-1  | Server running on 10.0.0.212:5000

If you wish to create the same macvlan net as mine it is:

docker network create -d macvlan -o parent=ovs_eth0 --subnet=10.0.0.0/24 --gateway=10.0.0.1 macvlan0

Otherwise I really like this app when using on drop.lol. Excellent and fast.

mat-sz commented 11 months ago

@ibz0q

Could you elaborate on:

When adding the files nothing happens.

ibz0q commented 11 months ago

@ibz0q

Could you elaborate on:

When adding the files nothing happens.

Files appear after adding on the 'sending' client, however on the second receiving client (mobile) nothing shows up in the file list. Both clients are shown with their random names in the client list.

mat-sz commented 11 months ago

@ibz0q Seems like a Web Crypto-related code issue to me. Could you send me a log of all WebSocket messages? You can find that in the developer tools, Network tab.

ibz0q commented 11 months ago

I will try in Chrome, I don't see the WS frames/messages inside on FF for some reason.

I'm assuming something is wrong with my setup as another issue, some files do not show up while others do. I've used side by side as an example however the same is true when using my mobile. The same file does not show up on the receiving end.

Screenshot 2023-12-22 153335 Screenshot 2023-12-22 153404 Screenshot 2023-12-22 153540 Screenshot 2023-12-22 153613

ibz0q commented 11 months ago

Same issue with Brave browser but I'm able to see WS messages, after selecting MQTT exe file:

{
  "type": "transfer",
  "transferId": "7igWRkrvtF8JTrVolVseX",
  "fileName": "MQTT-Explorer-0.4.0-beta1.exe",
  "fileSize": 97496392,
  "fileType": "application/x-msdownload",
  "targetId": "53b1318d0ec7876249e7e4f0717da7f639fa443913910ab27cbbc588475d9d57"
}

After selecting Windows ISO file:

{
  "type": "transfer",
  "transferId": "whgLb8g0zA67dn2t3yhWG",
  "fileName": "en-gb_windows_10_business_editions_version_22h2_x64_dvd_8680b004.iso",
  "fileSize": 5962795008,
  "fileType": "",
  "targetId": "53b1318d0ec7876249e7e4f0717da7f639fa443913910ab27cbbc588475d9d57"
}

ISO file does not show up in messages in clients end. Drop.lol works fine.

mat-sz commented 11 months ago

@ibz0q Thank you, fixed in 2d51081b20dfd512d33e03c50cfd6f275176720e

ibz0q commented 11 months ago

I can confirm this now works. @mat-sz Thanks for quick response/fix.

image