diff --git a/clash_lib/src/proxy/converters/trojan.rs b/clash_lib/src/proxy/converters/trojan.rs index 045750e3b..212ebdf19 100644 --- a/clash_lib/src/proxy/converters/trojan.rs +++ b/clash_lib/src/proxy/converters/trojan.rs @@ -72,6 +72,7 @@ impl TryFrom<&OutboundTrojan> for AnyOutboundHandler { .as_ref() .map(|x| { Transport::Grpc(GrpcOption { + host: s.sni.as_ref().unwrap_or(&s.server).to_owned(), service_name: x .grpc_service_name .as_ref() diff --git a/clash_lib/src/proxy/converters/vmess.rs b/clash_lib/src/proxy/converters/vmess.rs index 2939df327..9b70ee7b8 100644 --- a/clash_lib/src/proxy/converters/vmess.rs +++ b/clash_lib/src/proxy/converters/vmess.rs @@ -80,6 +80,7 @@ impl TryFrom<&OutboundVmess> for AnyOutboundHandler { .as_ref() .map(|x| { VmessTransport::Grpc(GrpcOption { + host: s.server_name.as_ref().unwrap_or(&s.server).to_owned(), service_name: x .grpc_service_name .as_ref() diff --git a/clash_lib/src/proxy/fallback/mod.rs b/clash_lib/src/proxy/fallback/mod.rs index 6f7f16b47..df4dd72e9 100644 --- a/clash_lib/src/proxy/fallback/mod.rs +++ b/clash_lib/src/proxy/fallback/mod.rs @@ -54,7 +54,7 @@ impl Handler { let proxies = self.get_proxies(touch).await; for proxy in proxies.iter() { if self.proxy_manager.alive(proxy.name()).await { - debug!("{} fastest {} is alive", self.name(), proxy.name()); + debug!("`{}` fallback to `{}`", self.name(), proxy.name()); return proxy.clone(); } } diff --git a/clash_lib/src/proxy/options.rs b/clash_lib/src/proxy/options.rs index 8c11de492..32042280b 100644 --- a/clash_lib/src/proxy/options.rs +++ b/clash_lib/src/proxy/options.rs @@ -12,6 +12,7 @@ pub struct Http2Option { } pub struct GrpcOption { + pub host: String, pub service_name: String, } diff --git a/clash_lib/src/proxy/selector/mod.rs b/clash_lib/src/proxy/selector/mod.rs index 2ca53071d..8e9693d82 100644 --- a/clash_lib/src/proxy/selector/mod.rs +++ b/clash_lib/src/proxy/selector/mod.rs @@ -70,7 +70,7 @@ impl Handler { let proxies = get_proxies_from_providers(&self.providers, touch).await; for proxy in proxies { if proxy.name() == self.inner.read().await.current { - debug!("{} selected {}", self.name(), proxy.name()); + debug!("`{}` selected `{}`", self.name(), proxy.name()); return proxy; } } diff --git a/clash_lib/src/proxy/trojan/mod.rs b/clash_lib/src/proxy/trojan/mod.rs index 66a918385..b11915dab 100644 --- a/clash_lib/src/proxy/trojan/mod.rs +++ b/clash_lib/src/proxy/trojan/mod.rs @@ -100,7 +100,7 @@ impl Handler { } Transport::Grpc(grpc_opts) => { let grpc_builder = transport::GrpcStreamBuilder::new( - self.opts.server.clone(), + grpc_opts.host.clone(), grpc_opts .service_name .to_owned() diff --git a/clash_lib/src/proxy/vmess/mod.rs b/clash_lib/src/proxy/vmess/mod.rs index da911bb1f..30fc4e503 100644 --- a/clash_lib/src/proxy/vmess/mod.rs +++ b/clash_lib/src/proxy/vmess/mod.rs @@ -111,7 +111,7 @@ impl Handler { }; let grpc_builder = transport::GrpcStreamBuilder::new( - self.opts.server.clone(), + opt.host.clone(), opt.service_name .to_owned() .try_into()