Parse socks

This commit is contained in:
Keivan-sf
2025-07-27 21:50:52 +03:30
parent 863b9321b5
commit 65721cd5e3
10 changed files with 146 additions and 5 deletions

View File

@@ -10,10 +10,6 @@ pub enum Protocols {
}
pub fn get_uri_protocol(uri: &str) -> Option<Protocols> {
let uri_regex = Regex::new(r"^[a-z]+:\/\/.+$").unwrap();
if !uri_regex.is_match(uri) {
return None;
}
if uri.starts_with("vmess://") {
return Some(Protocols::Vmess);
}
@@ -23,7 +19,7 @@ pub fn get_uri_protocol(uri: &str) -> Option<Protocols> {
if uri.starts_with("ss://") {
return Some(Protocols::Shadowsocks);
}
if uri.starts_with("socks://") {
if uri.starts_with("socks5://") || uri.starts_with("socks4://") || uri.starts_with("socks://") {
return Some(Protocols::Socks);
}
if uri.starts_with("http://") {