jeessy2 / ddns-go

Simple and easy to use DDNS. Support Aliyun, Tencent Cloud, Dnspod, Cloudflare, Callback, Huawei Cloud, Baidu Cloud, Porkbun, GoDaddy, Namecheap, NameSilo...
MIT License
12.35k stars 1.41k forks source link

增加 #{ipType} 功能,方便Callback调用URL时选择 #802

Closed o2asdv closed 1 year ago

o2asdv commented 1 year ago

功能描述

增加 #{ipType} 功能,方便Callback调用URL时选择。

如:https://dynv6.com/api/update?hostname=#{domain}&token=XXXXXXX&ipv#{ipType}=#{ip}

ipType的值为:4或6

解决的问题

修改代码:dns/callback.go (108行后,for之前添加) 增加内容 if recordType == "A" { orgPara = strings.ReplaceAll(orgPara, "#{ipType}", "4") } else if recordType == "AAAA" { orgPara = strings.ReplaceAll(orgPara, "#{ipType}", "6") }

附加信息

No response

检查清单

o2asdv commented 1 year ago

我自己改完测试了下,调用dynv6的接口是正常的

jeessy2 commented 1 year ago

不用改代码。使用传递自定义参数 https://github.com/jeessy2/ddns-go/wiki/%E4%BC%A0%E9%80%92%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8F%82%E6%95%B0#callback