Add quic settings to stream settings

This commit is contained in:
Keivan-sf
2023-10-23 19:13:16 +03:30
parent 422549ece6
commit 70ded295a1
2 changed files with 21 additions and 1 deletions

View File

@@ -31,6 +31,14 @@ pub struct NonHeaderObject {
pub r#type: String, pub r#type: String,
} }
#[allow(non_snake_case)]
#[derive(Serialize, Deserialize)]
pub struct QuicSettings {
pub header: Option<NonHeaderObject>,
pub security: String,
pub key: String,
}
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct GRPCSettings { pub struct GRPCSettings {
@@ -88,6 +96,7 @@ pub struct StreamSettings {
pub tcpSettings: Option<TCPSettings>, pub tcpSettings: Option<TCPSettings>,
pub realitySettings: Option<RealitySettings>, pub realitySettings: Option<RealitySettings>,
pub grpcSettings: Option<GRPCSettings>, pub grpcSettings: Option<GRPCSettings>,
pub quicSettings: Option<QuicSettings>,
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]

View File

@@ -63,6 +63,17 @@ pub fn create_outbound_object(data: models::VlessData) -> Outbound {
} else { } else {
None None
}, },
quicSettings: if data.query.r#type == String::from("quic") {
Some(QuicSettings {
header: Some(NonHeaderObject {
r#type: String::from("none"),
}),
security: String::from("none"),
key: String::from(""),
})
} else {
None
},
}, },
settings: OutboundSettings::Vless(VlessOutboundSettings { settings: OutboundSettings::Vless(VlessOutboundSettings {
vnext: vec![VlessServerObject { vnext: vec![VlessServerObject {
@@ -247,7 +258,7 @@ mod tests {
assert_eq!( assert_eq!(
serialized, serialized,
r#"{"settings":{"vnext":[{"address":"tr.deet23ngdell.com","port":1818,"users":[{"id":"3d2c2r05-y739-51e3-bd86-3f3f4950c183","encryption":"none","flow":"xtls-rprx-vision","level":0}]}]},"streamSettings":{"network":"tcp","security":"reality","tlsSettings":null,"wsSettings":null,"tcpSettings":{"header":{"type":"none"},"acceptProxyProtocol":null},"realitySettings":{"fingerprint":"chrome","serverName":"bench.sh","publicKey":"7xhH8b_VkliBxgulljcyPOH-bYoA2dl-XAdZAsfhk04","shortId":"6bt85979e30d4fc2","spiderX":""}},"protocol":"vless","tag":"proxy"}"# r#"{"settings":{"vnext":[{"address":"tr.deet23ngdell.com","port":1818,"users":[{"id":"3d2c2r05-y739-51e3-bd86-3f3f4950c183","encryption":"none","flow":"xtls-rprx-vision","level":0}]}]},"streamSettings":{"network":"tcp","security":"reality","tlsSettings":null,"wsSettings":null,"tcpSettings":{"header":{"type":"none"},"acceptProxyProtocol":null},"realitySettings":{"fingerprint":"chrome","serverName":"bench.sh","publicKey":"7xhH8b_VkliBxgulljcyPOH-bYoA2dl-XAdZAsfhk04","shortId":"6bt85979e30d4fc2","spiderX":""},"grpcSettings":null,"quicSettings":null},"protocol":"vless","tag":"proxy"}"#
); );
} }
} }