From 0f8ae17a5f5aaf839fd26c1bbfe4acc2d413da23 Mon Sep 17 00:00:00 2001 From: "dinghao.li" <34467508+kaedeair@users.noreply.github.com> Date: Tue, 23 Nov 2021 22:43:19 +0800 Subject: [PATCH] select the newest ipv6 address --- ardnspod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ardnspod b/ardnspod index 2ae1ca8..4269464 100644 --- a/ardnspod +++ b/ardnspod @@ -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)