mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
Add block_ip_range() in core and expose it in client.
This commit is contained in:
parent
0940f9072e
commit
c9caab1b4d
@ -187,6 +187,10 @@ class Core(
|
||||
self.settings = lt.session_settings()
|
||||
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
|
||||
self.settings.lazy_bitfields = 1
|
||||
self.session.set_settings(self.settings)
|
||||
@ -498,7 +502,11 @@ class Core(
|
||||
def export_set_torrent_file_priorities(self, torrent_id, priorities):
|
||||
"""Sets a torrents file 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
|
||||
def torrent_added(self, torrent_id):
|
||||
"""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):
|
||||
"""Sets a torrents file 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…
x
Reference in New Issue
Block a user