diff --git a/src/parser/config_models/mod.rs b/src/parser/config_models/mod.rs index 8d43b81..2806176 100644 --- a/src/parser/config_models/mod.rs +++ b/src/parser/config_models/mod.rs @@ -108,7 +108,33 @@ pub struct Outbound { pub tag: String, } +#[derive(Serialize, Deserialize)] +pub struct InboundSettings { + pub udp: bool, +} + +#[derive(Serialize, Deserialize)] +#[allow(non_snake_case)] +pub struct SniffingSettings { + pub enabled: Option, + pub destOverride: Option>, + pub domainsExcluded: Option>, + pub metadataOnly: Option, + pub routeOnly: Option, +} + +#[derive(Serialize, Deserialize)] +pub struct Inbound { + pub listen: String, + pub port: u16, + pub protocol: String, + pub settings: InboundSettings, + pub sniffing: Option, + pub tag: String, +} + #[derive(Serialize, Deserialize)] pub struct Config { pub outbounds: Vec, + pub inbounds: Option>, } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 5815c7f..4e861de 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -5,16 +5,17 @@ pub mod config_models; mod uri_identifier; mod vless; -pub fn create_json_config(uri: &str) -> String { - let config = create_config(uri); +pub fn create_json_config(uri: &str, socks_port: Option) -> String { + let config = create_config(uri, socks_port); let serialized = serde_json::to_string(&config).unwrap(); return serialized; } -pub fn create_config(uri: &str) -> Config { +pub fn create_config(uri: &str, socks_port: Option) -> Config { let outbound_object = create_outbound_object(uri); let config = Config { outbounds: vec![outbound_object], + inbounds: None, }; return config; }