mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 02:52:07 +08:00
refactor: remove port_scanner dependency and simplify port checking logic
This commit is contained in:
@@ -99,8 +99,5 @@ pub fn get_network_interfaces_info() -> CmdResult<Vec<NetworkInterface>> {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn is_port_in_use(port: u16) -> bool {
|
||||
match TcpListener::bind(("127.0.0.1", port)) {
|
||||
Ok(_listener) => false,
|
||||
Err(_) => true,
|
||||
}
|
||||
TcpListener::bind(("127.0.0.1", port)).is_err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user