mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 06:57:52 +00:00
Read allowInsecure from config uri
This commit is contained in:
@@ -109,7 +109,7 @@ pub struct WsSettings {
|
|||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct TlsSettings {
|
pub struct TlsSettings {
|
||||||
pub alpn: Option<Vec<String>>,
|
pub alpn: Option<Vec<String>>,
|
||||||
pub allowInsecure: Option<bool>,
|
pub allowInsecure: bool,
|
||||||
pub serverName: Option<String>,
|
pub serverName: Option<String>,
|
||||||
pub enableSessionResumption: Option<bool>,
|
pub enableSessionResumption: Option<bool>,
|
||||||
pub disableSystemRoot: Option<bool>,
|
pub disableSystemRoot: Option<bool>,
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ fn parse_vless_query(raw_query: &str) -> models::VlessQuery {
|
|||||||
slpn: get_parameter_value(&query, "slpn"),
|
slpn: get_parameter_value(&query, "slpn"),
|
||||||
spx: url_decode(get_parameter_value(&query, "spx")),
|
spx: url_decode(get_parameter_value(&query, "spx")),
|
||||||
extra: url_decode(get_parameter_value(&query, "extra")),
|
extra: url_decode(get_parameter_value(&query, "extra")),
|
||||||
|
allowInsecure: get_parameter_value(&query, "allowInsecure"),
|
||||||
};
|
};
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ use crate::{config_models::*, utils::parse_raw_json};
|
|||||||
|
|
||||||
pub fn create_outbound_object(data: models::VlessData) -> Outbound {
|
pub fn create_outbound_object(data: models::VlessData) -> Outbound {
|
||||||
let network_type = data.query.r#type.clone().unwrap_or(String::from(""));
|
let network_type = data.query.r#type.clone().unwrap_or(String::from(""));
|
||||||
|
|
||||||
|
let allow_insecure = data.query.allowInsecure == Some(String::from("true"))
|
||||||
|
|| data.query.allowInsecure == Some(String::from("1"));
|
||||||
|
|
||||||
return Outbound {
|
return Outbound {
|
||||||
protocol: String::from("vless"),
|
protocol: String::from("vless"),
|
||||||
tag: String::from("proxy"),
|
tag: String::from("proxy"),
|
||||||
@@ -22,7 +26,7 @@ pub fn create_outbound_object(data: models::VlessData) -> Outbound {
|
|||||||
preferServerCipherSuites: None,
|
preferServerCipherSuites: None,
|
||||||
fingerprint: data.query.fp.clone(),
|
fingerprint: data.query.fp.clone(),
|
||||||
serverName: data.query.sni.clone(),
|
serverName: data.query.sni.clone(),
|
||||||
allowInsecure: Some(false),
|
allowInsecure: allow_insecure,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#[allow(non_snake_case)]
|
||||||
pub struct VlessQuery {
|
pub struct VlessQuery {
|
||||||
pub security: Option<String>,
|
pub security: Option<String>,
|
||||||
pub sni: Option<String>,
|
pub sni: Option<String>,
|
||||||
@@ -20,6 +21,7 @@ pub struct VlessQuery {
|
|||||||
pub spx: Option<String>,
|
pub spx: Option<String>,
|
||||||
pub alpn: Option<String>,
|
pub alpn: Option<String>,
|
||||||
pub extra: Option<String>,
|
pub extra: Option<String>,
|
||||||
|
pub allowInsecure: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct VlessAddress {
|
pub struct VlessAddress {
|
||||||
|
|||||||
Reference in New Issue
Block a user