decent setup
This commit is contained in:
parent
692d9865cd
commit
7da5e13b91
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -470,18 +470,6 @@ dependencies = [
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "eframe_template"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"console_error_panic_hook",
|
|
||||||
"eframe",
|
|
||||||
"egui",
|
|
||||||
"serde",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"tracing-wasm",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "egui"
|
name = "egui"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
|
@ -1422,6 +1410,18 @@ dependencies = [
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sshuttle_gui"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"console_error_panic_hook",
|
||||||
|
"eframe",
|
||||||
|
"egui",
|
||||||
|
"serde",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"tracing-wasm",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "str-buf"
|
name = "str-buf"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "eframe_template"
|
name = "sshuttle_gui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
authors = ["Gallant"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.60"
|
rust-version = "1.60"
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ var cacheName = 'egui-template-pwa';
|
||||||
var filesToCache = [
|
var filesToCache = [
|
||||||
'./',
|
'./',
|
||||||
'./index.html',
|
'./index.html',
|
||||||
'./eframe_template.js',
|
'./sshuttle_gui.js',
|
||||||
'./eframe_template_bg.wasm',
|
'./sshuttle_gui_bg.wasm',
|
||||||
];
|
];
|
||||||
|
|
||||||
/* Start the service worker and cache all of the app's content */
|
/* Start the service worker and cache all of the app's content */
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<!-- change this to your project name -->
|
<!-- change this to your project name -->
|
||||||
<title>eframe template</title>
|
<title>sshuttle_gui</title>
|
||||||
|
|
||||||
<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
|
<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
|
||||||
<link data-trunk rel="rust" data-wasm-opt="2" />
|
<link data-trunk rel="rust" data-wasm-opt="2" />
|
||||||
|
|
66
src/app.rs
66
src/app.rs
|
@ -10,6 +10,64 @@ pub struct TemplateApp {
|
||||||
value: f32,
|
value: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct SshDeets {
|
||||||
|
dns: bool,
|
||||||
|
user: String,
|
||||||
|
ip: String,
|
||||||
|
port: String,
|
||||||
|
mask: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for SshDeets {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
dns: true,
|
||||||
|
user: String::from("No"),
|
||||||
|
ip: String::from("127.0.0.1"),
|
||||||
|
port: String::from("8080"),
|
||||||
|
mask: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SshDeets {
|
||||||
|
pub fn new(self,
|
||||||
|
yeah: bool,
|
||||||
|
username: &str,
|
||||||
|
ip_addy: &str,
|
||||||
|
port_num: &str,
|
||||||
|
masking: Option<String>) -> Self
|
||||||
|
{
|
||||||
|
let balling = Self {
|
||||||
|
dns: yeah,
|
||||||
|
user: String::from(username),
|
||||||
|
ip: String::from(ip_addy),
|
||||||
|
port: String::from(port_num),
|
||||||
|
mask: masking,
|
||||||
|
};
|
||||||
|
balling
|
||||||
|
|
||||||
|
}
|
||||||
|
pub fn concat(self, connect: bool) -> Vec<String> {
|
||||||
|
let mut final_thing: Vec<String> = vec![];
|
||||||
|
if connect == false{
|
||||||
|
if self.dns == true && self.mask != None{
|
||||||
|
final_thing.push(String::from("--dns"));
|
||||||
|
final_thing.push(String::from("-Nr"));
|
||||||
|
final_thing.push(format!("{}@{}", self.user, self.ip));
|
||||||
|
final_thing.push(String::from("-x"));
|
||||||
|
final_thing.push(self.mask.unwrap());
|
||||||
|
return final_thing;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return vec![];
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for TemplateApp {
|
impl Default for TemplateApp {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -64,7 +122,7 @@ impl eframe::App for TemplateApp {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
egui::SidePanel::left("side_panel").show(ctx, |ui| {
|
/* egui::SidePanel::left("side_panel").show(ctx, |ui| {
|
||||||
ui.heading("Side Panel");
|
ui.heading("Side Panel");
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
@ -90,17 +148,19 @@ impl eframe::App for TemplateApp {
|
||||||
ui.label(".");
|
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
|
||||||
|
|
||||||
|
ui.text_edit_singleline(label);
|
||||||
ui.heading("eframe template");
|
ui.heading("eframe template");
|
||||||
ui.hyperlink("https://github.com/emilk/eframe_template");
|
ui.hyperlink("https://github.com/emilk/eframe_template");
|
||||||
ui.add(egui::github_link_file!(
|
ui.add(egui::github_link_file!(
|
||||||
"https://github.com/emilk/eframe_template/blob/master/",
|
"https://github.com/emilk/eframe_template/blob/master/",
|
||||||
"Source code."
|
"Source code."
|
||||||
));
|
));
|
||||||
|
|
||||||
egui::warn_if_debug_build(ui);
|
egui::warn_if_debug_build(ui);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -1,4 +1,18 @@
|
||||||
#![warn(clippy::all, rust_2018_idioms)]
|
#![warn(clippy::all, rust_2018_idioms)]
|
||||||
|
|
||||||
|
use std::process::{ExitStatus, Command};
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
pub use app::TemplateApp;
|
pub use app::TemplateApp;
|
||||||
|
pub use app::SshDeets;
|
||||||
|
|
||||||
|
pub fn connect_ssh(connect: bool, structure: SshDeets) -> Result<(), ExitStatus>{
|
||||||
|
let argss = structure.concat(connect);
|
||||||
|
if connect == false{
|
||||||
|
Command::new("sshuttle")
|
||||||
|
.args(argss)
|
||||||
|
.spawn()
|
||||||
|
.expect("FUCK");
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ fn main() {
|
||||||
|
|
||||||
let native_options = eframe::NativeOptions::default();
|
let native_options = eframe::NativeOptions::default();
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"eframe template",
|
"sshuttle",
|
||||||
native_options,
|
native_options,
|
||||||
Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))),
|
Box::new(|cc| Box::new(sshuttle_gui::TemplateApp::new(cc))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ fn main() {
|
||||||
eframe::start_web(
|
eframe::start_web(
|
||||||
"the_canvas_id", // hardcode it
|
"the_canvas_id", // hardcode it
|
||||||
web_options,
|
web_options,
|
||||||
Box::new(|cc| Box::new(eframe_template::TemplateApp::new(cc))),
|
Box::new(|cc| Box::new(sshuttle_gui::TemplateApp::new(cc))),
|
||||||
)
|
)
|
||||||
.expect("failed to start eframe");
|
.expect("failed to start eframe");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue