From c8623082fec8997ad8a933de79d0958b69a3df02 Mon Sep 17 00:00:00 2001
From: nebulosa2007 <85841412+nebulosa2007@users.noreply.github.com>
Date: Mon, 25 Dec 2023 22:23:51 +0300
Subject: [PATCH] Make Interface PreDown setting. (#480)
---
model/server.go | 1 +
templates/server.html | 9 ++++++++-
templates/wg.conf | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/model/server.go b/model/server.go
index 0784eea2..0aa804f9 100644
--- a/model/server.go
+++ b/model/server.go
@@ -23,5 +23,6 @@ type ServerInterface struct {
ListenPort int `json:"listen_port,string"` // ,string to get listen_port string input as int
UpdatedAt time.Time `json:"updated_at"`
PostUp string `json:"post_up"`
+ PreDown string `json:"pre_down"`
PostDown string `json:"post_down"`
}
diff --git a/templates/server.html b/templates/server.html
index 366d3013..6a24e6ec 100644
--- a/templates/server.html
+++ b/templates/server.html
@@ -42,6 +42,12 @@
Interface
+
+
+
+
+
KeyPair Generation
const addresses = $("#addresses").val().split(",");
const listen_port = $("#listen_port").val();
const post_up = $("#post_up").val();
+ const pre_down = $("#pre_down").val();
const post_down = $("#post_down").val();
- const data = {"addresses": addresses, "listen_port": listen_port, "post_up": post_up, "post_down": post_down};
+ const data = {"addresses": addresses, "listen_port": listen_port, "post_up": post_up, "pre_down": pre_down, "post_down": post_down};
$.ajax({
cache: false,
diff --git a/templates/wg.conf b/templates/wg.conf
index 6b216cef..92699128 100644
--- a/templates/wg.conf
+++ b/templates/wg.conf
@@ -9,6 +9,7 @@ ListenPort = {{ .serverConfig.Interface.ListenPort }}
PrivateKey = {{ .serverConfig.KeyPair.PrivateKey }}
{{if .globalSettings.MTU}}MTU = {{ .globalSettings.MTU }}{{end}}
PostUp = {{ .serverConfig.Interface.PostUp }}
+PreDown = {{ .serverConfig.Interface.PreDown }}
PostDown = {{ .serverConfig.Interface.PostDown }}
Table = {{ .globalSettings.Table }}