refactor: handle quic proxy internally instead of use external udp port (#1743)

* deprecate quic_listen_port, add disable_relay_quic and enable_relay_foreign_network_quic
* add set_src_modified to TcpProxyForWrappedSrcTrait
* prioritize quic over kcp
This commit is contained in:
Luna Yao
2026-02-02 11:53:40 +08:00
committed by GitHub
parent 21f4a944a7
commit cd2cf56358
21 changed files with 1419 additions and 530 deletions
+48
View File
@@ -1489,6 +1489,54 @@ impl PeerManager {
true
}
pub async fn check_allow_quic_to_dst(&self, dst_ip: &IpAddr) -> bool {
let route = self.get_route();
let Some(dst_peer_id) = route.get_peer_id_by_ip(dst_ip).await else {
return false;
};
let Some(peer_info) = route.get_peer_info(dst_peer_id).await else {
return false;
};
// check dst allow quic input
if !peer_info
.feature_flag
.map(|x| x.quic_input)
.unwrap_or(false)
{
return false;
}
let next_hop_policy = Self::get_next_hop_policy(self.global_ctx.get_flags().latency_first);
// check relay node allow relay quic.
let Some(next_hop_id) = route
.get_next_hop_with_policy(dst_peer_id, next_hop_policy)
.await
else {
return false;
};
if next_hop_id == dst_peer_id {
// dst p2p, no need to relay
return true;
}
let Some(next_hop_info) = route.get_peer_info(next_hop_id).await else {
return false;
};
// check next hop allow quic relay
if next_hop_info
.feature_flag
.map(|x| x.no_relay_quic)
.unwrap_or(false)
{
return false;
}
true
}
pub async fn update_exit_nodes(&self) {
let exit_nodes = self.global_ctx.config.get_exit_nodes();
*self.exit_nodes.write().await = exit_nodes;