Skip to content
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

feature/ MacOS show vpn name and tailscale exit node if active #279

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Theoreticallyhugo
Copy link
Collaborator

@Theoreticallyhugo Theoreticallyhugo commented Aug 19, 2024

on macos and linux the vpn option now is able to show the name of the vpn if in verbose mode or VPN if verbose is off.
if a tailscale exit-node is used, it shows its name in verbose, or Tailscale if verbose is off.

scutil did some funky stuff for me, so i had to filter out the asterisks 😅

new options for the network-vpn plugin
@dracula-network-vpn-label
this option is what is displayed when verbose is false.
if verbose is true, this label is the prefix to the name of the vpn/ exitnode.
@dracula-network-vpn-verbose
whether to display the vpn/ exitnode name

@Theoreticallyhugo Theoreticallyhugo marked this pull request as ready for review October 24, 2024 16:39
# if tailscale is installed
#
# https://www.reddit.com/r/Tailscale/comments/18dirro/is_there_a_way_i_can_tell_which_exit_node_i_am/
node=$(tailscale status --peers --json | jq '.ExitNodeStatus')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant to rely on jq as a dependency.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understandable. im planning to rework this entirely if i end up making it "production ready" and i will keep that in mind then 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was poking around with this and I think you could just replace this with grep since you're not actually interpreting the json and just checking if it exists. I tested it with tailscale (I am now using it) and doesn't even report ExitNodeStatus unless you are connected to an exit node @Theoreticallyhugo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks!

i'm currently in my exam period, but im planning on revisiting this soon after :D

@Theoreticallyhugo
Copy link
Collaborator Author

Theoreticallyhugo commented Feb 24, 2025

so far this is tested on macos only, and i'll need to look into vpns some more before this is ready to merge

also some vpns wont be detected by our scripts because they were not configured in the macs network settings. private internet access(pia) seems to be one of those candidates. maybe ill find some kind of workaround...

scutil --nwi should give us a different network device when a vpn is running, except that still doesnt apply to pia at least.
this does however work for openconnect, so we might wanna look into this.

@ethancedwards8
Copy link
Member

I'll test on Linux tonight. I'll also test on MacOS. For now, tailscale support is fine. We can support others as they come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants