Skip to content

Commit ee77dcb

Browse files
committed
chore: optimize scan ips and read its options from conf for searching famouse sites frontend
1 parent 11297d2 commit ee77dcb

4 files changed

Lines changed: 378 additions & 36 deletions

File tree

config.example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"mode": "apps_script",
33
"google_ip": "216.239.38.120",
44
"front_domain": "www.google.com",
5-
"script_id": "YOUR_APPS_SCRIPT_DEPLOYMENT_ID",
6-
"auth_key": "CHANGE_ME_TO_A_STRONG_SECRET",
5+
"script_id": "YOUR_APPsadasdasS_SCRIPT_DEPLOYMENT_ID",
6+
"auth_key": "dasdsad",
77
"listen_host": "127.0.0.1",
88
"listen_port": 8085,
99
"socks5_port": 8086,

src/bin/ui.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ struct FormState {
131131
sni_custom_input: String,
132132
/// Whether the floating SNI editor window is open.
133133
sni_editor_open: bool,
134+
fetch_ips_from_api: bool,
135+
max_ips_to_scan: usize,
134136
}
135137

136138
#[derive(Clone, Debug)]
@@ -176,6 +178,8 @@ fn load_form() -> FormState {
176178
sni_pool,
177179
sni_custom_input: String::new(),
178180
sni_editor_open: false,
181+
fetch_ips_from_api:c.fetch_ips_from_api,
182+
max_ips_to_scan:c.max_ips_to_scan,
179183
}
180184
} else {
181185
FormState {
@@ -194,6 +198,8 @@ fn load_form() -> FormState {
194198
sni_pool: sni_pool_for_form(None, "www.google.com"),
195199
sni_custom_input: String::new(),
196200
sni_editor_open: false,
201+
fetch_ips_from_api:false,
202+
max_ips_to_scan:100,
197203
}
198204
}
199205
}
@@ -298,6 +304,8 @@ impl FormState {
298304
// on an empty pool.
299305
if active.is_empty() { None } else { Some(active) }
300306
},
307+
fetch_ips_from_api:false,
308+
max_ips_to_scan: 100,
301309
})
302310
}
303311
}

src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,17 @@ pub struct Config {
8080
/// various times). Can be tested per-name via the UI or `mhrv-rs test-sni`.
8181
#[serde(default)]
8282
pub sni_hosts: Option<Vec<String>>,
83+
#[serde(default = "default_fetch_ips_from_api")]
84+
pub fetch_ips_from_api: bool,
85+
86+
#[serde(default = "default_max_ips_to_scan")]
87+
pub max_ips_to_scan: usize,
8388
}
8489

90+
fn default_fetch_ips_from_api() -> bool { false }
91+
fn default_max_ips_to_scan() -> usize { 100 }
92+
93+
8594
fn default_google_ip() -> String {
8695
"216.239.38.120".into()
8796
}

0 commit comments

Comments
 (0)