File tree Expand file tree Collapse file tree 1 file changed +37
-4
lines changed Expand file tree Collapse file tree 1 file changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,47 @@ vpn_function() {
1717      echo  " NO VPN" 
1818    fi 
1919  ;;
20-    
20+ 
2121  Darwin)
22-     vpn=$( scutil --nc list |  grep Connected) 
2322
24-     if  [ -z  $vpn  ];  then 
23+     verbose=$( get_tmux_option " @dracula-network-vpn-verbose" ) 
24+ 
25+     vpn=" $( scutil --nc list |  sed " s/\*//g" |  grep Connected) " 
26+ 
27+     is_not_tailscale=$( echo " $vpn " |  grep -v Tailscale) 
28+ 
29+     which -s tailscale >  /dev/null
30+     tailscale_installed=$? 
31+ 
32+     if  [ -z  " $vpn " ;  then 
2533      echo  " " 
34+ 
35+     elif  [ $tailscale_installed  ] &&  [ -z  " $is_not_tailscale " ;  then 
36+       #  if tailscale is installed and no other vpn is connected. this is because tailscale will
37+       #  always show as connected for some reason.
38+       # 
39+       #  https://www.reddit.com/r/Tailscale/comments/18dirro/is_there_a_way_i_can_tell_which_exit_node_i_am/
40+       node=$( tailscale status --peers --json |  jq ' .ExitNodeStatus' ) 
41+       if  [[ -z  $node  ]] ||  [[ " $node " ==  ' null' ;  then 
42+         #  no tailscale exit node, no output, since trafic isnt actually rerouted
43+         echo  " " 
44+       else 
45+         exitnode=$( tailscale status |  grep " ; exit node" |  cut -w -f 2) 
46+ 
47+         if  $verbose ;  then 
48+           echo  "  $exitnode " 
49+         else 
50+           echo  " Tailscale" 
51+         fi 
52+       fi 
53+ 
2654    else 
27-       echo  " VPN" 
55+       if  $verbose ;  then 
56+         vpn_name=$( echo $is_not_tailscale  |  sed " s/.*\" \(.*\)\" .*/\1/g" ) 
57+         echo  "  $vpn_name " 
58+       else 
59+         echo  " VPN" 
60+       fi 
2861    fi 
2962    ;;
3063
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments