1
1
mirror of https://github.com/vx3r/wg-gen-web.git synced 2024-11-26 04:19:41 +01:00

PreUp, PostUp, PreDown, PostDown added

This commit is contained in:
vx3r 2020-02-05 11:57:43 +09:00
parent 727b5c4049
commit 26dec5ce7a
4 changed files with 28 additions and 0 deletions

@ -35,6 +35,10 @@ func ReadServer() (*model.Server, error) {
server.Address = "fd9f:6666::10:6:6:1/112, 10.6.6.1/24" 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.Dns = "fd9f::10:0:0:2, 10.0.0.2"
server.PersistentKeepalive = 16 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.Created = time.Now().UTC()
server.Updated = server.Created server.Updated = server.Created

@ -15,4 +15,8 @@ type Server struct {
Endpoint string `json:"endpoint"` Endpoint string `json:"endpoint"`
PersistentKeepalive int `json:"persistentKeepalive"` PersistentKeepalive int `json:"persistentKeepalive"`
Dns string `json:"dns"` Dns string `json:"dns"`
PreUp string `json:"preUp"`
PostUp string `json:"postUp"`
PreDown string `json:"preDown"`
PostDown string `json:"postDown"`
} }

@ -217,6 +217,10 @@ Address = {{.}}
{{end}} {{end}}
ListenPort = {{.Server.ListenPort}} ListenPort = {{.Server.ListenPort}}
PrivateKey = {{.Server.PrivateKey}} PrivateKey = {{.Server.PrivateKey}}
PreUp = {{.Server.PreUp}}
PostUp = {{.Server.PostUp}}
PreDown = {{.Server.PreDown}}
PostDown = {{.Server.PostDown}}
{{$server := .Server}} {{$server := .Server}}
{{range .Clients}} {{range .Clients}}
{{if .Enable}} {{if .Enable}}

@ -55,6 +55,14 @@
</v-chip> </v-chip>
</template> </template>
</v-combobox> </v-combobox>
<v-text-field
v-model="server.preUp"
label="PreUp: script snippets which will be executed by bash before setting up the interface"
/>
<v-text-field
v-model="server.postUp"
label="PostUp: script snippets which will be executed by bash after setting up the interface"
/>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<v-text-field <v-text-field
@ -96,6 +104,14 @@
</v-chip> </v-chip>
</template> </template>
</v-combobox> </v-combobox>
<v-text-field
v-model="server.preDown"
label="PreDown: script snippets which will be executed by bash before setting down the interface"
/>
<v-text-field
v-model="server.postDown "
label="PostDown : script snippets which will be executed by bash after setting down the interface"
/>
</v-col> </v-col>
</div> </div>