Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

适配380固件 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

对荒野无灯基于[anrip](https://github.com/anrip/ArDNSPod)的脚本添加 ipv6 支持
* 2019.01.21 - 由于梅林获取ipv6有延迟,修改了下脚本,只在ddns ipv4 更新后通知梅林成功,更新ipv6后不会通知。当然实际上已经可用了
* 2020.12.07 - 由于部分固件的wget版本过旧导致无法连接dnspod,故改为curl
* ​ - 获取ipv6的方式从ppp0改为br0,匹配`240x:xxxx:........`

荒野无灯原帖:http://koolshare.cn/thread-37553-1-1.html

Expand Down
36 changes: 19 additions & 17 deletions ddns-start
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
# 时间: 2016-02-24 16:25:00
# Mod: 荒野无灯 http://ihacklog.com 2016-03-16
# ReMod: 寒霜 https://www.frost.net.cn 2018-12-06
# Refine: YMNNs https://github.com/YMNNs 2020-12-7
#################################################

# 注意,请将第29行和第33行末尾的"240"改为公网ipv6的前3-4个字符
# 使用Token认证(推荐) 请去 https://www.dnspod.cn/console/user/security 获取
arToken="23745,b55b4692822de38a8d0955bc66bbfc5a"
arToken="xxx,xxxxxxxxxxxxxxxxxxxxxxxxx"
# 使用邮箱和密码认证
arMail=""
arPass=""
Expand All @@ -24,11 +26,11 @@ arIpAdress() {

# 获得外网ipv6地址
arIpAdress_v6() {
local hostIP_v6=$(ip addr show ppp0 | grep inet6 | sed 's/\/.*//g' | awk '{print $2}' | grep 2408)
local hostIP_v6=$(ip addr show br0 | grep inet6 | sed 's/\/.*//g' | awk '{print $2}' | grep 240)
while [[ -z $hostIP_v6 ]]
do
sleep 60
hostIP_v6=$(ip addr show ppp0 | grep inet6 | sed 's/\/.*//g' | awk '{print $2}' | grep 2408)
hostIP_v6=$(ip addr show br0 | grep inet6 | sed 's/\/.*//g' | awk '{print $2}' | grep 240)
done
echo $hostIP_v6
}
Expand All @@ -43,7 +45,8 @@ arApiPost() {
else
local param="login_token=${arToken}&format=json&${2}"
fi
wget --quiet --no-check-certificate --output-document=- --user-agent=$agent --post-data $param $inter
# wget --no-check-certificate --output-document=- --user-agent=$agent --post-data $param $inter
curl -s --user-agent "$agent" -d $param $inter
}

# 获得ID与初步数据
Expand Down Expand Up @@ -119,17 +122,6 @@ arDdnsCheck() {
lastIP=$(arNslookup)
echo "lastIP: ${lastIP}"

if [ "$lastIP" != "$hostIP" ]; then
arDdnsUpdate
if [ $? -ne 0 ]; then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
else
/sbin/ddns_custom_updated 1
fi

# ipv6
hostIP_v6=$(arIpAdress_v6)
echo "hostIP_v6: ${hostIP_v6}"
Expand All @@ -139,10 +131,20 @@ arDdnsCheck() {
if [ "$lastIP_v6" != "$hostIP_v6" ]; then
arDdnsUpdate_v6 ${hostIP_v6}
fi

if [ "$lastIP_v6" != "$hostIP_v6" ]; then
arDdnsUpdate
if [ $? -ne 0 ]; then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
else
/sbin/ddns_custom_updated 1
fi
}

###################################################
# 检查更新域名
# 指定 domain subdomain
arDdnsCheck "frostfall.cn" ""

arDdnsCheck "xxxxx.xxx" "xxxx"