Struct Settings

Source
pub struct Settings {
Show 84 fields pub pref_path: String, pub default_ext_config: String, pub exclude_remarks: Vec<String>, pub include_remarks: Vec<String>, pub custom_rulesets: Vec<RulesetConfig>, pub custom_proxy_groups: Vec<ProxyGroupConfig>, pub rulesets_content: Vec<RulesetContent>, pub stream_rules: Vec<RegexMatchConfig>, pub time_rules: Vec<RegexMatchConfig>, pub renames: RegexMatchConfigs, pub emojis: RegexMatchConfigs, pub default_urls: Vec<String>, pub insert_urls: Vec<String>, pub managed_config_prefix: String, pub max_pending_conns: u32, pub max_concur_threads: u32, pub prepend_insert: bool, pub skip_failed_links: bool, pub api_mode: bool, pub write_managed_config: bool, pub enable_rule_gen: bool, pub update_ruleset_on_request: bool, pub overwrite_original_rules: bool, pub append_userinfo: bool, pub async_fetch_ruleset: bool, pub surge_resolve_hostname: bool, pub api_access_token: String, pub base_path: String, pub custom_group: String, pub log_level: u32, pub max_allowed_download_size: i64, pub template_path: String, pub template_vars: HashMap<String, String>, pub prepend_proxy_direct_ruleset: bool, pub aliases: HashMap<String, String>, pub generator_mode: bool, pub generate_profiles: String, pub reload_conf_on_request: bool, pub add_emoji: bool, pub remove_emoji: bool, pub append_type: bool, pub filter_deprecated: bool, pub udp_flag: Option<bool>, pub tfo_flag: Option<bool>, pub skip_cert_verify: Option<bool>, pub tls13_flag: Option<bool>, pub enable_insert: bool, pub enable_sort: bool, pub update_strict: bool, pub clash_use_new_field: bool, pub singbox_add_clash_modes: bool, pub clash_proxies_style: String, pub clash_proxy_groups_style: String, pub proxy_config: String, pub proxy_ruleset: String, pub proxy_subscription: String, pub update_interval: u32, pub sort_script: String, pub filter_script: String, pub enable_filter: bool, pub clash_base: String, pub surge_base: String, pub surfboard_base: String, pub mellow_base: String, pub quan_base: String, pub quanx_base: String, pub loon_base: String, pub ssub_base: String, pub singbox_base: String, pub surge_ssr_path: String, pub quanx_dev_id: String, pub serve_cache_on_fetch_fail: bool, pub cache_subscription: u32, pub cache_config: u32, pub cache_ruleset: u32, pub listen_address: String, pub listen_port: u32, pub serve_file: bool, pub serve_file_root: String, pub max_allowed_rulesets: usize, pub max_allowed_rules: usize, pub script_clean_context: bool, pub enable_cron: bool, pub cron_tasks: CronTaskConfigs,
}
Expand description

Settings structure to hold global configuration

Fields§

§pref_path: String§default_ext_config: String§exclude_remarks: Vec<String>§include_remarks: Vec<String>§custom_rulesets: Vec<RulesetConfig>§custom_proxy_groups: Vec<ProxyGroupConfig>§rulesets_content: Vec<RulesetContent>§stream_rules: Vec<RegexMatchConfig>§time_rules: Vec<RegexMatchConfig>§renames: RegexMatchConfigs§emojis: RegexMatchConfigs§default_urls: Vec<String>§insert_urls: Vec<String>§managed_config_prefix: String§max_pending_conns: u32§max_concur_threads: u32§prepend_insert: bool§skip_failed_links: bool§api_mode: bool§write_managed_config: bool§enable_rule_gen: bool§update_ruleset_on_request: bool§overwrite_original_rules: bool§append_userinfo: bool§async_fetch_ruleset: bool§surge_resolve_hostname: bool§api_access_token: String§base_path: String§custom_group: String§log_level: u32§max_allowed_download_size: i64§template_path: String§template_vars: HashMap<String, String>

Template variables used for template rendering

§prepend_proxy_direct_ruleset: bool§aliases: HashMap<String, String>§generator_mode: bool§generate_profiles: String§reload_conf_on_request: bool§add_emoji: bool§remove_emoji: bool§append_type: bool§filter_deprecated: bool§udp_flag: Option<bool>§tfo_flag: Option<bool>§skip_cert_verify: Option<bool>§tls13_flag: Option<bool>§enable_insert: bool§enable_sort: bool§update_strict: bool§clash_use_new_field: bool§singbox_add_clash_modes: bool§clash_proxies_style: String§clash_proxy_groups_style: String§proxy_config: String§proxy_ruleset: String§proxy_subscription: String§update_interval: u32§sort_script: String§filter_script: String§enable_filter: bool§clash_base: String§surge_base: String§surfboard_base: String§mellow_base: String§quan_base: String§quanx_base: String§loon_base: String§ssub_base: String§singbox_base: String§surge_ssr_path: String§quanx_dev_id: String§serve_cache_on_fetch_fail: bool§cache_subscription: u32§cache_config: u32§cache_ruleset: u32§listen_address: String§listen_port: u32§serve_file: bool§serve_file_root: String§max_allowed_rulesets: usize§max_allowed_rules: usize§script_clean_context: bool§enable_cron: bool§cron_tasks: CronTaskConfigs

Implementations§

Source§

impl Settings

Source

pub fn new() -> Self

Create a new settings instance with default values

Source

pub fn current_mut() -> RwLockWriteGuard<'static, Arc<Settings>>

Get a mutable reference to the current settings

Source

pub fn current() -> RwLockReadGuard<'static, Arc<Settings>>

Get a read-only reference to the current settings

Source

pub async fn load_from_content( content: &str, file_path: &str, ) -> Result<Self, Box<dyn Error>>

Source

pub async fn load_from_file(path: &str) -> Result<Self, Box<dyn Error>>

Load settings from file or URL asynchronously

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Settings

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Settings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Settings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<IniSettings> for Settings

Source§

fn from(ini_settings: IniSettings) -> Self

Converts to this type from the input type.
Source§

impl From<TomlSettings> for Settings

Source§

fn from(toml_settings: TomlSettings) -> Self

Converts to this type from the input type.
Source§

impl From<YamlSettings> for Settings

Source§

fn from(yaml_settings: YamlSettings) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T