mirror of https://github.com/by-sonic/tglock.git
Validate bind address in CLI
Added validation for bind address in main function.
This commit is contained in:
parent
1f4133e13c
commit
5a881798fb
|
|
@ -1,4 +1,5 @@
|
|||
use std::sync::atomic::Ordering;
|
||||
use std::net::IpAddr;
|
||||
|
||||
use clap::Parser;
|
||||
use tg_unblock::{bypass, network, ws_proxy};
|
||||
|
|
@ -22,6 +23,12 @@ struct Args {
|
|||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
// Validate bind address early
|
||||
if args.bind.parse::<IpAddr>().is_err() {
|
||||
eprintln!("[!] Неверный адрес привязки: {}", args.bind);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
let is_admin = bypass::check_admin();
|
||||
let mut dns_was_set = false;
|
||||
let mut adapter_name: Option<String> = None;
|
||||
|
|
|
|||
Loading…
Reference in New Issue