mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
[#2219] Add i2p proxy setting to core
This commit is contained in:
parent
59a29d5288
commit
a5fa5d0451
@ -531,6 +531,13 @@ class Core(component.Component):
|
||||
"""Returns the active listen port"""
|
||||
return self.session.listen_port()
|
||||
|
||||
@export
|
||||
def get_i2p_proxy(self):
|
||||
"""Returns the active listen port"""
|
||||
i2p_settings = self.session.i2p_proxy()
|
||||
i2p_dict = {"hostname": i2p_settings.hostname, "port": i2p_settings.port}
|
||||
return i2p_dict
|
||||
|
||||
@export
|
||||
def get_available_plugins(self):
|
||||
"""Returns a list of plugins available in the core"""
|
||||
|
@ -140,6 +140,10 @@ DEFAULT_PREFS = {
|
||||
},
|
||||
|
||||
},
|
||||
"i2p_proxy": {
|
||||
"hostname": "",
|
||||
"port": 0
|
||||
},
|
||||
"outgoing_ports": [0, 0],
|
||||
"random_outgoing_ports": True,
|
||||
"peer_tos": "0x00",
|
||||
@ -438,6 +442,16 @@ class PreferencesManager(component.Component):
|
||||
log.debug("setting %s proxy settings", k)
|
||||
getattr(self.session, "set_%s_proxy" % k)(proxy_settings)
|
||||
|
||||
def _on_set_i2p_proxy(self, key, value):
|
||||
log.debug("Setting I2P proxy to: %s", value)
|
||||
proxy_settings = lt.proxy_settings()
|
||||
proxy_settings.hostname = value["hostname"]
|
||||
proxy_settings.port = value["port"]
|
||||
try:
|
||||
self.session.set_i2p_proxy(proxy_settings)
|
||||
except RuntimeError as ex:
|
||||
log.error("Unable to set I2P Proxy: %s", ex)
|
||||
|
||||
def _on_set_rate_limit_ip_overhead(self, key, value):
|
||||
log.debug("%s: %s", key, value)
|
||||
self.session_set_setting("rate_limit_ip_overhead", value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user