fix: 修复代理问题

This commit is contained in:
丹尼尔
2026-03-15 17:16:05 +08:00
parent 8b62c445fc
commit 15c9e1772a
100 changed files with 6157 additions and 69 deletions

View File

@@ -0,0 +1,16 @@
import socket
from .. import _abc as abc
class SyncResolver(abc.SyncResolver):
# noinspection PyMethodMayBeStatic
def resolve(self, host, port=0, family=socket.AF_UNSPEC):
infos = socket.getaddrinfo(host=host, port=port, family=family, type=socket.SOCK_STREAM)
if not infos: # pragma: no cover
raise OSError('Can`t resolve address {}:{} [{}]'.format(host, port, family))
infos = sorted(infos, key=lambda info: info[0])
family, _, _, _, address = infos[0]
return family, address[0]