-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarp.sh
More file actions
29 lines (29 loc) 路 1.18 KB
/
Copy pathwarp.sh
File metadata and controls
29 lines (29 loc) 路 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
choice=$(echo -e "status\nconnect\ndisconnect\ninfo" | dmenu -i -c -p "WARP" -l 4)
case "$choice" in
"status")
notify-send "warp status" "$(warp-cli status)"
;;
"connect")
warp-cli connect
notify-send "warp" "connected to cloudflare warp"
;;
"disconnect")
warp-cli disconnect
notify-send "warp" "disconnected from cloudflare warp"
;;
"info")
response=$(curl -s https://www.cloudflare.com/cdn-cgi/trace)
ip=$(echo "$response" | grep "^ip=" | cut -d= -f2)
location=$(echo "$response" | grep "^loc=" | cut -d= -f2)
data_center=$(echo "$response" | grep "^colo=" | cut -d= -f2)
warp_status=$(echo "$response" | grep "^warp=" | cut -d= -f2)
tls_version=$(echo "$response" | grep "^tls=" | cut -d= -f2)
http_version=$(echo "$response" | grep "^http=" | cut -d= -f2)
message="馃實 ip: $ip\n馃搷 location: $location\n馃彚 data center: $data_center\n馃敆 warp: $warp_status\n馃敀 tls: $tls_version\n馃寪 http: $http_version"
notify-send "warp connection info" "$message"
;;
*)
notify-send "warp" "no valid option selected."
;;
esac