Add a setting "disable_udp_hole_punch" to disable UDP hole punch function (#291)

It can solve #289 tentative.

Co-authored-by: 3rdnature <root@natureblog.net>
This commit is contained in:
3RDNature
2024-08-29 11:34:30 +08:00
committed by GitHub
parent a8bb4ee7e5
commit 6964fb71fc
4 changed files with 15 additions and 0 deletions
+2
View File
@@ -178,6 +178,8 @@ pub struct Flags {
pub disable_p2p: bool,
#[derivative(Default(value = "false"))]
pub relay_all_peer_rpc: bool,
#[derivative(Default(value = "false"))]
pub disable_udp_hole_punching: bool,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
+3
View File
@@ -605,6 +605,9 @@ impl UdpHolePunchConnector {
if self.data.global_ctx.get_flags().disable_p2p {
return Ok(());
}
if self.data.global_ctx.get_flags().disable_udp_hole_punching {
return Ok(());
}
self.run_as_client().await?;
self.run_as_server().await?;
+7
View File
@@ -266,6 +266,13 @@ struct Cli {
)]
disable_p2p: bool,
#[arg(
long,
help = t!("core_clap.disable_udp_hole_punching").to_string(),
default_value = "false"
)]
disable_udp_hole_punching: bool,
#[arg(
long,
help = t!("core_clap.relay_all_peer_rpc").to_string(),