Skip to content

Commit

Permalink
Proxy settings fixes (#285)
Browse files Browse the repository at this point in the history
* Proxy settings fixes

- Fixes `Proxy from Elementum settings` setting

Log reported setting applied without really doing anything.

- Adds `Proxy from Elementum (resolve hosts by proxy)` setting option

Option enables default behaviour of `Elementum` in `Burst`. Option is set as new default,
existing users should not be affected by change.

- Adds choice of additional proxy protocols in settings

`SOCKS4a` (`SOCKS4` latest version with hostname resolve by proxy)
`SOCKS5h` (`SOCKS5` latest version with hostname resolve by proxy). Protocol is set as new
default to match default setting in `Elementum`, existing users should not be affected by
change.

- Adds help label for `use_elementum_proxy` setting

* Courtesy of ./scripts/xgettext.sh and ./scripts/xgettext_merge.sh

1. ./scripts/xgettext.sh EXIT CODE 0
2. ./scripts/xgettext_merge.sh EXIT CODE 0
  • Loading branch information
galeksandrp authored May 31, 2021
1 parent d3fc3e1 commit 4bc85e9
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 21 deletions.
19 changes: 18 additions & 1 deletion burst/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
_orig_create_connection = connection.create_connection

# Proxy types
proxy_types = ["socks4", "socks5", "http", "https"]
proxy_types = ["socks4", # socks4 (hostname resolve on client)
"socks5", # socks5 (hostname resolve on client)
"http",
"https",
"socks4a", # socks4 latest version with hostname resolve by proxy
"socks5h"] # socks5 latest version with hostname resolve by proxy
elementum_proxy_types_overrides = {'socks4': 'socks4a',
'socks5': 'socks5h'}

# Disable warning from urllib
urllib3.disable_warnings()
Expand Down Expand Up @@ -182,13 +189,23 @@ def __init__(self, info=None, request_charset='utf-8', response_charset=None, is
elif proxy['enabled']:
if proxy['use_type'] == 0 and info and "proxy_url" in info:
log.debug("Setting proxy from Elementum: %s" % (info["proxy_url"]))

self.proxy_url = info["proxy_url"]
elif proxy['use_type'] == 1:
log.debug("Setting proxy with custom settings: %s" % (repr(proxy)))

if proxy['login'] or proxy['password']:
self.proxy_url = "{0}://{1}:{2}@{3}:{4}".format(proxy['type'], proxy['login'], proxy['password'], proxy['host'], proxy['port'])
else:
self.proxy_url = "{0}://{1}:{2}".format(proxy['type'], proxy['host'], proxy['port'])
if proxy['use_type'] == 2 and info and "proxy_url" in info:
log.debug("Setting proxy with hosts resolve from Elementum: %s" % (info["proxy_url"]))

proxy_url_scheme_separator = '://'
elementum_proxy_url_parts = info["proxy_url"].split(proxy_url_scheme_separator)
elementum_proxy_url_prefix = elementum_proxy_url_parts[0].lower()
if elementum_proxy_url_prefix in elementum_proxy_types_overrides:
self.proxy_url = proxy_url_scheme_separator.join([elementum_proxy_types_overrides[elementum_proxy_url_prefix]] + elementum_proxy_url_parts[1:])

if self.proxy_url:
self.session.proxies = {
Expand Down
18 changes: 17 additions & 1 deletion resources/language/Croatian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr "Koristi proxy postavke"

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr "Proxy iz Elementum postavki"

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr "Video kvaliteta"
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/French/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/German/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Hebrew/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Hungarian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -352,3 +352,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Italian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr "Usa le impostazioni proxy"

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr "Proxy dalle impostazioni Elementum"

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr "Qualità video"
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Lithuania/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Portuguese (Brazil)/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
18 changes: 17 additions & 1 deletion resources/language/Portuguese/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr ""

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr ""

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr ""
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
20 changes: 18 additions & 2 deletions resources/language/Russian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ msgid "Use proxy settings"
msgstr "Вид настроек прокси"

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgstr "Прокси из настроек Elementum"
msgid "From Elementum settings"
msgstr "Из настроек Elementum"

msgctxt "#32108"
msgid "Custom settings"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr "Качество видео"
msgctxt "#32135"
msgid "Belarusian"
msgstr "Белорусский"

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr "Из настроек Elementum (разрешать имена на прокси)"

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr "Сперва включите встроенный HTTP прокси в Elementum"
18 changes: 17 additions & 1 deletion resources/language/Spanish (Argentina)/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ msgid "Use proxy settings"
msgstr "Usar configuración de proxy"

msgctxt "#32107"
msgid "Proxy from Elementum settings"
msgid "From Elementum settings"
msgstr "Usar proxy de ajuste Elementum"

msgctxt "#32108"
Expand Down Expand Up @@ -353,3 +353,19 @@ msgstr "Calidad de video"
msgctxt "#32135"
msgid "Belarusian"
msgstr ""

msgctxt "#32136"
msgid "SOCKS4a"
msgstr ""

msgctxt "#32137"
msgid "SOCKS5h"
msgstr ""

msgctxt "#32138"
msgid "From Elementum settings (resolve hosts by proxy)"
msgstr ""

msgctxt "#32139"
msgid "First enable built-in HTTP proxy in Elementum"
msgstr ""
Loading

0 comments on commit 4bc85e9

Please sign in to comment.