libtorrent
libtorrent copied to clipboard
add setting enable_trackers
allow to disable trackers in settings
similar settings
- active_tracker_limit
- enable_dht
- enable_lsd
- enable_upnp
- enable_natpmp
workaround: remove trackers from the torrent file
before passing it to libtorrent.torrent_info
import io
import torf
import libtorrent as lt
settings = lt.default_settings()
# settings['enable_trackers'] = False # TODO implement in libtorrent
settings['active_tracker_limit'] = 0 # disable trackers # FIXME not working
ses = lt.session(settings)
# ti = lt.torrent_info("test.torrent")
# ti.trackers = lambda: [] # not working
# there is ti.add_tracker but no ti.remove_tracker or ti.remove_trackers
# use torf to remove trackers
# NOTE torf does not support v2 torrents
torrent = torf.Torrent.read("test.torrent")
torrent.trackers = [] # remove trackers
buf = io.BytesIO()
torrent.write_stream(buf)
ti = lt.torrent_info(buf.getvalue())
del buf
# ti.trackers = lambda: [] # not working
# there is ti.add_tracker but no ti.remove_tracker or ti.remove_trackers
atp = lt.add_torrent_params()
atp.ti = ti
atp.save_path = "."
atp.trackers = [] # disable trackers # FIXME not working
th = ses.add_torrent(atp)
disabling trackers is possible in anacrolix-torrent
type ClientTrackerConfig struct {
// Don't announce to trackers. This only leaves DHT to discover peers.
DisableTrackers bool `long:"disable-trackers"`