Make MTU and PersistentKeepalive optional (#123)

This commit is contained in:
Khanh Ngo 2021-11-20 21:02:23 +01:00 committed by GitHub
parent 3c1d894b44
commit 2d9eeb08e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 20 deletions

View file

@ -41,12 +41,15 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
if n, err := strconv.Atoi(split[1]); err == nil {
desiredPort = n
} else {
log.Error("Endpoint appears to be incorrectly formated: ", err)
log.Error("Endpoint appears to be incorrectly formatted: ", err)
}
}
peerEndpoint := fmt.Sprintf("Endpoint = %s:%d", desiredHost, desiredPort)
peerPersistentKeepalive := fmt.Sprintf("PersistentKeepalive = %d", setting.PersistentKeepalive)
peerPersistentKeepalive := ""
if setting.PersistentKeepalive > 0 {
peerPersistentKeepalive = fmt.Sprintf("PersistentKeepalive = %d", setting.PersistentKeepalive)
}
// build the config as string
strConfig := "[Interface]\n" +