diff --git a/src/parser/config_models/mod.rs b/src/parser/config_models/mod.rs index 1dcebb8..ed07d1d 100644 --- a/src/parser/config_models/mod.rs +++ b/src/parser/config_models/mod.rs @@ -25,6 +25,26 @@ pub enum OutboundSettings { Vless(VlessOutboundSettings), } +#[derive(Serialize, Deserialize)] +pub struct NonHeaderObject { + pub r#type: String, +} + +#[allow(non_snake_case)] +#[derive(Serialize, Deserialize)] +pub struct TCPSettings { + header: Option, + acceptProxyProtocol: Option, +} + +#[allow(non_snake_case)] +#[derive(Serialize, Deserialize)] +pub struct WsSettings { + pub path: Option, + // Headers map[string]string headers + pub acceptProxyProtocol: Option, +} + #[allow(non_snake_case)] #[derive(Serialize, Deserialize)] pub struct TlsSettings { @@ -46,6 +66,7 @@ pub struct StreamSettings { pub network: String, pub security: String, pub tlsSettings: Option, + pub wsSettings: Option, } #[allow(non_snake_case)] diff --git a/src/parser/vless/mod.rs b/src/parser/vless/mod.rs index 133297c..d7bdee2 100644 --- a/src/parser/vless/mod.rs +++ b/src/parser/vless/mod.rs @@ -9,7 +9,7 @@ fn create_outbound_object(data: models::VlessData) -> Outbound { protocol: String::from("vless"), tag: String::from("proxy"), streamSettings: StreamSettings { - network: data.query.r#type, + network: data.query.r#type.clone(), security: data.query.security.clone(), tlsSettings: if data.query.security == String::from("tls") { Some(TlsSettings { @@ -27,6 +27,14 @@ fn create_outbound_object(data: models::VlessData) -> Outbound { } else { None }, + wsSettings: if data.query.r#type == String::from("ws") { + Some(WsSettings { + path: Some(String::from("")), + acceptProxyProtocol: None, + }) + } else { + None + }, }, settings: OutboundSettings::Vless(VlessOutboundSettings { vnext: vec![VlessServerObject {