优先选择剩余时间最长的ipv6地址

https://github.com/rehiy/dnspod-shell/pull/90/files
This commit is contained in:
rehiy authored and GitHub committed 2021-11-25 13:24:30 +08:00
1 parent 844f841c4b
commit 6c127461b5
1 file changed
+1 -1
+1 -1
View File
@@ -73,7 +73,7 @@ arWanIp6() {
case $(uname) in
'Linux')
hostIp=$(ip -o -6 addr list | grep -Ev '\s(docker|lo)' | awk '{print $4}' | cut -d/ -f1 | grep -Ev "$lanIps" | tail -n 1)
hostIp=$(ip -o -6 addr list | grep -Ev '\s(docker|lo)' |awk '{print $4,substr($NF,0,length($NF)-3)}'|sed 's/fore/2592000/g'|sort -k 2 -n | cut -d/ -f1 | grep -Ev "$lanIps" | tail -n 1)
;;
'Darwin')
hostIp=$(ifconfig | grep "inet6 " | awk '{print $2}' | grep -Ev "$lanIps" | tail -n 1)