mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-13 17:35:37 +00:00
use winapi to config ip and route (remove dep on netsh) (#1079)
On some windows machines can not execut netsh. Also this avoid black cmd window when using gui.
This commit is contained in:
@@ -3,6 +3,8 @@ mod darwin;
|
||||
#[cfg(any(target_os = "linux"))]
|
||||
mod netlink;
|
||||
#[cfg(target_os = "windows")]
|
||||
mod win;
|
||||
#[cfg(target_os = "windows")]
|
||||
mod windows;
|
||||
|
||||
mod route;
|
||||
@@ -10,6 +12,7 @@ mod route;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use cidr::{Ipv4Inet, Ipv6Inet};
|
||||
use tokio::process::Command;
|
||||
|
||||
use super::error::Error;
|
||||
@@ -69,10 +72,10 @@ pub trait IfConfiguerTrait: Send + Sync {
|
||||
async fn set_link_status(&self, _name: &str, _up: bool) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn remove_ip(&self, _name: &str, _ip: Option<Ipv4Addr>) -> Result<(), Error> {
|
||||
async fn remove_ip(&self, _name: &str, _ip: Option<Ipv4Inet>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn remove_ipv6(&self, _name: &str, _ip: Option<Ipv6Addr>) -> Result<(), Error> {
|
||||
async fn remove_ipv6(&self, _name: &str, _ip: Option<Ipv6Inet>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn wait_interface_show(&self, _name: &str) -> Result<(), Error> {
|
||||
|
||||
Reference in New Issue
Block a user