From 74af65d56b37b5553d35ec982772aef6bca251b1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 19 Dec 2024 06:26:42 +0100 Subject: [PATCH] SQUASH clippy enum_variant_names fixup --- rust/src/socks/socks.rs | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/rust/src/socks/socks.rs b/rust/src/socks/socks.rs index 3bfcb551ee83..74d23373e498 100644 --- a/rust/src/socks/socks.rs +++ b/rust/src/socks/socks.rs @@ -91,17 +91,17 @@ impl Transaction for SocksTransaction { #[derive(PartialEq, Eq, Debug)] enum SocksConnectionState { - SocksStateNew = 0, - SocksStateAuthMethodSent = 1, - SocksStateAuthMethodResponded = 2, - SocksStateAuthDataSent = 3, - SocksStateAuthDataResponded = 4, - SocksStateConnectSent = 5, - SocksStateConnectResponded = 6, + New = 0, + AuthMethodSent = 1, + AuthMethodResponded = 2, + AuthDataSent = 3, + AuthDataResponded = 4, + ConnectSent = 5, + ConnectResponded = 6, } impl Default for SocksConnectionState { fn default() -> Self { - SocksConnectionState::SocksStateNew + SocksConnectionState::New } } impl fmt::Display for SocksConnectionState { @@ -173,7 +173,7 @@ impl SocksState { &mut self, tinput: &'a [u8], rinput: &'a [u8], ) -> (AppLayerResult, &'a [u8]) { match self.state { - SocksConnectionState::SocksStateNew => { + SocksConnectionState::New => { let r = parser::parse_connect_request(rinput); match r { Ok((rem, request)) => { @@ -189,7 +189,7 @@ impl SocksState { if self.transactions.len() >= unsafe { SOCKS_MAX_TX } { return (AppLayerResult::err(), &[]); } - self.state = SocksConnectionState::SocksStateAuthMethodSent; + self.state = SocksConnectionState::AuthMethodSent; SCLogDebug!("> state now {}", self.state); return (AppLayerResult::ok(), rem); } @@ -209,8 +209,8 @@ impl SocksState { } } } - SocksConnectionState::SocksStateAuthMethodSent => {} - SocksConnectionState::SocksStateAuthMethodResponded => { + SocksConnectionState::AuthMethodSent => {} + SocksConnectionState::AuthMethodResponded => { let r = parser::parse_auth_request(rinput); match r { Ok((rem, request)) => { @@ -228,7 +228,7 @@ impl SocksState { if self.transactions.len() >= unsafe { SOCKS_MAX_TX } { return (AppLayerResult::err(), &[]); } - self.state = SocksConnectionState::SocksStateAuthDataSent; + self.state = SocksConnectionState::AuthDataSent; SCLogDebug!("> state now {}", self.state); return (AppLayerResult::ok(), rem); } @@ -248,8 +248,8 @@ impl SocksState { } } } - SocksConnectionState::SocksStateAuthDataSent => {} - SocksConnectionState::SocksStateAuthDataResponded => { + SocksConnectionState::AuthDataSent => {} + SocksConnectionState::AuthDataResponded => { SCLogDebug!("connect request!"); let r = parser::parse_connect_command_request(rinput); match r { @@ -268,7 +268,7 @@ impl SocksState { if self.transactions.len() >= unsafe { SOCKS_MAX_TX } { return (AppLayerResult::err(), &[]); } - self.state = SocksConnectionState::SocksStateConnectSent; + self.state = SocksConnectionState::ConnectSent; SCLogDebug!("> state now {}", self.state); return (AppLayerResult::ok(), rem); } @@ -288,8 +288,8 @@ impl SocksState { } } } - SocksConnectionState::SocksStateConnectSent => {} - SocksConnectionState::SocksStateConnectResponded => {} + SocksConnectionState::ConnectSent => {} + SocksConnectionState::ConnectResponded => {} } return (AppLayerResult::err(), &[]); } @@ -299,8 +299,8 @@ impl SocksState { ) -> (AppLayerResult, &'a [u8]) { SCLogDebug!("< state {}", self.state); match self.state { - SocksConnectionState::SocksStateNew => {} - SocksConnectionState::SocksStateAuthMethodSent => { + SocksConnectionState::New => {} + SocksConnectionState::AuthMethodSent => { let r = parser::parse_connect_response(rinput); match r { Ok((rem, response)) => { @@ -317,9 +317,9 @@ impl SocksState { } if response == 0 { - self.state = SocksConnectionState::SocksStateAuthDataResponded; + self.state = SocksConnectionState::AuthDataResponded; } else { - self.state = SocksConnectionState::SocksStateAuthMethodResponded; + self.state = SocksConnectionState::AuthMethodResponded; } SCLogDebug!("< state now {}", self.state); @@ -343,8 +343,8 @@ impl SocksState { } } } - SocksConnectionState::SocksStateAuthMethodResponded => {} - SocksConnectionState::SocksStateAuthDataSent => { + SocksConnectionState::AuthMethodResponded => {} + SocksConnectionState::AuthDataSent => { SCLogDebug!("auth response!"); let r = parser::parse_auth_response(rinput); match r { @@ -359,7 +359,7 @@ impl SocksState { } else { SCLogDebug!("< no tx found"); } - self.state = SocksConnectionState::SocksStateAuthDataResponded; + self.state = SocksConnectionState::AuthDataResponded; SCLogDebug!("< state now {}", self.state); return (AppLayerResult::ok(), rem); @@ -380,8 +380,8 @@ impl SocksState { } } } - SocksConnectionState::SocksStateAuthDataResponded => {} - SocksConnectionState::SocksStateConnectSent => { + SocksConnectionState::AuthDataResponded => {} + SocksConnectionState::ConnectSent => { SCLogDebug!("connect response!"); let r = parser::parse_connect_command_response(rinput); match r { @@ -396,7 +396,7 @@ impl SocksState { } else { SCLogDebug!("< no tx found"); } - self.state = SocksConnectionState::SocksStateConnectResponded; + self.state = SocksConnectionState::ConnectResponded; SCLogDebug!("< state now {}", self.state); return (AppLayerResult::ok(), rem); @@ -417,7 +417,7 @@ impl SocksState { } } } - SocksConnectionState::SocksStateConnectResponded => {} + SocksConnectionState::ConnectResponded => {} } return (AppLayerResult::err(), &[]); } @@ -483,13 +483,13 @@ impl SocksState { SCLogDebug!("issue {:?}", r); return r; } - if self.state == SocksConnectionState::SocksStateConnectResponded { + if self.state == SocksConnectionState::ConnectResponded { // TODO how does it work if we got more data in `input` here? break; } record = remaining; } - if self.state == SocksConnectionState::SocksStateConnectResponded { + if self.state == SocksConnectionState::ConnectResponded { SCLogDebug!("requesting upgrade"); unsafe { // TODO TLS is wrong, it can by any protocol.