modified: frida_cli/src/main.rs
modified: frida_client/src/client.rs
This commit is contained in:
parent
d121cd42d7
commit
d7d3531dc0
@ -61,10 +61,10 @@ async fn init_server(cfg_raw: &str, s_interface: Option<&str>) {
|
||||
//server::server_mode(config, s_interface).await;
|
||||
}
|
||||
|
||||
async fn init_client(cfg_raw: &str, s_interface: Option<String>) {
|
||||
async fn init_client(cfg_raw: &str) {
|
||||
let config: ClientConfiguration = serde_yaml::from_str(cfg_raw).expect("Bad client config file structure");
|
||||
//client::client_mode(config, s_interface).await;
|
||||
let client = DesktopClient{client_config: config, s_interface};
|
||||
let client = DesktopClient{client_config: config};
|
||||
client.start().await;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ async fn main() {
|
||||
|
||||
match mode {
|
||||
"server" => init_server(cfg_raw, matches.value_of("interface")).await,
|
||||
"client" => init_client(cfg_raw, matches.value_of("interface").map_or(None, |x| Some(String::from(x)))).await,
|
||||
"client" => init_client(cfg_raw),
|
||||
"new_peer" => generate_peer_config(&matches, config_path, cfg_raw),
|
||||
_ => error!("There is config file already")
|
||||
}
|
||||
|
@ -205,15 +205,17 @@ pub mod desktop {
|
||||
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn configure_routes(endpoint_ip: &str, s_interface: Option<String>) {
|
||||
fn configure_routes(endpoint_ip: &str) {
|
||||
let interfaces = NetworkInterface::show().unwrap();
|
||||
|
||||
let net_inter = interfaces.iter()
|
||||
.filter(|i| !i.addr.iter().any(|b| b.ip().to_string() == "127.0.0.1" || b.ip().to_string() == "::1") )
|
||||
.min_by(|x, y| x.index.cmp(&y.index))
|
||||
.unwrap();
|
||||
|
||||
let inter_name = if s_interface.is_some() { s_interface.unwrap() } else { net_inter.name.clone() };
|
||||
|
||||
info!("Main interface: {:?}", net_inter);
|
||||
|
||||
let inter_name = net_inter.name.clone();
|
||||
|
||||
info!("Main network interface: {:?}", inter_name);
|
||||
|
||||
@ -281,13 +283,11 @@ pub mod desktop {
|
||||
}
|
||||
|
||||
pub struct DesktopClient {
|
||||
pub client_config: ClientConfiguration,
|
||||
pub s_interface: Option<String>
|
||||
pub client_config: ClientConfiguration
|
||||
}
|
||||
|
||||
impl VpnClient for DesktopClient {
|
||||
async fn start(&self) {
|
||||
info!("s_interface: {:?}", &self.s_interface);
|
||||
info!("client_address: {:?}", &self.client_config.client.address);
|
||||
let mut config = AbstractDevice::default();
|
||||
let mtu: u16 = 1400;
|
||||
@ -309,7 +309,7 @@ pub mod desktop {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let s_a: std::net::SocketAddr = self.client_config.server.endpoint.parse().unwrap();
|
||||
configure_routes(&s_a.ip().to_string(), self.s_interface.clone());
|
||||
configure_routes(&s_a.ip().to_string());
|
||||
}
|
||||
|
||||
client.start(sock, dev_reader, dev_writer, mtu).await;
|
||||
|
Loading…
x
Reference in New Issue
Block a user