2023-10-17 18:42:18 +03:30
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct VlessUser {
|
|
|
|
|
pub id: String,
|
|
|
|
|
pub encryption: String,
|
2025-07-26 13:46:08 +03:30
|
|
|
pub flow: Option<String>,
|
|
|
|
|
pub level: Option<u8>,
|
2023-10-17 18:42:18 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[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)]
|
2023-10-19 19:00:25 +03:30
|
|
|
#[serde(untagged)]
|
2023-10-17 18:42:18 +03:30
|
|
|
pub enum OutboundSettings {
|
|
|
|
|
Vless(VlessOutboundSettings),
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 11:53:28 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct NonHeaderObject {
|
2025-07-26 13:46:08 +03:30
|
|
|
pub r#type: Option<String>,
|
2023-10-19 11:53:28 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-23 19:13:16 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct QuicSettings {
|
|
|
|
|
pub header: Option<NonHeaderObject>,
|
2025-07-26 13:46:08 +03:30
|
|
|
pub security: Option<String>,
|
|
|
|
|
pub key: Option<String>,
|
2023-10-23 19:13:16 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-21 11:42:12 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct GRPCSettings {
|
2025-07-26 13:46:08 +03:30
|
|
|
pub authority: Option<String>,
|
|
|
|
|
pub multiMode: Option<bool>,
|
|
|
|
|
pub serviceName: Option<String>,
|
2023-10-21 11:42:12 +03:30
|
|
|
}
|
|
|
|
|
|
2025-07-26 16:08:27 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct KCPSettings {
|
|
|
|
|
pub mtu: Option<u32>,
|
|
|
|
|
pub tti: Option<u32>,
|
|
|
|
|
pub uplinkCapacity: Option<u32>,
|
|
|
|
|
pub downlinkCapacity: Option<u32>,
|
|
|
|
|
pub congestion: Option<bool>,
|
|
|
|
|
pub readBufferSize: Option<u32>,
|
|
|
|
|
pub writeBufferSize: Option<u32>,
|
|
|
|
|
pub seed: Option<String>,
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-26 16:32:53 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct XHTTPSettings {
|
|
|
|
|
pub host: Option<String>,
|
|
|
|
|
pub path: Option<String>,
|
|
|
|
|
pub mode: Option<String>,
|
|
|
|
|
pub extra: Option<serde_json::Value>,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 15:26:41 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct RealitySettings {
|
2025-07-26 13:46:08 +03:30
|
|
|
pub fingerprint: Option<String>,
|
|
|
|
|
pub serverName: Option<String>,
|
|
|
|
|
pub publicKey: Option<String>,
|
|
|
|
|
pub shortId: Option<String>,
|
|
|
|
|
pub spiderX: Option<String>,
|
2023-10-19 15:26:41 +03:30
|
|
|
}
|
|
|
|
|
|
2025-07-23 21:00:07 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct TCPHeader {
|
2025-07-26 13:46:08 +03:30
|
|
|
pub r#type: Option<String>,
|
2025-07-23 21:00:07 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-19 11:53:28 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct TCPSettings {
|
2025-07-23 21:00:07 +03:30
|
|
|
pub header: Option<TCPHeader>,
|
2023-10-19 11:57:44 +03:30
|
|
|
pub acceptProxyProtocol: Option<bool>,
|
2023-10-19 11:53:28 +03:30
|
|
|
}
|
|
|
|
|
|
2025-06-23 12:25:27 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct HeaderSetting {
|
|
|
|
|
pub Host: Option<String>,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 11:53:28 +03:30
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct WsSettings {
|
|
|
|
|
pub path: Option<String>,
|
2025-07-26 12:14:39 +03:30
|
|
|
pub Host: Option<String>,
|
2023-10-19 11:53:28 +03:30
|
|
|
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 {
|
2025-07-26 11:58:01 +03:30
|
|
|
pub alpn: Option<Vec<String>>,
|
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 {
|
2025-07-26 13:46:08 +03:30
|
|
|
pub network: Option<String>,
|
|
|
|
|
pub security: Option<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-21 11:42:12 +03:30
|
|
|
pub grpcSettings: Option<GRPCSettings>,
|
2023-10-23 19:13:16 +03:30
|
|
|
pub quicSettings: Option<QuicSettings>,
|
2025-07-26 16:08:27 +03:30
|
|
|
pub kcpSettings: Option<KCPSettings>,
|
2025-07-26 16:32:53 +03:30
|
|
|
pub xhttpSettings: Option<XHTTPSettings>,
|
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,
|
|
|
|
|
}
|
2023-10-26 17:31:33 +03:30
|
|
|
|
2023-11-07 16:29:53 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct InboundSettings {
|
|
|
|
|
pub udp: bool,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
|
pub struct SniffingSettings {
|
|
|
|
|
pub enabled: Option<bool>,
|
|
|
|
|
pub destOverride: Option<Vec<String>>,
|
|
|
|
|
pub domainsExcluded: Option<Vec<String>>,
|
|
|
|
|
pub metadataOnly: Option<bool>,
|
|
|
|
|
pub routeOnly: Option<bool>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct Inbound {
|
|
|
|
|
pub listen: String,
|
|
|
|
|
pub port: u16,
|
|
|
|
|
pub protocol: String,
|
|
|
|
|
pub settings: InboundSettings,
|
|
|
|
|
pub sniffing: Option<SniffingSettings>,
|
|
|
|
|
pub tag: String,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-26 17:31:33 +03:30
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
|
pub struct Config {
|
|
|
|
|
pub outbounds: Vec<Outbound>,
|
2023-11-08 19:51:21 +03:30
|
|
|
pub inbounds: Vec<Inbound>,
|
2023-10-26 17:31:33 +03:30
|
|
|
}
|