mirror of
https://github.com/honmashironeko/ProxyCat.git
synced 2025-05-08 11:36:30 +00:00
Update
This commit is contained in:
parent
3e590ebfe6
commit
1ee8daff0d
@ -45,8 +45,8 @@ def update_status(server):
|
||||
else:
|
||||
print(status, end='', flush=True)
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"Status update error: {e}")
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(1)
|
||||
|
||||
async def handle_client_wrapper(server, reader, writer, clients):
|
||||
|
@ -79,6 +79,10 @@ MESSAGES = {
|
||||
'server_start_error': '服务器启动错误: {}',
|
||||
'server_shutting_down': '正在关闭服务器...',
|
||||
'client_process_error': '处理客户端请求时出错: {}',
|
||||
'request_handling_error': '请求处理错误: {}',
|
||||
'proxy_forward_error': '代理转发错误: {}',
|
||||
'data_transfer_timeout': '{}数据传输超时',
|
||||
'data_transfer_error': '{}数据传输错误: {}',
|
||||
},
|
||||
'en': {
|
||||
'getting_new_proxy': 'Getting new proxy IP',
|
||||
@ -156,6 +160,10 @@ MESSAGES = {
|
||||
'server_start_error': 'Server startup error: {}',
|
||||
'server_shutting_down': 'Shutting down server...',
|
||||
'client_process_error': 'Error processing client request: {}',
|
||||
'request_handling_error': 'Request handling error: {}',
|
||||
'proxy_forward_error': 'Proxy forwarding error: {}',
|
||||
'data_transfer_timeout': '{} data transfer timeout',
|
||||
'data_transfer_error': '{} data transfer error: {}',
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,8 +337,7 @@ async def check_proxy(proxy):
|
||||
is_valid = await check_funcs[proxy_type](proxy)
|
||||
_proxy_check_cache[proxy] = (current_time, is_valid)
|
||||
return is_valid
|
||||
except Exception as e:
|
||||
logging.error(f"{proxy_type.upper()}代理 {proxy} 检测失败: {e}")
|
||||
except Exception:
|
||||
_proxy_check_cache[proxy] = (current_time, False)
|
||||
return False
|
||||
|
||||
|
@ -509,7 +509,7 @@ class AsyncProxyServer:
|
||||
await writer.drain()
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"请求处理错误: {e}")
|
||||
logging.error(get_message('request_handling_error', self.language, e))
|
||||
writer.write(b'HTTP/1.1 502 Bad Gateway\r\n\r\n')
|
||||
await writer.drain()
|
||||
finally:
|
||||
@ -568,7 +568,7 @@ class AsyncProxyServer:
|
||||
await writer.drain()
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"请求处理错误: {e}")
|
||||
logging.error(get_message('request_handling_error', self.language, e))
|
||||
writer.write(b'HTTP/1.1 502 Bad Gateway\r\n\r\n')
|
||||
await writer.drain()
|
||||
finally:
|
||||
@ -707,7 +707,7 @@ class AsyncProxyServer:
|
||||
print(f"连接超时,重试 {retry + 1}/{self.retry_count}")
|
||||
continue
|
||||
except Exception as e:
|
||||
print(f"代理转发错误: {e}")
|
||||
logging.error(get_message('proxy_forward_error', self.language, e))
|
||||
if retry == self.retry_count - 1:
|
||||
raise
|
||||
continue
|
||||
@ -727,9 +727,9 @@ class AsyncProxyServer:
|
||||
writer.write(data)
|
||||
await writer.drain()
|
||||
except TimeoutError:
|
||||
print(f"{direction} 数据传输超时")
|
||||
logging.error(get_message('data_transfer_timeout', self.language, direction))
|
||||
except Exception as e:
|
||||
print(f"{direction} 数据传输错误: {e}")
|
||||
logging.error(get_message('data_transfer_error', self.language, direction, e))
|
||||
|
||||
def is_docker():
|
||||
return os.path.exists('/.dockerenv')
|
||||
|
Loading…
x
Reference in New Issue
Block a user