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) */
if id == PROTO_HTTP {
return http::repl(data, masscanned, client_info);
} else if id == PROTO_STUN {
return stun::repl(data, masscanned, &mut client_info);
} else if id == PROTO_SSH {
return ssh::repl(data, masscanned, &mut client_info);
} else {
debug!("id: {}", id);
match id {
PROTO_HTTP => http::repl(data, masscanned, client_info),
PROTO_STUN => stun::repl(data, masscanned, &mut client_info),
PROTO_SSH => ssh::repl(data, masscanned, &mut client_info),
_ => {
debug!("id: {}", id);
None
}
}
None
}
#[cfg(test)]