1mod api;
2pub mod emit;
3mod error;
4pub mod formats;
5pub mod ir;
6mod merge;
7pub mod parse;
8pub mod template;
9
10pub use api::{InputFormat, InputItem, OutputFormat, convert, detect_format};
11pub use error::{Error, Result};
12
13#[cfg(test)]
14mod tests {
15 use crate::{
16 formats::{ClashConfig, SingBoxConfig},
17 template::Template,
18 };
19
20 use super::*;
21
22 #[test]
23 fn smoke_uri_to_clash_and_singbox() {
24 let uris = "trojan://pwd@a.com:443#A\nss://YWVzLTI1Ni1nY206cGFzczpQM0UjQCM=@b.com:123#B";
25 let inputs = vec![InputItem {
26 format: InputFormat::UriList,
27 content: uris.to_string(),
28 }];
29 let template = Template::ClashYaml(ClashConfig::default());
30 let clash = convert(inputs.clone(), template).expect("clash output");
31 assert!(clash.contains("proxies"));
32
33 let template = Template::SingBoxJson(SingBoxConfig::default());
34 let sb = convert(inputs, template).expect("sb output");
35 assert!(sb.contains("outbounds"));
36 }
37}