add client postup & postdown

This commit is contained in:
sunyu 2020-09-25 15:35:23 +08:00
parent a89fb34555
commit 03428646e1
5 changed files with 37 additions and 5 deletions

View file

@ -22,6 +22,8 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
clientAddress := fmt.Sprintf("Address = %s", strings.Join(client.AllocatedIPs, ","))
clientPrivateKey := fmt.Sprintf("PrivateKey = %s", client.PrivateKey)
clientDNS := fmt.Sprintf("DNS = %s", strings.Join(setting.DNSServers, ","))
clientPostUp := fmt.Sprintf("PostUp = %s", client.PostUp)
clientPostDown := fmt.Sprintf("PostDown = %s", client.PostDown)
// Peer section
peerPublicKey := fmt.Sprintf("PublicKey = %s", server.KeyPair.PublicKey)
@ -34,7 +36,9 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
strConfig := "[Interface]\n" +
clientAddress + "\n" +
clientPrivateKey + "\n" +
clientDNS + "\n\n" +
clientDNS + "\n" +
clientPostUp + "\n" +
clientPostDown + "\n\n" +
"[Peer]" + "\n" +
peerPublicKey + "\n" +
peerPresharedKey + "\n" +