mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
refactor: simplify proxy type handling and improve error handling in network commands
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{self, write};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Type {
|
||||
|
||||
@@ -274,10 +274,10 @@ impl NetworkManager {
|
||||
}
|
||||
|
||||
match proxy_type {
|
||||
ProxyType::NoProxy => {
|
||||
ProxyType::None => {
|
||||
builder = builder.no_proxy();
|
||||
}
|
||||
ProxyType::SelfProxy => {
|
||||
ProxyType::Localhost => {
|
||||
let port = Config::verge()
|
||||
.latest()
|
||||
.verge_mixed_port
|
||||
@@ -295,7 +295,7 @@ impl NetworkManager {
|
||||
builder = builder.proxy(proxy);
|
||||
}
|
||||
}
|
||||
ProxyType::SystemProxy => {
|
||||
ProxyType::System => {
|
||||
use sysproxy::Sysproxy;
|
||||
|
||||
if let Ok(p @ Sysproxy { enable: true, .. }) = Sysproxy::get_system_proxy() {
|
||||
@@ -420,7 +420,7 @@ impl NetworkManager {
|
||||
/// 代理类型
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ProxyType {
|
||||
NoProxy,
|
||||
SelfProxy,
|
||||
SystemProxy,
|
||||
None,
|
||||
Localhost,
|
||||
System,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user