mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 06:57:52 +00:00
Add tls setting to vless outbound
This commit is contained in:
@@ -26,34 +26,33 @@ pub enum OutboundSettings {
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct TlsSettings {
|
||||
pub allowInsecure: bool,
|
||||
pub certificates: u8,
|
||||
pub serverName: String,
|
||||
// u8 is a dummy type here
|
||||
pub alpn: u8,
|
||||
pub enableSessionResumption: bool,
|
||||
pub disableSystemRoot: bool,
|
||||
pub minVersion: String,
|
||||
pub maxVersion: String,
|
||||
pub cipherSuites: String,
|
||||
pub preferServerCipherSuites: bool,
|
||||
pub fingerprint: String,
|
||||
pub rejectUnknownSni: bool,
|
||||
pub pinnedPeerCertificateChainSha256: u8,
|
||||
pub pinnedPeerCertificatePublicKeySha256: u8,
|
||||
pub allowInsecure: Option<bool>,
|
||||
pub serverName: Option<String>,
|
||||
pub enableSessionResumption: Option<bool>,
|
||||
pub disableSystemRoot: Option<bool>,
|
||||
pub minVersion: Option<String>,
|
||||
pub maxVersion: Option<String>,
|
||||
pub cipherSuites: Option<String>,
|
||||
pub preferServerCipherSuites: Option<bool>,
|
||||
pub fingerprint: Option<String>,
|
||||
pub rejectUnknownSni: Option<bool>,
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct StreamSettings {
|
||||
pub network: String,
|
||||
pub security: String,
|
||||
pub tlsSettings: TlsSettings,
|
||||
pub tlsSettings: Option<TlsSettings>,
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Outbound {
|
||||
pub settings: OutboundSettings,
|
||||
pub streamSettings: StreamSettings,
|
||||
pub protocol: String,
|
||||
pub tag: String,
|
||||
}
|
||||
|
||||
@@ -1,13 +1,33 @@
|
||||
use querystring;
|
||||
mod models;
|
||||
use crate::parser::config_models::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::process::exit;
|
||||
use crate::parser::config_models::*;
|
||||
|
||||
fn create_outbound_object(data: models::VlessData) -> Outbound {
|
||||
return Outbound {
|
||||
protocol: String::from("vless"),
|
||||
tag: String::from("proxy"),
|
||||
streamSettings: StreamSettings {
|
||||
network: data.query.r#type,
|
||||
security: data.query.security.clone(),
|
||||
tlsSettings: if data.query.security == String::from("tls") {
|
||||
Some(TlsSettings {
|
||||
rejectUnknownSni: None,
|
||||
enableSessionResumption: None,
|
||||
minVersion: None,
|
||||
maxVersion: None,
|
||||
cipherSuites: None,
|
||||
disableSystemRoot: None,
|
||||
preferServerCipherSuites: None,
|
||||
fingerprint: Some(String::from("")),
|
||||
serverName: Some(data.query.sni),
|
||||
allowInsecure: Some(false),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
},
|
||||
},
|
||||
settings: OutboundSettings::Vless(VlessOutboundSettings {
|
||||
vnext: vec![VlessServerObject {
|
||||
port: data.address_data.port,
|
||||
|
||||
Reference in New Issue
Block a user