sub_converter/parse/
clash.rs

1use crate::error::{Error, Result};
2use crate::formats::ClashConfig;
3use crate::ir::Node;
4
5pub struct ClashParser;
6
7impl super::Parser for ClashParser {
8    fn parse(&self, input: &str) -> Result<Vec<Node>> {
9        let cfg: ClashConfig = serde_yaml::from_str(input).map_err(|e| Error::ParseError {
10            detail: format!("clash yaml: {e}"),
11        })?;
12        Ok(cfg.proxies.into_iter().map(Into::into).collect())
13    }
14}