mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-15 22:47:52 +00:00
Move config models to src
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
mod parser;
|
||||
use clap::{Parser, Subcommand};
|
||||
use std::path::PathBuf;
|
||||
pub mod config_models;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
@@ -21,6 +22,6 @@ fn main() {
|
||||
}
|
||||
};
|
||||
println!("the uri is: {}", cli.uri);
|
||||
let json_config = parser::create_json_config(&cli.uri);
|
||||
let json_config = parser::create_json_config(&cli.uri, cli.socksport);
|
||||
println!("The json config is: {}" , json_config);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::config_models;
|
||||
use std::process::exit;
|
||||
|
||||
use self::config_models::{Config, Outbound};
|
||||
pub mod config_models;
|
||||
mod uri_identifier;
|
||||
mod vless;
|
||||
|
||||
@@ -11,16 +10,16 @@ pub fn create_json_config(uri: &str, socks_port: Option<u16>) -> String {
|
||||
return serialized;
|
||||
}
|
||||
|
||||
pub fn create_config(uri: &str, socks_port: Option<u16>) -> Config {
|
||||
pub fn create_config(uri: &str, socks_port: Option<u16>) -> config_models::Config {
|
||||
let outbound_object = create_outbound_object(uri);
|
||||
let config = Config {
|
||||
let config = config_models::Config {
|
||||
outbounds: vec![outbound_object],
|
||||
inbounds: None,
|
||||
};
|
||||
return config;
|
||||
}
|
||||
|
||||
pub fn create_outbound_object(uri: &str) -> Outbound {
|
||||
pub fn create_outbound_object(uri: &str) -> config_models::Outbound {
|
||||
let protocol = uri_identifier::get_uri_protocol(uri);
|
||||
match protocol {
|
||||
Some(uri_identifier::Protocols::Vless) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use querystring;
|
||||
mod models;
|
||||
use crate::parser::config_models::*;
|
||||
use crate::config_models::*;
|
||||
use std::process::exit;
|
||||
|
||||
pub fn create_outbound_object(data: models::VlessData) -> Outbound {
|
||||
|
||||
Reference in New Issue
Block a user