|
@@ -9,7 +9,7 @@ import (
|
|
// "fmt"
|
|
// "fmt"
|
|
"net/http"
|
|
"net/http"
|
|
"time"
|
|
"time"
|
|
-
|
|
|
|
|
|
+ "strconv"
|
|
"github.com/gorilla/mux"
|
|
"github.com/gorilla/mux"
|
|
"github.com/gravitl/netmaker/functions"
|
|
"github.com/gravitl/netmaker/functions"
|
|
"github.com/gravitl/netmaker/models"
|
|
"github.com/gravitl/netmaker/models"
|
|
@@ -199,10 +199,15 @@ func getExtClientConf(w http.ResponseWriter, r *http.Request) {
|
|
returnErrorResponse(w, r, formatError(err, "internal"))
|
|
returnErrorResponse(w, r, formatError(err, "internal"))
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ keepalive := ""
|
|
|
|
+ if network.DefaultKeepalive != 0 {
|
|
|
|
+ keepalive = "PersistentKeepalive = " + strconv.Itoa(int(network.DefaultKeepalive))
|
|
|
|
+ }
|
|
|
|
+ gwendpoint := gwnode.Endpoint + ":" + strconv.Itoa(int(gwnode.ListenPort))
|
|
config := fmt.Sprintf(`[Interface]
|
|
config := fmt.Sprintf(`[Interface]
|
|
Address = %s
|
|
Address = %s
|
|
PrivateKey = %s
|
|
PrivateKey = %s
|
|
|
|
+%s
|
|
|
|
|
|
[Peer]
|
|
[Peer]
|
|
PublicKey = %s
|
|
PublicKey = %s
|
|
@@ -211,9 +216,10 @@ Endpoint = %s
|
|
|
|
|
|
`, extclient.Address + "/32",
|
|
`, extclient.Address + "/32",
|
|
extclient.PrivateKey,
|
|
extclient.PrivateKey,
|
|
|
|
+ keepalive,
|
|
gwnode.PublicKey,
|
|
gwnode.PublicKey,
|
|
network.AddressRange,
|
|
network.AddressRange,
|
|
- network.DefaultKeepalive)
|
|
|
|
|
|
+ gwendpoint)
|
|
|
|
|
|
if params["type"] == "qr" {
|
|
if params["type"] == "qr" {
|
|
bytes, err := qrcode.Encode(config, qrcode.Medium, 220)
|
|
bytes, err := qrcode.Encode(config, qrcode.Medium, 220)
|