22
22
)
23
23
# Constants
24
24
from .constants import (
25
- CONFIG_DIR , TEMPLATE_FILE , OVPN_FILE , PASSFILE , CONFIG_FILE
25
+ CACHE_DIR , DATA_DIR , TEMPLATE_FILE , OVPN_FILE , PASSFILE , CONFIG_FILE
26
26
)
27
27
28
28
@@ -361,7 +361,7 @@ def status():
361
361
if not is_connected ():
362
362
logger .debug ("Disconnected" )
363
363
print ("Status: Disconnected" )
364
- if os .path .isfile (os .path .join (CONFIG_DIR , "iptables.backup" )):
364
+ if os .path .isfile (os .path .join (DATA_DIR , "iptables.backup" )):
365
365
print ("[!] Kill Switch is currently active." )
366
366
logger .debug ("Kill Switch active while VPN disconnected" )
367
367
else :
@@ -416,7 +416,7 @@ def status():
416
416
last_connection = get_config_value ("metadata" , "connected_time" )
417
417
connection_time = time .time () - int (last_connection )
418
418
419
- if os .path .isfile (os .path .join (CONFIG_DIR , "iptables.backup" )):
419
+ if os .path .isfile (os .path .join (DATA_DIR , "iptables.backup" )):
420
420
killswitch_on = True
421
421
else :
422
422
killswitch_on = False
@@ -471,7 +471,7 @@ def openvpn_connect(servername, protocol):
471
471
472
472
print ("Connecting to {0} via {1}..." .format (servername , protocol .upper ()))
473
473
474
- with open (os .path .join (CONFIG_DIR , "ovpn.log" ), "w+" ) as f :
474
+ with open (os .path .join (CACHE_DIR , "ovpn.log" ), "w+" ) as f :
475
475
subprocess .Popen (
476
476
[
477
477
"openvpn" ,
@@ -484,7 +484,7 @@ def openvpn_connect(servername, protocol):
484
484
logger .debug ("OpenVPN process started" )
485
485
time_start = time .time ()
486
486
487
- with open (os .path .join (CONFIG_DIR , "ovpn.log" ), "r" ) as f :
487
+ with open (os .path .join (CACHE_DIR , "ovpn.log" ), "r" ) as f :
488
488
while True :
489
489
content = f .read ()
490
490
f .seek (0 )
@@ -557,7 +557,7 @@ def manage_dns(mode, dns_server=False):
557
557
restore: Revert changes and restore original configuration
558
558
"""
559
559
560
- backupfile = os .path .join (CONFIG_DIR , "resolv.conf.backup" )
560
+ backupfile = os .path .join (DATA_DIR , "resolv.conf.backup" )
561
561
resolvconf_path = os .path .realpath ("/etc/resolv.conf" )
562
562
563
563
if mode == "leak_protection" :
@@ -642,8 +642,8 @@ def manage_ipv6(mode):
642
642
restore: Revert changes and restore original configuration.
643
643
"""
644
644
645
- ipv6_backupfile = os .path .join (CONFIG_DIR , "ipv6.backup" )
646
- ip6tables_backupfile = os .path .join (CONFIG_DIR , "ip6tables.backup" )
645
+ ipv6_backupfile = os .path .join (DATA_DIR , "ipv6.backup" )
646
+ ip6tables_backupfile = os .path .join (DATA_DIR , "ip6tables.backup" )
647
647
648
648
if mode == "disable" :
649
649
@@ -773,7 +773,7 @@ def manage_killswitch(mode, proto=None, port=None):
773
773
reason this will completely block access to the internet.
774
774
"""
775
775
776
- backupfile = os .path .join (CONFIG_DIR , "iptables.backup" )
776
+ backupfile = os .path .join (DATA_DIR , "iptables.backup" )
777
777
778
778
if mode == "restore" :
779
779
logger .debug ("Restoring iptables" )
@@ -797,7 +797,7 @@ def manage_killswitch(mode, proto=None, port=None):
797
797
logger .debug ("Kill Switch backup exists" )
798
798
manage_killswitch ("restore" )
799
799
800
- with open (os .path .join (CONFIG_DIR , "ovpn.log" ), "r" ) as f :
800
+ with open (os .path .join (CACHE_DIR , "ovpn.log" ), "r" ) as f :
801
801
content = f .read ()
802
802
device = re .search (r"(TUN\/TAP device) (.+) opened" , content )
803
803
if not device :
0 commit comments