Skip to content

Commit 9b588a8

Browse files
authored
Merge pull request #50 from cjfh/master
Fix compatibility with newer Python and OpenVPN versions
2 parents 3a2b067 + 1b31d3a commit 9b588a8

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "duc_tin"
44
__copyright__ = "Copyright 2015+, duc_tin"
55
__license__ = "GPLv2"
6-
__version__ = "1.25"
6+
__version__ = "1.26"
77
__maintainer__ = "duc_tin"
88
__email__ = "[email protected]"
99

@@ -170,7 +170,7 @@ def get_input(s, option):
170170
class Setting:
171171
def __init__(self, path):
172172
self.path = path
173-
self.parser = configparser.SafeConfigParser()
173+
self.parser = configparser.ConfigParser()
174174

175175
self.proxy = OrderedDict([('use_proxy', 'no'), ('address', ''),
176176
('port', ''),

ui_elements.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "duc_tin"
44
__copyright__ = "Copyright 2015+, duc_tin"
55
__license__ = "GPLv2"
6-
__version__ = "1.25"
6+
__version__ = "1.26"
77
__maintainer__ = "duc_tin"
88
__email__ = "[email protected]"
99

@@ -88,7 +88,7 @@ def __init__(self, key=None, value=''):
8888

8989
self.pile = urwid.Pile([ping, speed, uptime, score], focus_item=default[self.chosen])
9090
fill = urwid.LineBox(urwid.Filler(self.pile))
91-
self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
91+
super().__init__(urwid.AttrWrap(fill, 'popbg'))
9292

9393
def item_callback(self, Button, data=None):
9494
self.chosen = self.pile.focus.label
@@ -117,7 +117,7 @@ def __init__(self, key=None, value=''):
117117

118118
self.pile = urwid.Pile([info]+filter_)
119119
fill = urwid.LineBox(urwid.Filler(self.pile))
120-
self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
120+
super().__init__(urwid.AttrWrap(fill, 'popbg'))
121121

122122
self.chosen = value
123123

@@ -199,7 +199,7 @@ def __init__(self, key=None, value=('', '')):
199199

200200
self.pile = urwid.Pile(widgets)
201201
fill = urwid.LineBox(urwid.Filler(self.pile))
202-
self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
202+
super().__init__(urwid.AttrWrap(fill, 'popbg'))
203203

204204
self.chosen = value
205205

@@ -265,7 +265,7 @@ def __init__(self, key=None, value=('', '')):
265265

266266
self.pile = urwid.Pile(widgets)
267267
fill = urwid.LineBox(urwid.Filler(self.pile))
268-
self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
268+
super().__init__(urwid.AttrWrap(fill, 'popbg'))
269269

270270
self.chosen = value
271271

@@ -292,14 +292,14 @@ class AddPopUp(urwid.PopUpLauncher):
292292
signals = ['done']
293293

294294
def __init__(self, target_widget, popup, value, trigger, size):
295-
self.__super.__init__(target_widget)
295+
super().__init__(target_widget)
296296
self.popup = popup(key=trigger, value=value)
297297
self.trigger = trigger
298298
self.size = size
299299
self.result = value
300300

301301
def create_pop_up(self):
302-
# this method must be exist due to its blank content in original class
302+
# this method must exist due to its blank content in original class
303303
urwid.connect_signal(self.popup, 'close', self.close_pop)
304304
return self.popup
305305

vpnproxy_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "duc_tin"
44
__copyright__ = "Copyright 2015+, duc_tin"
55
__license__ = "GPLv2"
6-
__version__ = "1.36"
6+
__version__ = "1.37"
77
__maintainer__ = "duc_tin"
88
__email__ = "[email protected]"
99

@@ -291,7 +291,7 @@ def vpn_manager(ovpn):
291291
"""
292292
global dns, verbose, dropped_time
293293

294-
command = ['openvpn', '--config', ovpn]
294+
command = ['openvpn', '--data-ciphers', 'AES-256-GCM:AES-128-GCM:AES-128-CBC:CHACHA20-POLY1305', '--config', ovpn]
295295
p = Popen(command, stdout=PIPE, stdin=PIPE, universal_newlines=True)
296296
try:
297297
while p.poll() is None:

vpnproxy_tui.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "duc_tin"
44
__copyright__ = "Copyright 2015+, duc_tin"
55
__license__ = "GPLv2"
6-
__version__ = "1.5"
6+
__version__ = "1.6"
77
__maintainer__ = "duc_tin"
88
__email__ = "[email protected]"
99

@@ -56,7 +56,7 @@ def __init__(self, data):
5656
self.logPolicy = data[11]
5757
self.config_data = base64.b64decode(data[-1]).decode()
5858
self.proto = 'tcp' if '\r\nproto tcp\r\n' in self.config_data else 'udp'
59-
port = re.findall('remote .+ \d+', self.config_data)
59+
port = re.findall(r'remote .+ \d+', self.config_data)
6060
if not port:
6161
self.port = '0'
6262
else:
@@ -490,7 +490,7 @@ def vpn_connect(self, chosen):
490490
vpn_file.close()
491491

492492
ovpn = vpn_file.name
493-
command = ['openvpn', '--config', ovpn]
493+
command = ['openvpn', '--data-ciphers', 'AES-256-GCM:AES-128-GCM:AES-128-CBC:CHACHA20-POLY1305', '--config', ovpn]
494494
p = Popen(command, stdout=PIPE, stderr=PIPE, bufsize=1, close_fds=ON_POSIX, universal_newlines=True)
495495
q = Queue()
496496
t = Thread(target=self.vpn_output, args=(p.stdout, q))
@@ -510,7 +510,7 @@ def vpn_cleanup(self, status_code=0):
510510

511511
# make sure openvpn did close its device
512512
tuntap = Popen(['ip', 'tuntap'], stdout=PIPE, universal_newlines=True).communicate()[0]
513-
devices = re.findall('tun\d+', tuntap)
513+
devices = re.findall(r'tun\d+', tuntap)
514514
for dev in devices:
515515
call(('ip link delete ' + dev).split())
516516

0 commit comments

Comments
 (0)