ignore TCP_REDIR, UDP_REDIR if not supported on the current platform

This commit is contained in:
zonyitoo
2022-07-17 20:32:36 +08:00
parent 0540912d47
commit e972f082e5

View File

@@ -559,16 +559,20 @@ pub fn main(matches: &ArgMatches) -> ExitCode {
#[cfg(feature = "local-redir")]
{
match matches.value_of_t::<RedirType>("TCP_REDIR") {
Ok(tcp_redir) => local_config.tcp_redir = tcp_redir,
Err(ref err) if err.kind() == ClapErrorKind::ArgumentNotFound => {}
Err(err) => err.exit(),
if RedirType::tcp_default() != RedirType::NotSupported {
match matches.value_of_t::<RedirType>("TCP_REDIR") {
Ok(tcp_redir) => local_config.tcp_redir = tcp_redir,
Err(ref err) if err.kind() == ClapErrorKind::ArgumentNotFound => {}
Err(err) => err.exit(),
}
}
match matches.value_of_t::<RedirType>("UDP_REDIR") {
Ok(udp_redir) => local_config.udp_redir = udp_redir,
Err(ref err) if err.kind() == ClapErrorKind::ArgumentNotFound => {}
Err(err) => err.exit(),
if RedirType::udp_default() != RedirType::NotSupported {
match matches.value_of_t::<RedirType>("UDP_REDIR") {
Ok(udp_redir) => local_config.udp_redir = udp_redir,
Err(ref err) if err.kind() == ClapErrorKind::ArgumentNotFound => {}
Err(err) => err.exit(),
}
}
}