Traceback (most recent call last):
File "/usr/local/bin/ddns", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/run.py", line 151, in main
update_ip('6', cache, dns, proxy_list)
File "/usr/local/lib/python3.8/dist-packages/run.py", line 97, in update_ip
address = get_ip(ip_type, index_rule)
File "/usr/local/lib/python3.8/dist-packages/run.py", line 51, in get_ip
value = getattr(ip, "local_v" + ip_type)(index)
File "/usr/local/lib/python3.8/dist-packages/util/ip.py", line 38, in local_v6
info = getaddrinfo(gethostname(), 0, AF_INET6)
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
描述问题 (Describe the bug)
取本地ipv6地址时出错,想要直接取本地网卡(ens33)的ipv6地址(光猫直接分配的),在getaddrinfo时出错。
版本信息 (version info)
复现步骤 (To Reproduce)
配置config.json,执行ddns -c config.json ip addr 执行显示ens33是第二个网卡
配置文件 (config file)
config.json { "token": "xxxxxxxxxxxxxx", "dns": "cloudflare", "ipv4": [], "ipv6": ["xxx.yyyyy.com"], "index6": 1, "debug": true }
调试输出 (debug output)
Traceback (most recent call last): File "/usr/local/bin/ddns", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/run.py", line 151, in main
update_ip('6', cache, dns, proxy_list)
File "/usr/local/lib/python3.8/dist-packages/run.py", line 97, in update_ip
address = get_ip(ip_type, index_rule)
File "/usr/local/lib/python3.8/dist-packages/run.py", line 51, in get_ip
value = getattr(ip, "local_v" + ip_type)(index)
File "/usr/local/lib/python3.8/dist-packages/util/ip.py", line 38, in local_v6
info = getaddrinfo(gethostname(), 0, AF_INET6)
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
补充说明 (Additional context)
/etc/hosts中配置为127.0.1.1 ubuntu 手动执行getaddrinfo(gethostname(), 0, AF_INET)时返回的是127.0.0.1,好像ipv4也没有达到获取某网卡地址的功能,这个功能原想法应该不是想要获取lo回环地址吧?
现在暂时用default方式实现的。