mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
Add block_ip_range() in core and expose it in client.
This commit is contained in:
parent
0940f9072e
commit
c9caab1b4d
2 changed files with 13 additions and 1 deletions
|
@ -187,6 +187,10 @@ class Core(
|
||||||
self.settings = lt.session_settings()
|
self.settings = lt.session_settings()
|
||||||
self.settings.user_agent = "Deluge %s" % deluge.common.get_version()
|
self.settings.user_agent = "Deluge %s" % deluge.common.get_version()
|
||||||
|
|
||||||
|
# Create the IP Filter
|
||||||
|
self.ip_filter = lt.ip_filter()
|
||||||
|
self.session.set_ip_filter(self.ip_filter)
|
||||||
|
|
||||||
# Set lazy bitfield
|
# Set lazy bitfield
|
||||||
self.settings.lazy_bitfields = 1
|
self.settings.lazy_bitfields = 1
|
||||||
self.session.set_settings(self.settings)
|
self.session.set_settings(self.settings)
|
||||||
|
@ -499,6 +503,10 @@ class Core(
|
||||||
"""Sets a torrents file priorities"""
|
"""Sets a torrents file priorities"""
|
||||||
return self.torrents[torrent_id].set_file_priorities(priorities)
|
return self.torrents[torrent_id].set_file_priorities(priorities)
|
||||||
|
|
||||||
|
def export_block_ip_range(self, range):
|
||||||
|
"""Block an ip range"""
|
||||||
|
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||||
|
|
||||||
# Signals
|
# Signals
|
||||||
def torrent_added(self, torrent_id):
|
def torrent_added(self, torrent_id):
|
||||||
"""Emitted when a new torrent is added to the core"""
|
"""Emitted when a new torrent is added to the core"""
|
||||||
|
|
|
@ -367,3 +367,7 @@ def set_torrent_private_flag(torrent_id, value):
|
||||||
def set_torrent_file_priorities(torrent_id, priorities):
|
def set_torrent_file_priorities(torrent_id, priorities):
|
||||||
"""Sets a torrents file priorities"""
|
"""Sets a torrents file priorities"""
|
||||||
get_core().call("set_torrent_file_priorities", None, torrent_id, priorities)
|
get_core().call("set_torrent_file_priorities", None, torrent_id, priorities)
|
||||||
|
|
||||||
|
def block_ip_range(range):
|
||||||
|
"""Blocks a ip range.. (start, end)"""
|
||||||
|
get_core().call("block_ip_range", None, range)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue