Merge pull request #12 from p-l-/enh-proto

Replace if / else if using a match
This commit is contained in:
_Frky 2021-12-16 20:25:02 +01:00 committed by GitHub
commit 6da8a23ede
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,16 +118,15 @@ pub fn repl<'a>(
} }
} }
/* proto over else (e.g., UDP) */ /* proto over else (e.g., UDP) */
if id == PROTO_HTTP { match id {
return http::repl(data, masscanned, client_info); PROTO_HTTP => http::repl(data, masscanned, client_info),
} else if id == PROTO_STUN { PROTO_STUN => stun::repl(data, masscanned, &mut client_info),
return stun::repl(data, masscanned, &mut client_info); PROTO_SSH => ssh::repl(data, masscanned, &mut client_info),
} else if id == PROTO_SSH { _ => {
return ssh::repl(data, masscanned, &mut client_info); debug!("id: {}", id);
} else { None
debug!("id: {}", id); }
} }
None
} }
#[cfg(test)] #[cfg(test)]