libsubconverter/models/
mod.rs

1//! Core data models for the application
2//!
3//! This module contains the primary data structures used throughout the application,
4//! separated from the logic that operates on them.
5//!
6//! # Usage
7//!
8//! Import the models directly from this module:
9//!
10//! ```rust
11//! use subconverter_rs::models::{Proxy, ProxyType};
12//!
13//! // Create a new proxy
14//! let mut proxy = Proxy::default();
15//! proxy.proxy_type = ProxyType::VMess;
16//! proxy.hostname = "example.com".to_string();
17//! proxy.port = 443;
18//! ```
19//!
20//! Or use the re-exports from the crate root:
21//!
22//! ```rust
23//! use subconverter_rs::{Proxy, ProxyType};
24//!
25//! // Create a new proxy
26//! let mut proxy = Proxy::default();
27//! proxy.proxy_type = ProxyType::VMess;
28//! ```
29//!
30//! # Working with Option fields
31//!
32//! Many fields in the `Proxy` struct are wrapped in `Option`, which requires
33//! special handling:
34//!
35//! ```rust
36//! use subconverter_rs::Proxy;
37//!
38//! let proxy = Proxy::default();
39//!
40//! // Check if an Option<String> field is Some and not empty
41//! if proxy.encrypt_method.as_ref().map_or(false, |s| !s.is_empty()) {
42//!     println!("Encryption method: {}", proxy.encrypt_method.as_ref().unwrap());
43//! }
44//!
45//! // Provide a default value
46//! let method = proxy.encrypt_method.as_deref().unwrap_or("none");
47//! ```
48//!
49//! See the examples directory for more detailed usage examples.
50
51pub mod builder;
52pub mod ciphers;
53pub mod configs;
54pub mod cron;
55pub mod extra_settings;
56pub mod ini_bindings;
57pub mod proxy;
58pub mod proxy_group_config;
59pub mod proxy_node;
60pub mod regex_match_config;
61pub mod ruleset;
62pub mod subconverter_target;
63
64pub use extra_settings::ExtraSettings;
65pub use proxy_group_config::{
66    BalanceStrategy, ProxyGroupConfig, ProxyGroupConfigs, ProxyGroupType,
67};
68pub use regex_match_config::{RegexMatchConfig, RegexMatchConfigs};
69pub use subconverter_target::SubconverterTarget;
70
71pub use proxy::{Proxy, ProxyType};
72pub use ruleset::{RulesetConfig, RulesetContent, RulesetType};
73
74// Re-export constants to module scope for use by other modules
75// Default proxy group names
76pub use ciphers::{SSR_CIPHERS, SS_CIPHERS};
77pub use proxy::{
78    HTTP_DEFAULT_GROUP, HYSTERIA2_DEFAULT_GROUP, HYSTERIA_DEFAULT_GROUP, SNELL_DEFAULT_GROUP,
79    SOCKS_DEFAULT_GROUP, SSR_DEFAULT_GROUP, SS_DEFAULT_GROUP, TROJAN_DEFAULT_GROUP,
80    V2RAY_DEFAULT_GROUP, WG_DEFAULT_GROUP,
81};