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;
|
//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");
|
let config: ClientConfiguration = serde_yaml::from_str(cfg_raw).expect("Bad client config file structure");
|
||||||
//client::client_mode(config, s_interface).await;
|
//client::client_mode(config, s_interface).await;
|
||||||
let client = DesktopClient{client_config: config, s_interface};
|
let client = DesktopClient{client_config: config};
|
||||||
client.start().await;
|
client.start().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ async fn main() {
|
|||||||
|
|
||||||
match mode {
|
match mode {
|
||||||
"server" => init_server(cfg_raw, matches.value_of("interface")).await,
|
"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),
|
"new_peer" => generate_peer_config(&matches, config_path, cfg_raw),
|
||||||
_ => error!("There is config file already")
|
_ => error!("There is config file already")
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ pub mod desktop {
|
|||||||
|
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[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 interfaces = NetworkInterface::show().unwrap();
|
||||||
|
|
||||||
let net_inter = interfaces.iter()
|
let net_inter = interfaces.iter()
|
||||||
@ -213,7 +213,9 @@ pub mod desktop {
|
|||||||
.min_by(|x, y| x.index.cmp(&y.index))
|
.min_by(|x, y| x.index.cmp(&y.index))
|
||||||
.unwrap();
|
.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);
|
info!("Main network interface: {:?}", inter_name);
|
||||||
|
|
||||||
@ -281,13 +283,11 @@ pub mod desktop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct DesktopClient {
|
pub struct DesktopClient {
|
||||||
pub client_config: ClientConfiguration,
|
pub client_config: ClientConfiguration
|
||||||
pub s_interface: Option<String>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VpnClient for DesktopClient {
|
impl VpnClient for DesktopClient {
|
||||||
async fn start(&self) {
|
async fn start(&self) {
|
||||||
info!("s_interface: {:?}", &self.s_interface);
|
|
||||||
info!("client_address: {:?}", &self.client_config.client.address);
|
info!("client_address: {:?}", &self.client_config.client.address);
|
||||||
let mut config = AbstractDevice::default();
|
let mut config = AbstractDevice::default();
|
||||||
let mtu: u16 = 1400;
|
let mtu: u16 = 1400;
|
||||||
@ -309,7 +309,7 @@ pub mod desktop {
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
let s_a: std::net::SocketAddr = self.client_config.server.endpoint.parse().unwrap();
|
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;
|
client.start(sock, dev_reader, dev_writer, mtu).await;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user