删除PROXY_SUPPLEMENT变量,增加只读属性‘PIP_OPTIONS’

1、删除`proxychains4`模块支持,`pip`代理已支持全局模式下的`socks4`、`socks4a`、`socks5`、`socks5h`、`http`、`https`协议;
2、删除`PROXY_SUPPLEMENT`变量,取消手动控制功能;
3、增加自动判断,将`pip`与`update`的代理判断,从手动改为自动,优先级:镜像站 > 全局 > 不代理;
4、将`pip`的附加代理参数,作为只读属性`PIP_OPTIONS`写入到`config`中,其他对象可通过`settings.PIP_OPTIONS`实现快速调用。
This commit is contained in:
Aqr-K
2024-08-03 23:02:10 +08:00
parent fea7b7d02d
commit e8ff878aac
6 changed files with 65 additions and 190 deletions

View File

@@ -7,8 +7,6 @@ def parse_url(url):
# 提取各个部分
protocol = parsed_url.scheme or ""
username = parsed_url.username or ""
password = parsed_url.password or ""
hostname = parsed_url.hostname or ""
port = parsed_url.port or ""
@@ -23,18 +21,11 @@ def parse_url(url):
elif protocol in {"socks5", "socks5h", "socks4", "socks4a"}:
port = 1080
# socks协议转换适配proxychains4的临时命令不支持的socks4a与socks5h
if protocol:
protocol = protocol.lower()
if protocol in {"socks5", "socks5h"}:
protocol = "socks5"
elif protocol in {"socks4", "socks4a"}:
protocol = "socks4"
# 打印提取的部分
print(f"SCHEME:{protocol}")
print(f"USERNAME:{username}")
print(f"PASSWORD:{password}")
print(f"HOST:{hostname}")
print(f"PORT:{port}")
@@ -43,8 +34,6 @@ if __name__ == "__main__":
# 参数不全,直接返回空解析结果
if len(sys.argv) != 2:
print(f"SCHEME:''")
print(f"USERNAME:''")
print(f"PASSWORD:''")
print(f"HOST:''")
print(f"PORT:''")
# 参数全解析URL