mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 15:07:53 +00:00
Add wss setting to vless outbound
This commit is contained in:
@@ -25,6 +25,26 @@ pub enum OutboundSettings {
|
|||||||
Vless(VlessOutboundSettings),
|
Vless(VlessOutboundSettings),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct NonHeaderObject {
|
||||||
|
pub r#type: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct TCPSettings {
|
||||||
|
header: Option<NonHeaderObject>,
|
||||||
|
acceptProxyProtocol: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct WsSettings {
|
||||||
|
pub path: Option<String>,
|
||||||
|
// Headers map[string]string headers
|
||||||
|
pub acceptProxyProtocol: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct TlsSettings {
|
pub struct TlsSettings {
|
||||||
@@ -46,6 +66,7 @@ pub struct StreamSettings {
|
|||||||
pub network: String,
|
pub network: String,
|
||||||
pub security: String,
|
pub security: String,
|
||||||
pub tlsSettings: Option<TlsSettings>,
|
pub tlsSettings: Option<TlsSettings>,
|
||||||
|
pub wsSettings: Option<WsSettings>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fn create_outbound_object(data: models::VlessData) -> Outbound {
|
|||||||
protocol: String::from("vless"),
|
protocol: String::from("vless"),
|
||||||
tag: String::from("proxy"),
|
tag: String::from("proxy"),
|
||||||
streamSettings: StreamSettings {
|
streamSettings: StreamSettings {
|
||||||
network: data.query.r#type,
|
network: data.query.r#type.clone(),
|
||||||
security: data.query.security.clone(),
|
security: data.query.security.clone(),
|
||||||
tlsSettings: if data.query.security == String::from("tls") {
|
tlsSettings: if data.query.security == String::from("tls") {
|
||||||
Some(TlsSettings {
|
Some(TlsSettings {
|
||||||
@@ -27,6 +27,14 @@ fn create_outbound_object(data: models::VlessData) -> Outbound {
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
wsSettings: if data.query.r#type == String::from("ws") {
|
||||||
|
Some(WsSettings {
|
||||||
|
path: Some(String::from("")),
|
||||||
|
acceptProxyProtocol: None,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
},
|
},
|
||||||
settings: OutboundSettings::Vless(VlessOutboundSettings {
|
settings: OutboundSettings::Vless(VlessOutboundSettings {
|
||||||
vnext: vec![VlessServerObject {
|
vnext: vec![VlessServerObject {
|
||||||
|
|||||||
Reference in New Issue
Block a user