mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-16 15:07:53 +00:00
Add inbound config strcutures
This commit is contained in:
@@ -108,7 +108,33 @@ pub struct Outbound {
|
|||||||
pub tag: String,
|
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<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,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub outbounds: Vec<Outbound>,
|
pub outbounds: Vec<Outbound>,
|
||||||
|
pub inbounds: Option<Vec<Inbound>>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,17 @@ pub mod config_models;
|
|||||||
mod uri_identifier;
|
mod uri_identifier;
|
||||||
mod vless;
|
mod vless;
|
||||||
|
|
||||||
pub fn create_json_config(uri: &str) -> String {
|
pub fn create_json_config(uri: &str, socks_port: Option<u16>) -> String {
|
||||||
let config = create_config(uri);
|
let config = create_config(uri, socks_port);
|
||||||
let serialized = serde_json::to_string(&config).unwrap();
|
let serialized = serde_json::to_string(&config).unwrap();
|
||||||
return serialized;
|
return serialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_config(uri: &str) -> Config {
|
pub fn create_config(uri: &str, socks_port: Option<u16>) -> Config {
|
||||||
let outbound_object = create_outbound_object(uri);
|
let outbound_object = create_outbound_object(uri);
|
||||||
let config = Config {
|
let config = Config {
|
||||||
outbounds: vec![outbound_object],
|
outbounds: vec![outbound_object],
|
||||||
|
inbounds: None,
|
||||||
};
|
};
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user