cheaters way out
parent
a13b15df31
commit
1ea7c262be
@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "wgas-rs"
|
||||
version = "0.1.0"
|
||||
authors = ["lalanza808 <lance@lzahq.tech>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
rocket = "0.4.4"
|
||||
rocket_contrib = {version = "0.4.4", features = ["tera_templates"]}
|
||||
qrcode-generator = "1.0.6"
|
||||
base64 = "0.12.0"
|
@ -1,2 +1,16 @@
|
||||
# wgas-rs
|
||||
|
||||
Simple WireGuard Access Server
|
||||
|
||||
|
||||
## Quickstart
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:wireguard/wireguard -y
|
||||
sudo apt install wireguard -y
|
||||
sudo umask 077
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
git clone https://github.com/lalanza808/wgas-rs && cd wgas-rs
|
||||
rustup override set nightly
|
||||
cargo run
|
||||
```
|
||||
|
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
add-apt-repository ppa:wireguard/wireguard -y
|
||||
apt install wireguard -y
|
||||
umask 077
|
||||
wg genkey | tee privatekey | wg pubkey > publickey
|
@ -0,0 +1,48 @@
|
||||
#![feature(proc_macro_hygiene, decl_macro)]
|
||||
#[macro_use] extern crate rocket;
|
||||
#[macro_use] extern crate rocket_contrib;
|
||||
extern crate qrcode_generator;
|
||||
|
||||
use rocket::http::RawStr;
|
||||
use rocket::response::Redirect;
|
||||
use rocket_contrib::templates::Template;
|
||||
use rocket_contrib::serve::StaticFiles;
|
||||
use std::process::Command;
|
||||
|
||||
fn genkey() -> String {
|
||||
let output = Command::new("sh")
|
||||
.args(&["-c", "wg", "genkey"])
|
||||
.output()
|
||||
.expect("failed to execute process");
|
||||
let stdout = output.stdout;
|
||||
let privkey = String::from_utf8(stdout)
|
||||
.unwrap();
|
||||
return privkey;
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> String {
|
||||
"sup dog".to_string()
|
||||
}
|
||||
|
||||
#[get("/new")]
|
||||
fn new_key() -> String {
|
||||
let new_key = genkey();
|
||||
new_key.to_string()
|
||||
}
|
||||
|
||||
#[catch(404)]
|
||||
fn not_found() -> String {
|
||||
"not found".to_string()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
rocket::ignite()
|
||||
.mount("/", routes![
|
||||
index, new_key
|
||||
])
|
||||
.mount("/static", StaticFiles::from("./static"))
|
||||
.register(catchers![not_found])
|
||||
.attach(Template::fairing())
|
||||
.launch();
|
||||
}
|
Loading…
Reference in New Issue