refactor(fakedns): FakeIPServer.get(domain) now returns Option<IpAddr>; cleaned unused deps
This commit is contained in:
parent
7954859517
commit
bb417b8a6d
6 changed files with 52 additions and 29 deletions
|
|
@ -1,10 +1,25 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
pub enum RunTypes {
|
||||
#[default]
|
||||
Tor,
|
||||
I2P,
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum KillSwitchPolicy {
|
||||
#[serde(alias = "allow-proxy")]
|
||||
AllowProxies,
|
||||
#[serde(alias = "full")]
|
||||
Strict,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum ClearnetPolicy {
|
||||
#[serde(alias = "killswitched")]
|
||||
Killwitched,
|
||||
#[serde(alias = "allowed")]
|
||||
Allowed,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Policy {
|
||||
pub clearnet: Option<ClearnetPolicy>,
|
||||
pub killswitch_mode: Option<KillSwitchPolicy>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
@ -13,8 +28,8 @@ pub struct Config {
|
|||
pub geo_files: [String; 2],
|
||||
/// Routing settings similar to v2ray
|
||||
pub routing: String,
|
||||
/// TOR/I2P Proxies
|
||||
pub mode: RunTypes,
|
||||
/// Clearnet routing policies
|
||||
pub policy: Option<Policy>,
|
||||
}
|
||||
|
||||
// TODO: Think how to add other anonymisers
|
||||
|
|
@ -26,16 +41,20 @@ pub struct Config {
|
|||
// addr = "127.0.0.1:10808"
|
||||
// type = "SOCKS5" # ...
|
||||
// ```
|
||||
//
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
geo_files: [
|
||||
String::from("/etc/nsc/data/geolite2.mmdb"),
|
||||
String::from("/etc/nsc/data/geosite.dat"),
|
||||
String::from("/var/nsc/geodata/geolite2.mmdb"),
|
||||
String::from("/var/nsc/geodata/geosite.dat"),
|
||||
],
|
||||
routing: String::from("/etc/nsc/routing.toml"),
|
||||
mode: RunTypes::Tor,
|
||||
policy: Some(Policy {
|
||||
clearnet: Some(ClearnetPolicy::Allowed),
|
||||
killswitch_mode: Some(KillSwitchPolicy::AllowProxies),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue