use crate::protocol::*;
use crate::*;
impl Protocol {
#[inline(always)]
pub fn is_http(protocol: &str) -> bool {
matches!(protocol.to_lowercase().as_str(), HTTP_LOWERCASE)
}
#[inline(always)]
pub fn is_https(protocol: &str) -> bool {
matches!(protocol.to_lowercase().as_str(), HTTPS_LOWERCASE)
}
#[inline(always)]
pub fn get_port(protocol: &str) -> u16 {
match protocol.to_lowercase().as_str() {
HTTP_LOWERCASE => 80,
HTTPS_LOWERCASE => 443,
FTP_LOWERCASE => 21,
FTPS_LOWERCASE => 990,
SFTP_LOWERCASE => 22,
SSH_LOWERCASE => 22,
TELNET_LOWERCASE => 23,
SMTP_LOWERCASE => 25,
SMTPS_LOWERCASE => 465,
POP3_LOWERCASE => 110,
POP3S_LOWERCASE => 995,
IMAP_LOWERCASE => 143,
IMAPS_LOWERCASE => 993,
DNS_LOWERCASE => 53,
WS_LOWERCASE => 80,
WSS_LOWERCASE => 443,
_ => 80,
}
}
}