rename NSCConfig to Config for now :1
This commit is contained in:
parent
2a01827e6c
commit
1b6a2f126a
2 changed files with 11 additions and 11 deletions
|
|
@ -8,7 +8,7 @@ pub enum RunTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct NSCConfig {
|
pub struct Config {
|
||||||
/// Paths to v2ray `geosite.dat', `geoip.dat`
|
/// Paths to v2ray `geosite.dat', `geoip.dat`
|
||||||
pub geo_files: [String; 2],
|
pub geo_files: [String; 2],
|
||||||
/// Routing settings similar to v2ray
|
/// Routing settings similar to v2ray
|
||||||
|
|
@ -17,7 +17,7 @@ pub struct NSCConfig {
|
||||||
pub mode: RunTypes,
|
pub mode: RunTypes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NSCConfig {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
geo_files: [
|
geo_files: [
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use ipnet::IpNet;
|
use ipnet::IpNet;
|
||||||
use crate::config::NSCConfig;
|
use crate::config::Config;
|
||||||
|
|
||||||
/// Enum for declaring GeoSite/IP routing
|
/// Enum for declaring GeoSite/IP routing
|
||||||
pub enum RouteType {
|
pub enum RouteType {
|
||||||
/// GeoSite MMDB type, like `category-ads-all`
|
/// GeoSite MMDB type, like `category-ads-all`
|
||||||
GeoSite(String),
|
GeoSite(String),
|
||||||
/// Subnet
|
/// Subnet
|
||||||
GeoIp(IpNet),
|
GeoIp(IpNet),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Routing actions
|
/// Routing actions
|
||||||
|
|
@ -18,15 +18,15 @@ pub enum RouteAction {
|
||||||
|
|
||||||
type Rules = Vec<Rule>;
|
type Rules = Vec<Rule>;
|
||||||
|
|
||||||
/// Type for declaring the routing rules like:
|
/// Type for declaring the routing rules like:
|
||||||
/// ```toml
|
/// ```toml
|
||||||
/// [rule]
|
/// [rule]
|
||||||
/// action = enum RouteAction
|
/// action = enum RouteAction
|
||||||
/// target = enum RouteType
|
/// target = enum RouteType
|
||||||
///
|
///
|
||||||
/// [rule]
|
/// [rule]
|
||||||
/// target = "geosite:category-ads-all"
|
/// target = "geosite:category-ads-all"
|
||||||
/// action = "block"
|
/// action = "block"
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Rule {
|
pub struct Rule {
|
||||||
pub target: RouteType,
|
pub target: RouteType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue