mirror of
https://github.com/honmashironeko/ProxyCat.git
synced 2025-06-21 02:11:11 +00:00
Update
This commit is contained in:
parent
aaddbbe723
commit
1c74d622ce
@ -1,3 +1,9 @@
|
|||||||
|
### 2025/03/14
|
||||||
|
|
||||||
|
- 修复'_last_used'报错问题,连接关闭方式修正
|
||||||
|
- 修复本地代理读取时切换逻辑失效问题
|
||||||
|
- 增加切换时间间隔设置为0时进入每次请求都更换IP
|
||||||
|
|
||||||
### 2025/03/03
|
### 2025/03/03
|
||||||
|
|
||||||
- 美化 Web管理界面
|
- 美化 Web管理界面
|
||||||
|
2
app.py
2
app.py
@ -523,7 +523,7 @@ def check_version():
|
|||||||
original_level = httpx_logger.level
|
original_level = httpx_logger.level
|
||||||
httpx_logger.setLevel(logging.WARNING)
|
httpx_logger.setLevel(logging.WARNING)
|
||||||
|
|
||||||
CURRENT_VERSION = "ProxyCat-V2.0.1"
|
CURRENT_VERSION = "ProxyCat-V2.0.2"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = httpx.Client(transport=httpx.HTTPTransport(retries=3))
|
client = httpx.Client(transport=httpx.HTTPTransport(retries=3))
|
||||||
|
@ -480,7 +480,6 @@ def load_config(config_file='config/config.ini'):
|
|||||||
|
|
||||||
result = dict(config.items('Server'))
|
result = dict(config.items('Server'))
|
||||||
|
|
||||||
# 添加用户配置
|
|
||||||
if config.has_section('Users'):
|
if config.has_section('Users'):
|
||||||
result['Users'] = dict(config.items('Users'))
|
result['Users'] = dict(config.items('Users'))
|
||||||
|
|
||||||
@ -638,7 +637,7 @@ async def check_for_updates(language='cn'):
|
|||||||
match = re.search(r'<p>(ProxyCat-V\d+\.\d+\.\d+)</p>', content)
|
match = re.search(r'<p>(ProxyCat-V\d+\.\d+\.\d+)</p>', content)
|
||||||
if match:
|
if match:
|
||||||
latest_version = match.group(1)
|
latest_version = match.group(1)
|
||||||
CURRENT_VERSION = "ProxyCat-V2.0.1"
|
CURRENT_VERSION = "ProxyCat-V2.0.2"
|
||||||
if version.parse(latest_version.split('-V')[1]) > version.parse(CURRENT_VERSION.split('-V')[1]):
|
if version.parse(latest_version.split('-V')[1]) > version.parse(CURRENT_VERSION.split('-V')[1]):
|
||||||
print(f"{Fore.YELLOW}{get_message('new_version_found', language)} 当前版本: {CURRENT_VERSION}, 最新版本: {latest_version}{Style.RESET_ALL}")
|
print(f"{Fore.YELLOW}{get_message('new_version_found', language)} 当前版本: {CURRENT_VERSION}, 最新版本: {latest_version}{Style.RESET_ALL}")
|
||||||
print(f"{Fore.YELLOW}{get_message('visit_quark', language)}{Style.RESET_ALL}")
|
print(f"{Fore.YELLOW}{get_message('visit_quark', language)}{Style.RESET_ALL}")
|
||||||
|
@ -185,11 +185,12 @@ class AsyncProxyServer:
|
|||||||
try:
|
try:
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
|
|
||||||
if self.switching_proxy or (current_time - self.last_switch_attempt < self.switch_cooldown):
|
if self.interval != 0 and (self.switching_proxy or (current_time - self.last_switch_attempt < self.switch_cooldown)):
|
||||||
return self.current_proxy
|
return self.current_proxy
|
||||||
|
|
||||||
if (self.use_getip and (not self.current_proxy or
|
if (self.use_getip and (not self.current_proxy or
|
||||||
current_time - self.last_switch_time >= self.interval)):
|
current_time - self.last_switch_time >= self.interval)) or \
|
||||||
|
(not self.use_getip and self.interval == 0):
|
||||||
try:
|
try:
|
||||||
self.switching_proxy = True
|
self.switching_proxy = True
|
||||||
self.last_switch_attempt = current_time
|
self.last_switch_attempt = current_time
|
||||||
@ -337,7 +338,7 @@ class AsyncProxyServer:
|
|||||||
else:
|
else:
|
||||||
proxy_url = f"{proxy_type}://{proxy_addr}"
|
proxy_url = f"{proxy_type}://{proxy_addr}"
|
||||||
|
|
||||||
return httpx.AsyncClient(
|
client = httpx.AsyncClient(
|
||||||
proxies={"all://": proxy_url},
|
proxies={"all://": proxy_url},
|
||||||
limits=httpx.Limits(
|
limits=httpx.Limits(
|
||||||
max_keepalive_connections=100,
|
max_keepalive_connections=100,
|
||||||
@ -348,6 +349,8 @@ class AsyncProxyServer:
|
|||||||
http2=True,
|
http2=True,
|
||||||
verify=False
|
verify=False
|
||||||
)
|
)
|
||||||
|
client._last_used = time.time()
|
||||||
|
return client
|
||||||
|
|
||||||
async def _cleanup_connections(self):
|
async def _cleanup_connections(self):
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
@ -903,6 +906,7 @@ class AsyncProxyServer:
|
|||||||
if proxy in self.proxy_pool:
|
if proxy in self.proxy_pool:
|
||||||
conn = self.proxy_pool[proxy]
|
conn = self.proxy_pool[proxy]
|
||||||
if not conn.is_closed:
|
if not conn.is_closed:
|
||||||
|
conn._last_used = time.time()
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
proxy_type, proxy_addr = proxy.split('://')
|
proxy_type, proxy_addr = proxy.split('://')
|
||||||
@ -928,6 +932,7 @@ class AsyncProxyServer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if len(self.proxy_pool) < self.max_pool_size:
|
if len(self.proxy_pool) < self.max_pool_size:
|
||||||
|
conn._last_used = time.time()
|
||||||
self.proxy_pool[proxy] = conn
|
self.proxy_pool[proxy] = conn
|
||||||
|
|
||||||
return conn
|
return conn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user