2222)
2323# Constants
2424from .constants import (
25- CONFIG_DIR , TEMPLATE_FILE , OVPN_FILE , PASSFILE , CONFIG_FILE
25+ CACHE_DIR , DATA_DIR , TEMPLATE_FILE , OVPN_FILE , PASSFILE , CONFIG_FILE
2626)
2727
2828
@@ -361,7 +361,7 @@ def status():
361361 if not is_connected ():
362362 logger .debug ("Disconnected" )
363363 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" )):
365365 print ("[!] Kill Switch is currently active." )
366366 logger .debug ("Kill Switch active while VPN disconnected" )
367367 else :
@@ -416,7 +416,7 @@ def status():
416416 last_connection = get_config_value ("metadata" , "connected_time" )
417417 connection_time = time .time () - int (last_connection )
418418
419- if os .path .isfile (os .path .join (CONFIG_DIR , "iptables.backup" )):
419+ if os .path .isfile (os .path .join (DATA_DIR , "iptables.backup" )):
420420 killswitch_on = True
421421 else :
422422 killswitch_on = False
@@ -471,7 +471,7 @@ def openvpn_connect(servername, protocol):
471471
472472 print ("Connecting to {0} via {1}..." .format (servername , protocol .upper ()))
473473
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 :
475475 subprocess .Popen (
476476 [
477477 "openvpn" ,
@@ -484,7 +484,7 @@ def openvpn_connect(servername, protocol):
484484 logger .debug ("OpenVPN process started" )
485485 time_start = time .time ()
486486
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 :
488488 while True :
489489 content = f .read ()
490490 f .seek (0 )
@@ -557,7 +557,7 @@ def manage_dns(mode, dns_server=False):
557557 restore: Revert changes and restore original configuration
558558 """
559559
560- backupfile = os .path .join (CONFIG_DIR , "resolv.conf.backup" )
560+ backupfile = os .path .join (DATA_DIR , "resolv.conf.backup" )
561561 resolvconf_path = os .path .realpath ("/etc/resolv.conf" )
562562
563563 if mode == "leak_protection" :
@@ -642,8 +642,8 @@ def manage_ipv6(mode):
642642 restore: Revert changes and restore original configuration.
643643 """
644644
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" )
647647
648648 if mode == "disable" :
649649
@@ -773,7 +773,7 @@ def manage_killswitch(mode, proto=None, port=None):
773773 reason this will completely block access to the internet.
774774 """
775775
776- backupfile = os .path .join (CONFIG_DIR , "iptables.backup" )
776+ backupfile = os .path .join (DATA_DIR , "iptables.backup" )
777777
778778 if mode == "restore" :
779779 logger .debug ("Restoring iptables" )
@@ -797,7 +797,7 @@ def manage_killswitch(mode, proto=None, port=None):
797797 logger .debug ("Kill Switch backup exists" )
798798 manage_killswitch ("restore" )
799799
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 :
801801 content = f .read ()
802802 device = re .search (r"(TUN\/TAP device) (.+) opened" , content )
803803 if not device :
0 commit comments