Auto-update: Tue Jul 30 17:48:00 PDT 2024
This commit is contained in:
parent
07ccb97361
commit
e7fd105d47
1 changed files with 29 additions and 0 deletions
29
vpn
Executable file
29
vpn
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Get the suggested exit node
|
||||||
|
exit_node=$(tailscale exit-node suggest | awk -F': ' '/Suggested exit node/ {print substr($2, 1, length($2)-1)}')
|
||||||
|
|
||||||
|
# Print the exit node
|
||||||
|
echo "Suggested exit node: $exit_node"
|
||||||
|
|
||||||
|
# Set the exit node
|
||||||
|
tailscale set --exit-node=$exit_node
|
||||||
|
|
||||||
|
# Verify the exit node
|
||||||
|
exit_node_info=$(curl -s https://am.i.mullvad.net/json)
|
||||||
|
|
||||||
|
# Parse the JSON response to get the hostname
|
||||||
|
exit_node_hostname=$(echo $exit_node_info | jq -r '.mullvad_exit_ip_hostname')
|
||||||
|
|
||||||
|
echo "Current exit node hostname: $exit_node_hostname"
|
||||||
|
|
||||||
|
# Get the part before the first '.' in the exit_node
|
||||||
|
exit_node_short=$(echo $exit_node | cut -d'.' -f1)
|
||||||
|
|
||||||
|
# Verify that the exit_node_short and exit_node_hostname are equal
|
||||||
|
if [ "$exit_node_short" == "$exit_node_hostname" ]; then
|
||||||
|
echo "Exit node set successfully!"
|
||||||
|
else
|
||||||
|
echo "Failed to set exit node!"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue