The programm is constantly pinging the vpn-gateway.
If the ping is a successful the programm goes to sleep for a 30 seconds and than pings again.
If the ping fails the programm restarts the wireguard connection and than pings again. After 50 failed tries the programm is timeouted for 30 minutes.
The project itself is complete and ready for use. I am open for improvments. Requirements for running the webui are: - python (3.x.x)
- pip (v3) or any other packetmanager
- pythonping 1. Download and Install Python.
For windows go to (https://www.python.org/downloads/)
For linux use
sudo apt-get install python3.x
2. Download and install pip-packetmanager
3. Install pythonping
For Windows
py -3 -m pip install pythonping
For Linux
pip3 install pythonping
4. Now run the Wireguard_Reconnect.py - File For Windows
py -3 Wireguard_Reconnect.py
For Linux
python3 Wireguard_Reconnect.py
- If you want to use it on another operating system you only have to change the line "os.system('sudo wg-quick down wg0')" and "os.system('sudo wg-quick up wg0').
- Other values like the timeouts can be adjusted as well.
- The program must always be run with elevated privileges because of the package pythonping.