sub_converter/parse/
sing_box.rs

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