Closed pg-adm1n closed 1 year ago
北京电信也遇到了这个问题,很大一部分时间是403,正常请求返回的ip不对
2022-11-25 13:15:00,892 <ip._open> 51@util/ip.py
[DEBUG] open: https://pv.sohu.com/cityjson?ie=utf-8 2022-11-25 13:15:01,093 <ip._open> 58@util/ip.py
[ERROR] HTTP Error 403: Forbidden
2022-11-25 13:15:01,094 <run.update_ip> 100@run.py
[ERROR] Fail to get ipv4 address!
我是北京的,解析的结果是天津
2022-11-25 13:25:01,083 <ip._open> 55@util/ip.py
[DEBUG] response: var returnCitySN = {"cip": "123.151.77.28", "cid": "120000", "cname": "天津市"};
同样出现了这个问题,解析结果一直是上海的。
同样出现这个问题 解析结果是上海的
1)建议 获取ip地址的URL可以从config文件配置(不要hardcode) 我之前用的是旧版,现在最新的版本中,配置文件里的index4 和 index6 就已经支持了
2)建议 可以从多个源获取ip地址,当获取到的相同ip地址多于一半时(或者一定比例),才采用
谢谢 我会去尝试您给出的多个建议 没有问题的话 我希望我可以把您的建议发布到issue里
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年11月26日(星期六) 上午10:07 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [NewFuture/DDNS] [debug] public_v4 方法返回错误的ipv4地址 (Issue #367)
1)建议 获取ip地址的URL可以从config文件配置(不要hardcode) 2)建议 可以从多个源获取ip地址,当获取到的相同ip地址多于一半时(或者一定比例),才采用
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我这边是不停的获取到错误的IPV4地址,原因是https://pv.sohu.com/cityjson?ie=utf-8返回403,建议增加备用获取IP的网址
有这个问题的,可以修改config.json配置文件:
{
...
"index4": "url:https://ddns.oray.com/checkip",
...
}
或者选择其他适合获取ip的URL: https://myip4.ipip.net/, https://ddns.oray.com/checkip, https://ip.3322.net/
我使用的是最新版本
我测试了 搜狐的回调出现了问题 可以尝试更换api
测试了 可以的 通过这个地址信息回调也是可以的 按照现在的情况,预估大多没有更改config.json文件index选项的都会出现问题,大家可以尝试按照这个方法重新调整
https://ip.3322.net/ 那倒不如直接用这个吧
已解决 "index4": "url:https://ip.3322.net",
https://ip.3322.net/ 那倒不如直接用这个吧
显然是选择一个名气大的网站,稳定性会更好。有些小网站,用的人多了,就把接口封了
ERROR:root:<urlopen error [Errno -3] Try again> ERROR:root:Fail to get ipv4 address!
我也遇到了这个问题,该怎么修改获取ip的方式?
老哥们,public的返回403了 目前修改config中 ipv4使用了 url:https://myip4.ipip.net/ ipv6使用了 url:https://myip6.ipip.net/
简易解决办法 源码DDNS/util/ip.py Line 61
def public_v4(url="https://pv.sohu.com/cityjson?ie=utf-8", reg=IPV4_REG): # 公网IPV4地址
将其中url
字段更改为https://ip.3322.net/
有这个问题的,可以修改config.json配置文件:
{ ... "index4": "url:https://ddns.oray.com/checkip", ... }
或者选择其他适合获取ip的URL:https://myip4.ipip.net/,https://ddns.oray.com/checkip,https://ip.3322.net/
我使用的是最新版本
感谢, 已解决
同时向多个地址获取ipv4,判断重复最多的ipv4为真,并返回不对的ipv4
更新了
描述问题 (Describe the bug)
根据源码 https://github.com/NewFuture/DDNS/blob/3680c2088c9d8a6d6bae97540cb5714ae4a2416a/util/ip.py#L61 获取ipv4地址是通过访问 https://pv.sohu.com/cityjson?ie=utf-8, 但是目前这个接口返回了错误的ipv4地址, 一直显示上海, 是因为这个域名被指向了某些LB导致的吗? 我查看过返回的IP, 在IPIP显示是 IDC地址段
版本信息 (version info)
复现步骤 (To Reproduce)
访问 https://pv.sohu.com/cityjson?ie=utf-8
var returnCitySN = {"cip": "61.151.164.141", "cid": "310000", "cname": "上海市"};
配置文件 (config file)
调试输出 (debug output)
补充说明 (Additional context)