fix ip regex, add write to sh file
This commit is contained in:
@@ -86,6 +86,19 @@ impl AppState {
|
||||
println!("{resString}");
|
||||
}
|
||||
|
||||
pub fn writeToConfig(&self) {
|
||||
let mut outputString: String = String::new();
|
||||
outputString.push_str("#! /bin/bash\n\n");
|
||||
for ent in self.entries.iter() {
|
||||
outputString.push_str(&format!(
|
||||
"socat TCP-LISTEN:{},fork,reuseaddr,bind={} TCP:{}:{} &\n",
|
||||
ent.fromPort, ent.fromIP, ent.toIP, ent.toPort
|
||||
))
|
||||
}
|
||||
outputString.push_str("\nwait");
|
||||
std::fs::write("./forward.sh", outputString);
|
||||
}
|
||||
|
||||
pub fn save(&self) {
|
||||
let mut settings = Settings::new(&self.confDir);
|
||||
settings.entries = self.entries.clone();
|
||||
|
||||
Reference in New Issue
Block a user