NewFuture / DDNS

:triangular_flag_on_post: 自动更新域名解析到本机IP(支持dnspod,阿里DNS,CloudFlare,华为云,DNSCOM...)
https://ddns.newfuture.cc/
MIT License
4.23k stars 651 forks source link

[debug]二进制包运行报错&获取到的总是内网IP #366

Open ericzhang-debug opened 1 year ago

ericzhang-debug commented 1 year ago

描述问题 (Describe the bug)

版本信息 (version info)

复现步骤 (To Reproduce)

完全按照官方的方法使用

配置文件 (config file)

{
{
  "$schema": "https://ddns.newfuture.cc/schema/v2.8.json",
  "debug": true,
  "dns": "alidns",
  "id": "LTAI5tKjSh3kFuqm@@@@@@@@",
  "index4": "default",
  "index6": "default",
  "ipv4": [
    "ipv4.ddns.**ver.cn"
  ],
  "ipv6": [
    "ipv6.ddns.**ver.cn"
  ],
  "proxy": null,
  "token": "Y@@@@@@@@Ymf27XogEGhzHUGkTKwjH",
  "ttl": null
}
}

调试输出 (debug output)

!!!这是用的二进制打包的文件直接运行!!!
PS C:\Users\Eric\Desktop\DDNS> .\ddns.exe
2022-11-22 22:58:58,348 <cache.load> 48@util\cache.py
[DEBUG] load cache data from C:\Users\Eric\AppData\Local\Temp\ddns.cache
Traceback (most recent call last):
  File "run.py", line 159, in <module>
  File "run.py", line 151, in main
  File "run.py", line 99, in update_ip
  File "run.py", line 66, in get_ip
  File "util\ip.py", line 31, in default_v6
OSError: [WinError 10051] 向一个无法连接的网络尝试了一个套接字操作。
[3792] Failed to execute script 'run' due to unhandled exception!
DDNS[ v2.11.5@2022-07-28T14:50:06+00:00 ] run: nt win32
Configuration was loaded from <== C:\Users\Eric\Desktop\DDNS\config.json
========================= Tue Nov 22 22:58:58 2022 =========================
. Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: underlying buffer has been detached
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: underlying buffer has been detached

补充说明 (Additional context)

源码运行正常,但是必须要管理员身份 获取到的总是内网IP 10.X.X.X

Configuration was loaded from <== C:\Users\Eric\Desktop\DDNS\DDNS-master\config.json
========================= Tue Nov 22 23:12:55 2022 =========================
. .
PS C:\Users\Eric\Desktop\DDNS\DDNS-master>
laozhoubuluo commented 1 year ago

请按照以下代码修改 config.json 配置文件即可解决:

{
...
  "index4": "url:https://myip4.ipip.net/",
  "index6": "url:https://myip6.ipip.net/",
...
}
izwb003 commented 1 year ago

请按照以下代码修改 config.json 配置文件即可解决:

{
...
  "index4": "url:https://myip4.ipip.net/",
  "index6": "url:https://myip6.ipip.net/",
...
}

该方法不是使用外部公网地址API得到的IP吗? 若不希望访问外部API,而使用网卡IP(即“default”),如何解决该错误?

laozhoubuluo commented 1 year ago

请按照以下代码修改 config.json 配置文件即可解决:

{
...
  "index4": "url:https://myip4.ipip.net/",
  "index6": "url:https://myip6.ipip.net/",
...
}

该方法不是使用外部公网地址API得到的IP吗? 若不希望访问外部API,而使用网卡IP(即“default”),如何解决该错误?

如果机器所在的网络不支持 IPv6 (机器的 IPv6 没有默认网关),那 index6 应该配置为 false 。

{
...
  "index4": "default",
  "index6": false,
...
}
izwb003 commented 1 year ago

请按照以下代码修改 config.json 配置文件即可解决:

{
...
  "index4": "url:https://myip4.ipip.net/",
  "index6": "url:https://myip6.ipip.net/",
...
}

该方法不是使用外部公网地址API得到的IP吗? 若不希望访问外部API,而使用网卡IP(即“default”),如何解决该错误?

如果机器所在的网络不支持 IPv6 (机器的 IPv6 没有默认网关),那 index6 应该配置为 false 。

{
...
  "index4": "default",
  "index6": false,
...
}

不是,目前情况是这样: 设备支持IPv6,个人理解index6配置为"default",程序会获取网卡的IP来更新。 而目前的情况是,index6配置为"default",运行程序便会卡出该issue所述的错误输出。 设备的IPv6配置应当没有问题,可以正常获取IPv6地址并访问IPv6网络。

laozhoubuluo commented 1 year ago

请按照以下代码修改 config.json 配置文件即可解决:

{
...
  "index4": "url:https://myip4.ipip.net/",
  "index6": "url:https://myip6.ipip.net/",
...
}

该方法不是使用外部公网地址API得到的IP吗? 若不希望访问外部API,而使用网卡IP(即“default”),如何解决该错误?

如果机器所在的网络不支持 IPv6 (机器的 IPv6 没有默认网关),那 index6 应该配置为 false 。

{
...
  "index4": "default",
  "index6": false,
...
}

不是,目前情况是这样: 设备支持IPv6,个人理解index6配置为"default",程序会获取网卡的IP来更新。 而目前的情况是,index6配置为"default",运行程序便会卡出该issue所述的错误输出。 设备的IPv6配置应当没有问题,可以正常获取IPv6地址并访问IPv6网络。

可以试试按照 https://github.com/NewFuture/DDNS/pull/373 改下文件,完了本地拉个 Python 环境跑一下试试。