anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.58k stars 630 forks source link

Unable to use torrent as a command line in Android 4.4 #965

Closed evandrojr closed 1 month ago

evandrojr commented 3 months ago

I am getting this error all the time and nothing downloads

[2024-08-12 22:37:05 +0000 WRN main client github.com/anacrolix/torrent torrent.go:2163]
  error announcing "\"Big Buck Bunny\"" to DHT: getting starting nodes: nothing resolved <*torrent.Client 0x19c0608>
2024/08/12 22:37:05 error running main: context canceled

Command:

1|root@rk3188:/data/data/jackpal.androidterm/app_HOME/bin # ./torrent download "magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c&dn=Big+Buck+Bunny&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fbig-buck-bunny.torrent"

Any clue, please?

It is not working with rain torrent either. I tried to ping to the trackers and the addresses resolved. Thanks!

anacrolix commented 3 months ago

It sounds like Go's DNS resolution isn't working as expected on Android. I think this is specific to Go, there might be an environment flag or something you can pass to tell it what to use as a resolver, in the case of Android it might not be trivial.

anacrolix commented 3 months ago

Running this locally on macOS and it's fine.

sweetbbak commented 2 months ago

you could try and look at what I did https://github.com/sweetbbak/tget (which is just wget for torrents) I just tested it again on my Android Pixel 8 and it worked well. I downloaded and seeded a pretty sizeable torrent.

You may have to disable IPV6 in the client config or maybe consider updating the anacrolix/torrent dependency. It wasn't working for a while on Android but the latest versions seem to work without any extra configuration.

for your specific torrent, I did get some errors though

tget --info -t "magnet:?xt=urn:btih:...2Ftorrents%2Fbig-buck-bunny.torrent"
[2024-09-02 23:42:18 +0000 ERR github.com/anacrolix/upnp upnp.go:89]
  Listing network interfaces: route ip+net: netlinkrib: permission denied

SUCCESS  Got torrent info!                                                                                                                                                  
[263.6MiB] Big Buck Bunny
Files:
000 | Big Buck Bunny.en.srt
001 | Big Buck Bunny.mp4
002 | poster.jpg

[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent torrent.go:1711]
  error in initial announce to "wss://tracker.btorrent.xyz": write AnnounceRequest: *webtorrent.TrackerClient closed
[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent/webtorrent transport.go:73]
  tracker client for "wss://tracker.btorrent.xyz": webrtc PeerConnection state changed to closed
[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent torrent.go:1711]
  error in initial announce to "wss://tracker.fastcast.nz": write AnnounceRequest: *webtorrent.TrackerClient closed
[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent/webtorrent transport.go:73]
  tracker client for "wss://tracker.fastcast.nz": webrtc PeerConnection state changed to closed
[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent torrent.go:1711]
  error in initial announce to "wss://tracker.openwebtorrent.com": write AnnounceRequest: *webtorrent.TrackerClient closed
[2024-09-02 23:42:19 +0000 WRN github.com/anacrolix/torrent/webtorrent transport.go:73]
  tracker client for "wss://tracker.openwebtorrent.com": webrtc PeerConnection state changed to closed

maybe something to do with WebRTC?

anacrolix commented 2 months ago

I would guess it's no problem at all, just unnecessarily noisy logging.

tsynik commented 2 months ago

I have success with linux arm7 binaries on Android 4.4

anacrolix commented 2 months ago

I'm not sure what else I can do here.