Home › Forums › Discussions › Support › Exit on bad config flag
Tagged: exit, exit flag, flag, kill, kill switch, killswitch, switch
- This topic has 9 replies, 2 voices, and was last updated 2 years, 2 months ago by Vadim Smirnov.
-
AuthorPosts
-
October 15, 2022 at 3:09 pm #12695
Vadim, Privet!
Current behaviour: if your configuration file is corrupt or does not exist wiresock will continue running while trying to connect for infinite duration (see pic)
Right now I am controlling wiresock using a separate c# watchdog process (it also watches over several other processes but that doesnt matter).
Thing is: I assume that if wireguard is running, it is connected (as it’s not really possible to query the actual connection state to my knowledge).
Desired behaviour: wiresock process exits if config file is bad/does not exist.
So maybe its worth adding a flag to exit on bad config text/non-existing config so process wouldn’t be running.
(Command line used: wiresock-client.exe run -config c:\vpn.conf -log-level debug)
October 16, 2022 at 12:15 pm #12696Thing is: I assume that if wireguard is running, it is connected (as it’s not really possible to query the actual connection state to my knowledge).
Desired behaviour: wiresock process exits if config file is bad/does not exist.
Even so,
running service != active tunnel
. For example, the configuration file may be present and correct, but Wireguard server may be down or unreachable.I already have several requests to add a simple application with a tray icon to indicate the status of a WireSock tunnel. So, I need to add some IPC for communication between service and tray app. Probably the simplest would be to create a shared memory section to represent the current state of the service/tunnel, or a simple named pipe request-response mechanism.
More complex, but at the same time more modern and flexible, would be to add a simple web socket server using a third-party library such as websocketpp.
I will give it a think until the next weekend. Any suggestions are appreciated.
October 16, 2022 at 3:21 pm #12699Hey Vadim!
I do not use the service as you can see from my command line (I assume running wiresock-client does not interact with services by any means).But in my opinion the situation when config is ok and Wireguard server is unreachable VS config is bad/missing are two completely different situations, and I would expect wiresock exiting on trying to import a bad config.
May sound not intuitive but with a flag it sounds like a good idea in my head.
So something like wiresock-client.exe run -config vpn.conf -exitonbadconfig would just close the process after failing to import/validate the vpn.conf fileOctober 16, 2022 at 5:54 pm #12700You may be right, at least for the case where wiresock-client is running as an application and neither the primary nor secondary configurations are good/available, it makes sense to exit. As for the service, it may constantly try to restart.
October 16, 2022 at 6:49 pm #12701wiresock-client is running as an application
Exactly, you got my idea 🙂
October 22, 2022 at 11:29 am #12719The proposed changes were implemented in v1.2.13. Please give it a try.
October 22, 2022 at 9:07 pm #12724Vadim, privet!
It works if log level is debug/all, does not work in none log level mode it seems
October 23, 2022 at 12:22 am #12725Yes, sorry, my fault. Fixed in v1.2.14. Please try.
October 23, 2022 at 12:49 am #12726Works perfectly!
Unrelated suggestion: display version info in the initial notice message i.e.Wiresock WireGuard Vpn Client v1.2.14 running as..
October 23, 2022 at 10:18 am #12727Works perfectly!
Thanks for checking!
Unrelated suggestion: display version info in the initial notice message
As you wish, v1.2.15!
-
AuthorPosts
- You must be logged in to reply to this topic.