mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-15 14:47:51 +00:00
Applied clippy fixes
This commit is contained in:
@@ -21,13 +21,13 @@ pub fn get_metadata(uri: &str) -> String {
|
||||
port: data.port,
|
||||
protocol,
|
||||
};
|
||||
|
||||
|
||||
serde_json::to_string(&meta_data).unwrap()
|
||||
}
|
||||
|
||||
pub fn create_json_config(uri: &str, socks_port: Option<u16>, http_port: Option<u16>) -> String {
|
||||
let config = create_config(uri, socks_port, http_port);
|
||||
|
||||
|
||||
serde_json::to_string(&config).unwrap()
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ pub fn create_config(
|
||||
socks_port,
|
||||
http_port,
|
||||
});
|
||||
|
||||
|
||||
config_models::Config {
|
||||
outbounds: vec![outbound_object],
|
||||
inbounds: inbound_config,
|
||||
@@ -56,8 +56,6 @@ pub fn create_outbound_object(uri: &str) -> config_models::Outbound {
|
||||
let allow_insecure = data.allowInsecure == Some(String::from("true"))
|
||||
|| data.allowInsecure == Some(String::from("1"));
|
||||
|
||||
|
||||
|
||||
Outbound {
|
||||
protocol: name,
|
||||
tag: String::from("proxy"),
|
||||
|
||||
@@ -8,9 +8,7 @@ use serde_json::Value;
|
||||
pub fn get_data(uri: &str) -> RawData {
|
||||
let data = uri.split_once("vmess://").unwrap().1;
|
||||
|
||||
match general_purpose::STANDARD
|
||||
.decode(url_decode_str(data).unwrap_or(String::from(data)))
|
||||
{
|
||||
match general_purpose::STANDARD.decode(url_decode_str(data).unwrap_or(String::from(data))) {
|
||||
Ok(decoded) => get_raw_data_from_base64(&decoded),
|
||||
Err(_) => get_raw_data_from_uri(data),
|
||||
}
|
||||
|
||||
@@ -24,8 +24,5 @@ pub fn parse_raw_json(input: &str) -> Option<serde_json::Value> {
|
||||
}
|
||||
|
||||
pub fn get_parameter_value(query: &Vec<(&str, &str)>, param: &str) -> Option<String> {
|
||||
query
|
||||
.iter()
|
||||
.find(|q| q.0 == param)
|
||||
.map(|q| q.1.to_string())
|
||||
query.iter().find(|q| q.0 == param).map(|q| q.1.to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user