diff --git a/src/parser/config_models/mod.rs b/src/parser/config_models/mod.rs index 73cd06e..a9e85d1 100644 --- a/src/parser/config_models/mod.rs +++ b/src/parser/config_models/mod.rs @@ -30,6 +30,16 @@ pub struct NonHeaderObject { pub r#type: String, } +#[allow(non_snake_case)] +#[derive(Serialize, Deserialize)] +pub struct RealitySettings { + pub fingerprint: String, + pub serverName: String, + pub publicKey: String, + pub shortId: String, + pub spiderX: String, +} + #[allow(non_snake_case)] #[derive(Serialize, Deserialize)] pub struct TCPSettings { @@ -68,6 +78,7 @@ pub struct StreamSettings { pub tlsSettings: Option, pub wsSettings: Option, pub tcpSettings: Option, + pub realitySettings: Option, } #[allow(non_snake_case)] diff --git a/src/parser/vless/mod.rs b/src/parser/vless/mod.rs index 9f74b3f..f658673 100644 --- a/src/parser/vless/mod.rs +++ b/src/parser/vless/mod.rs @@ -21,7 +21,7 @@ fn create_outbound_object(data: models::VlessData) -> Outbound { disableSystemRoot: None, preferServerCipherSuites: None, fingerprint: Some(String::from("")), - serverName: Some(data.query.sni), + serverName: Some(data.query.sni.clone()), allowInsecure: Some(false), }) } else { @@ -45,6 +45,17 @@ fn create_outbound_object(data: models::VlessData) -> Outbound { } else { None }, + realitySettings: if data.query.security == String::from("reality") { + Some(RealitySettings { + publicKey: data.query.pbk, + serverName: data.query.sni.clone(), + shortId: data.query.sid, + spiderX: String::from(""), + fingerprint: data.query.fp, + }) + } else { + None + }, }, settings: OutboundSettings::Vless(VlessOutboundSettings { vnext: vec![VlessServerObject {