Improve main interface

This commit is contained in:
Keivan-sf
2023-10-23 19:16:58 +03:30
parent 70ded295a1
commit 914b86c60d

View File

@@ -4,23 +4,22 @@ mod uri_identifier;
mod vless;
pub fn parse(uri: &str) {
let protocol = uri_identifier::get_uri_protocol(uri);
let mut serialized: String = String::from("");
match protocol {
Some(uri_identifier::Protocols::Vmess) => {
println!("The protocol was vmess");
}
Some(uri_identifier::Protocols::Vless) => {
println!("The protocol is Vless");
let vless_data = vless::get_vless_data(uri);
let outbound_object = vless::create_outbound_object(vless_data);
let serialized = serde_json::to_string(&outbound_object).unwrap();
println!("The parsed config is :\n{}", serialized);
serialized = serde_json::to_string(&outbound_object).unwrap();
}
Some(_) => {
println!("The protocol was recognized");
println!("The protocol was recognized but is not supported yet");
exit(0);
}
None => {
println!("The protcol is not supported");
exit(0);
}
}
println!("The parsed config is :\n{}", serialized);
}