vpn_status: Add formatters for displaying IP addresses of VPNs #2227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the option to display IPv4 and IPv6 addresses of the VPNs in use (if using NetworkManager). I also added support for detecting OpenVPN VPNs because the connection type is
tun
(NetworkManager does not set the Vpn property to true for OpenVPN connections). I have found this change helpful to easily get my VPN IP when pen-testing.There could be potential KeyError issues when attempting to retrieve the IP addresses, but I have not run into any problems with this.
In this change, I decided not to filter out when placeholders are None (likely for IPv6) and instead let the user decide to exclude them in the config (e.g.
format = "{name} [\?if=ipv6 {ipv6}]"
).