2023-10-17 18:42:18 +03:30
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct VlessUser {
|
|
|
|
|
pub id: String,
|
|
|
|
|
pub encryption: String,
|
|
|
|
|
pub flow: String,
|
|
|
|
|
pub level: u8,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct VlessServerObject {
|
|
|
|
|
pub address: String,
|
|
|
|
|
pub port: u16,
|
|
|
|
|
pub users: Vec<VlessUser>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct VlessOutboundSettings {
|
|
|
|
|
pub vnext: Vec<VlessServerObject>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub enum OutboundSettings {
|
|
|
|
|
Vless(VlessOutboundSettings),
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 11:53:28 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct NonHeaderObject {
|
|
|
|
|
pub r#type: String,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 15:26:41 +03:30
|
|
|
#[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,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 11:53:28 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct TCPSettings {
|
2023-10-19 11:57:44 +03:30
|
|
|
pub header: Option<NonHeaderObject>,
|
|
|
|
|
pub acceptProxyProtocol: Option<bool>,
|
2023-10-19 11:53:28 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct WsSettings {
|
|
|
|
|
pub path: Option<String>,
|
|
|
|
|
// Headers map[string]string headers
|
|
|
|
|
pub acceptProxyProtocol: Option<bool>,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-17 18:42:18 +03:30
|
|
|
#[allow(non_snake_case)]
|
2023-10-19 10:04:12 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
2023-10-17 18:42:18 +03:30
|
|
|
pub struct TlsSettings {
|
2023-10-19 10:04:12 +03:30
|
|
|
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>,
|
2023-10-17 18:42:18 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_snake_case)]
|
2023-10-19 10:04:12 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
2023-10-17 18:42:18 +03:30
|
|
|
pub struct StreamSettings {
|
|
|
|
|
pub network: String,
|
|
|
|
|
pub security: String,
|
2023-10-19 10:04:12 +03:30
|
|
|
pub tlsSettings: Option<TlsSettings>,
|
2023-10-19 11:53:28 +03:30
|
|
|
pub wsSettings: Option<WsSettings>,
|
2023-10-19 11:57:44 +03:30
|
|
|
pub tcpSettings: Option<TCPSettings>,
|
2023-10-19 15:26:41 +03:30
|
|
|
pub realitySettings: Option<RealitySettings>,
|
2023-10-17 18:42:18 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-19 10:04:12 +03:30
|
|
|
#[allow(non_snake_case)]
|
2023-10-17 18:42:18 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct Outbound {
|
|
|
|
|
pub settings: OutboundSettings,
|
2023-10-19 10:04:12 +03:30
|
|
|
pub streamSettings: StreamSettings,
|
2023-10-17 18:42:18 +03:30
|
|
|
pub protocol: String,
|
|
|
|
|
pub tag: String,
|
|
|
|
|
}
|