mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
[#2219] Add i2p proxy setting to core
This commit is contained in:
parent
59a29d5288
commit
a5fa5d0451
2 changed files with 21 additions and 0 deletions
|
@ -531,6 +531,13 @@ class Core(component.Component):
|
||||||
"""Returns the active listen port"""
|
"""Returns the active listen port"""
|
||||||
return self.session.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
|
@export
|
||||||
def get_available_plugins(self):
|
def get_available_plugins(self):
|
||||||
"""Returns a list of plugins available in the core"""
|
"""Returns a list of plugins available in the core"""
|
||||||
|
|
|
@ -140,6 +140,10 @@ DEFAULT_PREFS = {
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"i2p_proxy": {
|
||||||
|
"hostname": "",
|
||||||
|
"port": 0
|
||||||
|
},
|
||||||
"outgoing_ports": [0, 0],
|
"outgoing_ports": [0, 0],
|
||||||
"random_outgoing_ports": True,
|
"random_outgoing_ports": True,
|
||||||
"peer_tos": "0x00",
|
"peer_tos": "0x00",
|
||||||
|
@ -438,6 +442,16 @@ class PreferencesManager(component.Component):
|
||||||
log.debug("setting %s proxy settings", k)
|
log.debug("setting %s proxy settings", k)
|
||||||
getattr(self.session, "set_%s_proxy" % k)(proxy_settings)
|
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):
|
def _on_set_rate_limit_ip_overhead(self, key, value):
|
||||||
log.debug("%s: %s", key, value)
|
log.debug("%s: %s", key, value)
|
||||||
self.session_set_setting("rate_limit_ip_overhead", value)
|
self.session_set_setting("rate_limit_ip_overhead", value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue