-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wireguard support to vpn block #1981
base: master
Are you sure you want to change the base?
Conversation
I would prefer to make them optional, and on include them at all when using this driver. |
Alright, I've implemented a separate 'ConnectedToCountry' state that includes the country and flag. It felt a little cleaner than still having them as Optional in drivers that don't care. Then again, there are now two separate states that both represent connected, not sure what the best approach would be? Happy to switch to a single connected state with optional attributes as well. |
I think having optional fields is slightly better. First of all, maybe in the future we will add more fields and having one "connected" state will make things easier. Next, it would eliminate duplicated map! {
"icon" => Value::icon(status.icon()),
[if let Some(c) = country] "country" => Value::text(c.into()),
[if let Some(f) = country_flag] "flag" => Value::text(f.into()),
} |
Fair points, and neat trick with map! The PR is updated. 👍 |
To clarify, you're invoking the If I remember correctly, |
Hmm, I don't really see a proper way to do this, even if there is a route through NetworkManager, then that is probably still not how most people have configured their current Wireguard connections, as it doesn't seem to support the default /etc/wireguard/wg0.conf settings. Looking at the source of |
In my opinion, accomplishing this feature set would be relatively straightforward through Besides |
Just chiming in to voice the interest from a simple user's perspective for a Wireguard driver for the VPN block, although I have no solution to the issues raised above. |
In the mean time, for those who would be interested in at least showing the VPN status in [[block]]
block = "custom"
interval = 5 # Check every 5 seconds
cycle = ["curl -s https://ipinfo.io | jq -r '.country'", "curl -s https://ipinfo.io | jq -r '.city + \" (\" + .country +\")\"'"]
[[block.click]]
button = "right"
cmd = "footclient -H -o 'font=Iosevka Medium Extended:size=8' -a floating -W 65x30 curl -s https://ipinfo.io | jq '.'" |
Adds a new driver for the VPN block to support Wireguard connections.
I couldn't find any way to control Wireguard without using root permissions, so I hope this route with sudo is OK. The docs include a sudoers configuration that should be safe if your Wireguard configuration files are locked down properly, but please correct me if I'm mistaken here.
The driver supports the same toggle action on click as the other drivers, but I've reduced the country code and flag to empty strings, as they don't make a lot of sense in this context.
We can update the Connected enum to support a state without country information included, but I tried to change as few things as possible on the existing drivers.