diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7bb3b3b..ec098dc 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,9 @@
-
+
-
@@ -494,7 +493,15 @@
1726959423800
-
+
+
+ 1727015078922
+
+
+
+ 1727015078922
+
+
@@ -535,7 +542,6 @@
-
@@ -560,6 +566,33 @@
-
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/wg_func.py
+ 135
+
+
+
+ file://$PROJECT_DIR$/wg_func.py
+ 194
+
+
+
+ file://$PROJECT_DIR$/wg_func.py
+ 72
+
+
+
+ file://$PROJECT_DIR$/wg_func.py
+ 343
+
+
+
+
\ No newline at end of file
diff --git a/wg_func.py b/wg_func.py
index aca793e..2215267 100755
--- a/wg_func.py
+++ b/wg_func.py
@@ -16,6 +16,9 @@ _u = Path.read_text(Path('/tmp/_u'))
def msg_window(img_w, img_i, w_title, w_txt):
"""
+ Function for different message windows for the user. with 4 arguments to be passed.
+ To create messages with your own images, icons, and titles. As an alternative to Python Messagebox.
+ Paths to images must be specified: r'/usr/share/icons/wp-icons/64/info.png'
img_w = Image for Tk Window
img_i = Image for Icon
w_title = Windows Title
@@ -46,6 +49,9 @@ def msg_window(img_w, img_i, w_title, w_txt):
class GreenLabel:
+ """
+ Show the active tunnel in green in the label
+ """
def __init__(self):
self.StrVar = None
self.lb_tunnel = None
@@ -65,6 +71,9 @@ class GreenLabel:
class StartStopBTN:
+ """
+ Show Start and Stop Button in Label
+ """
def __init__(self):
self.lb_frame_btn_lbox = None
self.wg_switch = None
@@ -82,6 +91,10 @@ class StartStopBTN:
class ConToDict:
+ """
+ The config file is packed into a dictionary,
+ to display the values Address , DNS and Peer in the labels
+ """
@classmethod
def covert_to_dict(cls, file):
dictlist = []
@@ -121,6 +134,9 @@ class ConToDict:
class TunnelActiv:
+ """
+ Shows the Active Tunnel
+ """
@staticmethod
def active(): # Shows the active tunnel
active = os.popen('nmcli con show --active | grep -iPo "(.*)(wireguard)"').read().split()
@@ -133,6 +149,10 @@ class TunnelActiv:
class ShowAddress:
+ """
+ Displays the value address, DNS and peer in the labels
+ or empty it again
+ """
def __init__(self):
self.lb_frame2 = None
self.lb_frame = None
@@ -173,14 +193,27 @@ class ShowAddress:
class ListTunnels:
+ """
+ Shows all existing Wireguard tunnels
+ """
@staticmethod
def tl_list():
wg_s = os.popen('nmcli con show | grep -iPo "(.*)(wireguard)"').read().split()
- tl = wg_s[::3] # tl = Tunnel list # Show of 4.Element in list
+ tl = wg_s[::3] # tl = Tunnel list # Show of 4.Element in list
return tl
class ImportTunnel:
+ """
+ Import Class for Wireguard config Files.
+ Before importing, it is checked whether PrivateKey and PublicKey are in the file.
+ If True then it is checked whether the PreSharedKey is already in the key file
+ to avoid an import error so that no double wgconf are imported.
+ Thus, tunnels can be renamed without the problems arise. If False then the key is written into the file.
+ Furthermore, it is checked whether the name is longer than 12 characters.
+ If True then the name is automatically shortened to 12 characters and then imported.
+ If in each case false comes out, a corresponding window comes to inform the user that something is wrong.
+ """
def __init__(self):
@@ -276,7 +309,11 @@ class ImportTunnel:
class FileHandle:
-
+ """
+ This class will display the autostart label which
+ Tunnel is automatically started regardless of the active tunnel.
+ The selected tunnel is written into a file to read it after the start of the system.
+ """
def __init__(self):
self.wg_autostart = None
@@ -305,6 +342,11 @@ class FileHandle:
class OnOff:
+ """
+ Here it is checked whether the path to the file is there if not it is created.
+ Set (on), the selected tunnel is displayed in the label.
+ At (off) the label is first emptied then filled with No Autoconnect
+ """
def __init__(self):
self.wg_autostart = None
self.selected_option = None
@@ -332,6 +374,11 @@ class OnOff:
class ExportTunnels:
+ """
+ This will export the tunnels.
+ A zipfile with current date and time is created
+ in the user's home directory with correct right
+ """
@staticmethod
def wg_export():
_u1 = str(_u[6:])