mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-07-13 18:18:15 +03:00
Add PostUp and PostDown script for clients interface
This commit is contained in:
parent
efbc36d61f
commit
05cfe56ab9
5 changed files with 43 additions and 3 deletions
10
util/util.go
10
util/util.go
|
@ -28,6 +28,14 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
|
|||
if client.UseServerDNS {
|
||||
clientDNS = fmt.Sprintf("DNS = %s\n", strings.Join(setting.DNSServers, ","))
|
||||
}
|
||||
clientPostUp := ""
|
||||
if strings.TrimSpace(client.PostUp) != "" {
|
||||
clientPostUp = fmt.Sprintf("PostUp = %s\n", client.PostUp)
|
||||
}
|
||||
clientPostDown := ""
|
||||
if strings.TrimSpace(client.PostDown) != "" {
|
||||
clientPostDown = fmt.Sprintf("PostDown = %s\n", client.PostDown)
|
||||
}
|
||||
|
||||
// Peer section
|
||||
peerPublicKey := fmt.Sprintf("PublicKey = %s\n", server.KeyPair.PublicKey)
|
||||
|
@ -67,6 +75,8 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
|
|||
clientPrivateKey +
|
||||
clientDNS +
|
||||
forwardMark +
|
||||
clientPostUp +
|
||||
clientPostDown +
|
||||
"\n[Peer]\n" +
|
||||
peerPublicKey +
|
||||
peerPresharedKey +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue