From 26dec5ce7ab1eb763685fb51280d527b5b6cdcc5 Mon Sep 17 00:00:00 2001 From: vx3r Date: Wed, 5 Feb 2020 11:57:43 +0900 Subject: [PATCH] PreUp, PostUp, PreDown, PostDown added --- core/server.go | 4 ++++ model/server.go | 4 ++++ template/template.go | 4 ++++ ui/src/views/Home.vue | 16 ++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/core/server.go b/core/server.go index f1664ff..5069498 100644 --- a/core/server.go +++ b/core/server.go @@ -35,6 +35,10 @@ func ReadServer() (*model.Server, error) { server.Address = "fd9f:6666::10:6:6:1/112, 10.6.6.1/24" server.Dns = "fd9f::10:0:0:2, 10.0.0.2" server.PersistentKeepalive = 16 + server.PreUp = "echo WireGuard PreUp" + server.PostUp = "echo WireGuard PostUp" + server.PreDown = "echo WireGuard PreDown" + server.PostDown = "echo WireGuard PostDown" server.Created = time.Now().UTC() server.Updated = server.Created diff --git a/model/server.go b/model/server.go index 0d2c642..e27df51 100644 --- a/model/server.go +++ b/model/server.go @@ -15,4 +15,8 @@ type Server struct { Endpoint string `json:"endpoint"` PersistentKeepalive int `json:"persistentKeepalive"` Dns string `json:"dns"` + PreUp string `json:"preUp"` + PostUp string `json:"postUp"` + PreDown string `json:"preDown"` + PostDown string `json:"postDown"` } diff --git a/template/template.go b/template/template.go index 7469d6a..ea6a720 100644 --- a/template/template.go +++ b/template/template.go @@ -217,6 +217,10 @@ Address = {{.}} {{end}} ListenPort = {{.Server.ListenPort}} PrivateKey = {{.Server.PrivateKey}} +PreUp = {{.Server.PreUp}} +PostUp = {{.Server.PostUp}} +PreDown = {{.Server.PreDown}} +PostDown = {{.Server.PostDown}} {{$server := .Server}} {{range .Clients}} {{if .Enable}} diff --git a/ui/src/views/Home.vue b/ui/src/views/Home.vue index a6b70d1..1968b0d 100644 --- a/ui/src/views/Home.vue +++ b/ui/src/views/Home.vue @@ -55,6 +55,14 @@ + + + +