mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 15:07:53 +00:00
Improve main interface
This commit is contained in:
@@ -4,23 +4,22 @@ mod uri_identifier;
|
|||||||
mod vless;
|
mod vless;
|
||||||
pub fn parse(uri: &str) {
|
pub fn parse(uri: &str) {
|
||||||
let protocol = uri_identifier::get_uri_protocol(uri);
|
let protocol = uri_identifier::get_uri_protocol(uri);
|
||||||
|
let mut serialized: String = String::from("");
|
||||||
match protocol {
|
match protocol {
|
||||||
Some(uri_identifier::Protocols::Vmess) => {
|
|
||||||
println!("The protocol was vmess");
|
|
||||||
}
|
|
||||||
Some(uri_identifier::Protocols::Vless) => {
|
Some(uri_identifier::Protocols::Vless) => {
|
||||||
println!("The protocol is Vless");
|
println!("The protocol is Vless");
|
||||||
let vless_data = vless::get_vless_data(uri);
|
let vless_data = vless::get_vless_data(uri);
|
||||||
let outbound_object = vless::create_outbound_object(vless_data);
|
let outbound_object = vless::create_outbound_object(vless_data);
|
||||||
let serialized = serde_json::to_string(&outbound_object).unwrap();
|
serialized = serde_json::to_string(&outbound_object).unwrap();
|
||||||
println!("The parsed config is :\n{}", serialized);
|
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
println!("The protocol was recognized");
|
println!("The protocol was recognized but is not supported yet");
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
println!("The protcol is not supported");
|
println!("The protcol is not supported");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
println!("The parsed config is :\n{}", serialized);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user