I hate this, i don't know
This commit is contained in:
parent
5f7e3081e0
commit
8483d6ee01
42
src/app.rs
42
src/app.rs
|
@ -13,7 +13,7 @@ pub struct TemplateApp {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
value: f32,
|
value: f32,
|
||||||
}
|
}
|
||||||
#[derive(serde::Deserialize, serde::Serialize)]
|
#[derive(serde::Deserialize, serde::Serialize, Clone)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct SshDeets {
|
pub struct SshDeets {
|
||||||
pub dns: bool,
|
pub dns: bool,
|
||||||
|
@ -52,7 +52,7 @@ impl SshDeets {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
pub fn concat(self, connect: bool) -> Vec<String> {
|
pub fn concat(&self, connect: bool) -> Vec<String> {
|
||||||
let mut final_thing: Vec<String> = vec![];
|
let mut final_thing: Vec<String> = vec![];
|
||||||
if connect == false{
|
if connect == false{
|
||||||
if self.dns == true {
|
if self.dns == true {
|
||||||
|
@ -60,7 +60,7 @@ impl SshDeets {
|
||||||
final_thing.push(String::from("-Nr"));
|
final_thing.push(String::from("-Nr"));
|
||||||
final_thing.push(format!("{}:{}", self.user, self.ip));
|
final_thing.push(format!("{}:{}", self.user, self.ip));
|
||||||
final_thing.push(String::from("-x"));
|
final_thing.push(String::from("-x"));
|
||||||
final_thing.push(self.mask);
|
final_thing.push(self.mask.clone());
|
||||||
return final_thing;
|
return final_thing;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -128,36 +128,10 @@ impl eframe::App for TemplateApp {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* egui::SidePanel::left("side_panel").show(ctx, |ui| {
|
|
||||||
ui.heading("Side Panel");
|
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
ui.label("Write something: ");
|
|
||||||
ui.text_edit_singleline(label);
|
|
||||||
});
|
|
||||||
|
|
||||||
ui.add(egui::Slider::new(value, 0.0..=10.0).text("value"));
|
|
||||||
if ui.button("Increment").clicked() {
|
|
||||||
*value += 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
ui.spacing_mut().item_spacing.x = 0.0;
|
|
||||||
ui.label("powered by ");
|
|
||||||
ui.hyperlink_to("egui", "https://github.com/emilk/egui");
|
|
||||||
ui.label(" and ");
|
|
||||||
ui.hyperlink_to(
|
|
||||||
"eframe",
|
|
||||||
"https://github.com/emilk/egui/tree/master/crates/eframe",
|
|
||||||
);
|
|
||||||
ui.label(".");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}); */
|
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
// The central panel the region left after adding TopPanel's and SidePanel's
|
// The central panel the region left after adding TopPanel's and SidePanel's
|
||||||
|
let mut outout = String::new();
|
||||||
ui.label("put your linux ssh username, ip, and port (does not have to be root)");
|
ui.label("put your linux ssh username, ip, and port (does not have to be root)");
|
||||||
ui.text_edit_singleline(&mut deets.user);
|
ui.text_edit_singleline(&mut deets.user);
|
||||||
ui.text_edit_singleline(&mut deets.ip);
|
ui.text_edit_singleline(&mut deets.ip);
|
||||||
|
@ -170,7 +144,7 @@ impl eframe::App for TemplateApp {
|
||||||
ui.text_edit_singleline(&mut deets.mask);
|
ui.text_edit_singleline(&mut deets.mask);
|
||||||
|
|
||||||
if ui.button("connect").clicked() {
|
if ui.button("connect").clicked() {
|
||||||
//connect_ssh(false, *deets);
|
connect_ssh(false, &*deets);
|
||||||
}
|
}
|
||||||
/* ui.heading("eframe template");
|
/* ui.heading("eframe template");
|
||||||
ui.hyperlink("https://github.com/emilk/eframe_template");
|
ui.hyperlink("https://github.com/emilk/eframe_template");
|
||||||
|
@ -178,6 +152,10 @@ impl eframe::App for TemplateApp {
|
||||||
"https://github.com/emilk/eframe_template/blob/master/",
|
"https://github.com/emilk/eframe_template/blob/master/",
|
||||||
"Source code."
|
"Source code."
|
||||||
)); */
|
)); */
|
||||||
|
egui::SidePanel::right("side_panel").show(ctx, |ui| {
|
||||||
|
ui.add(egui::widgets::Label::new("This will be for stdout eventually".to_owned()));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
egui::warn_if_debug_build(ui);
|
egui::warn_if_debug_build(ui);
|
||||||
});
|
});
|
||||||
|
|
15
src/lib.rs
15
src/lib.rs
|
@ -1,18 +1,21 @@
|
||||||
#![warn(clippy::all, rust_2018_idioms)]
|
#![warn(clippy::all, rust_2018_idioms)]
|
||||||
|
|
||||||
use std::process::{ExitStatus, Command};
|
use std::process::{ExitStatus, Command, Stdio};
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
pub use app::TemplateApp;
|
pub use app::TemplateApp;
|
||||||
pub use app::SshDeets;
|
pub use app::SshDeets;
|
||||||
|
|
||||||
pub fn connect_ssh(connect: bool, structure: SshDeets) -> Result<(), ExitStatus>{
|
pub fn connect_ssh(connect: bool, structure: &SshDeets) -> Result<String, ExitStatus>{
|
||||||
let argss = structure.concat(connect);
|
let argss = structure.concat(connect);
|
||||||
|
let mut stdout = String::new();
|
||||||
if connect == false{
|
if connect == false{
|
||||||
Command::new("sshuttle")
|
let skrunk = Command::new("sshuttle")
|
||||||
.args(argss)
|
.args(argss)
|
||||||
.spawn()
|
//.spawn()
|
||||||
.expect("FUCK");
|
.stdout(Stdio::piped())
|
||||||
|
.output().unwrap();
|
||||||
|
let stdout = String::from_utf8(skrunk.stdout).unwrap();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(stdout)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue