mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-10-23 07:31:34 +00:00
Update app_protocol.rs
This commit is contained in:
parent
376eef4ba8
commit
08441ebe6c
1 changed files with 40 additions and 1 deletions
|
|
@ -148,4 +148,43 @@ impl AppProtocol {
|
|||
AppProtocol::TFTP,
|
||||
AppProtocol::XMPP,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn from_port_to_application_protocol_ftp() {
|
||||
let result1 = from_port_to_application_protocol(20);
|
||||
assert_eq!(AppProtocol::FTP, result1);
|
||||
let result2 = from_port_to_application_protocol(21);
|
||||
assert_eq!(AppProtocol::FTP, result2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_port_to_application_protocol_ssh() {
|
||||
let result = from_port_to_application_protocol(22);
|
||||
assert_eq!(AppProtocol::SSH, result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_port_to_application_protocol_other() {
|
||||
let result = from_port_to_application_protocol(500);
|
||||
assert_eq!(AppProtocol::Other, result);
|
||||
}
|
||||
// Please let me know if you want tests on every one, happy to do it so
|
||||
|
||||
#[test]
|
||||
fn app_protocol_display_ftp() {
|
||||
let test_str = AppProtocol::FTP.to_string();
|
||||
assert_eq!(test_str, "FTP");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn app_protocol_display_other() {
|
||||
let test_str = AppProtocol::Other.to_string();
|
||||
assert_eq!(test_str, "All protocols");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue