feat: 添加 DOH 解析服务器列表至配置文件实现自定义 DOH 服务器
This commit is contained in:
parent
35c7238ede
commit
71fe96d7f9
@ -234,6 +234,8 @@ class Settings(BaseSettings):
|
|||||||
DOH_ENABLE: bool = True
|
DOH_ENABLE: bool = True
|
||||||
# 使用 DOH 解析的域名列表
|
# 使用 DOH 解析的域名列表
|
||||||
DOH_DOMAINS: str = "api.themoviedb.org,api.tmdb.org,webservice.fanart.tv,api.github.com,github.com,raw.githubusercontent.com,api.telegram.org"
|
DOH_DOMAINS: str = "api.themoviedb.org,api.tmdb.org,webservice.fanart.tv,api.github.com,github.com,raw.githubusercontent.com,api.telegram.org"
|
||||||
|
# DOH 解析服务器列表
|
||||||
|
DOH_RESOLVERS: str = "1.0.0.1,1.1.1.1,9.9.9.9,149.112.112.112"
|
||||||
# 搜索多个名称
|
# 搜索多个名称
|
||||||
SEARCH_MULTIPLE_NAME: bool = False
|
SEARCH_MULTIPLE_NAME: bool = False
|
||||||
# 订阅数据共享
|
# 订阅数据共享
|
||||||
|
@ -22,14 +22,6 @@ _executor = concurrent.futures.ThreadPoolExecutor()
|
|||||||
# 定义默认的DoH配置
|
# 定义默认的DoH配置
|
||||||
_doh_timeout = 5
|
_doh_timeout = 5
|
||||||
_doh_cache: Dict[str, str] = {}
|
_doh_cache: Dict[str, str] = {}
|
||||||
_doh_resolvers = [
|
|
||||||
# https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https
|
|
||||||
"1.0.0.1",
|
|
||||||
"1.1.1.1",
|
|
||||||
# https://support.quad9.net/hc/en-us
|
|
||||||
"9.9.9.9",
|
|
||||||
"149.112.112.112"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def _patched_getaddrinfo(host, *args, **kwargs):
|
def _patched_getaddrinfo(host, *args, **kwargs):
|
||||||
@ -47,7 +39,7 @@ def _patched_getaddrinfo(host, *args, **kwargs):
|
|||||||
|
|
||||||
# 使用DoH解析主机
|
# 使用DoH解析主机
|
||||||
futures = []
|
futures = []
|
||||||
for resolver in _doh_resolvers:
|
for resolver in settings.DOH_RESOLVERS.split(","):
|
||||||
futures.append(_executor.submit(_doh_query, resolver, host))
|
futures.append(_executor.submit(_doh_query, resolver, host))
|
||||||
|
|
||||||
for future in concurrent.futures.as_completed(futures):
|
for future in concurrent.futures.as_completed(futures):
|
||||||
|
@ -15,6 +15,8 @@ BIG_MEMORY_MODE=false
|
|||||||
DOH_ENABLE=true
|
DOH_ENABLE=true
|
||||||
# 使用 DOH 解析的域名列表,多个域名使用`,`分隔
|
# 使用 DOH 解析的域名列表,多个域名使用`,`分隔
|
||||||
DOH_DOMAINS=api.themoviedb.org,api.tmdb.org,webservice.fanart.tv,api.github.com,github.com,raw.githubusercontent.com,api.telegram.org
|
DOH_DOMAINS=api.themoviedb.org,api.tmdb.org,webservice.fanart.tv,api.github.com,github.com,raw.githubusercontent.com,api.telegram.org
|
||||||
|
# DOH 解析服务器列表,多个服务器使用`,`分隔
|
||||||
|
DOH_RESOLVERS=1.0.0.1,1.1.1.1,9.9.9.9,149.112.112.112
|
||||||
# 元数据识别缓存过期时间,数字型,单位小时,0为系统默认(大内存模式为7天,滞则为3天),调大该值可减少themoviedb的访问次数
|
# 元数据识别缓存过期时间,数字型,单位小时,0为系统默认(大内存模式为7天,滞则为3天),调大该值可减少themoviedb的访问次数
|
||||||
META_CACHE_EXPIRE=0
|
META_CACHE_EXPIRE=0
|
||||||
# 自动检查和更新站点资源包(索引、认证等)
|
# 自动检查和更新站点资源包(索引、认证等)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user