Преглед на файлове

Merge pull request #3520 from gravitl/develop

Develop
Abhishek K преди 2 месеца
родител
ревизия
9a623e8540
променени са 4 файла, в които са добавени 19 реда и са изтрити 1 реда
  1. 1 0
      controllers/hosts.go
  2. 1 1
      pro/auth/error.go
  3. 6 0
      pro/controllers/users.go
  4. 11 0
      utils/utils.go

+ 1 - 0
controllers/hosts.go

@@ -308,6 +308,7 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
 			}
 		}
 	}()
+
 	logic.LogEvent(&models.Event{
 		Action: models.Update,
 		Source: models.Subject{

+ 1 - 1
pro/auth/error.go

@@ -98,7 +98,7 @@ var oauthNotConfigured = fmt.Sprintf(htmlBaseTemplate, `<h2>Your Netmaker server
 var oauthStateInvalid = fmt.Sprintf(htmlBaseTemplate, `<h2>Invalid OAuth Session. Please re-try again.</h2>`)
 
 var userNotAllowed = fmt.Sprintf(htmlBaseTemplate, `<h2>Your account does not have access to the dashboard. Please contact your administrator for more information about your account.</h2>
-<p>Non-Admins can access the netmaker networks using <a href="https://docs.netmaker.io/docs/remote-access-client-rac#downloadinstallation" target="_blank" rel="noopener">our Netmaker Desktop App.</a></p>`)
+<p>Non-Admins can access the netmaker networks using <a href="https://docs.netmaker.io/docs/client-installation/netmaker-desktop#downloadinstallation" target="_blank" rel="noopener">our Netmaker Desktop App.</a></p>`)
 
 var userFirstTimeSignUp = fmt.Sprintf(htmlBaseTemplate, `<h2>Thank you for signing up. Please contact your administrator for access.</h2>`)
 

+ 6 - 0
pro/controllers/users.go

@@ -1304,6 +1304,12 @@ func getUserRemoteAccessGwsV1(w http.ResponseWriter, r *http.Request) {
 			if extClient.DNS == "" {
 				extClient.DNS = node.IngressDNS
 			}
+
+			extClient.IngressGatewayEndpoint = utils.GetExtClientEndpoint(
+				host.EndpointIP,
+				host.EndpointIPv6,
+				logic.GetPeerListenPort(host),
+			)
 			extClient.AllowedIPs = logic.GetExtclientAllowedIPs(extClient)
 			gws = append(gws, models.UserRemoteGws{
 				GwID:              node.ID.String(),

+ 11 - 0
utils/utils.go

@@ -1,7 +1,9 @@
 package utils
 
 import (
+	"fmt"
 	"log/slog"
+	"net"
 	"runtime"
 	"strings"
 	"time"
@@ -75,3 +77,12 @@ func NoEmptyStringToCsv(strs ...string) string {
 	}
 	return sb.String()
 }
+
+// GetExtClientEndpoint returns the external client endpoint in the format "host:port" or "[host]:port" for IPv6
+func GetExtClientEndpoint(hostIpv4Endpoint, hostIpv6Endpoint net.IP, hostListenPort int) string {
+	if hostIpv4Endpoint.To4() == nil {
+		return fmt.Sprintf("[%s]:%d", hostIpv6Endpoint.String(), hostListenPort)
+	} else {
+		return fmt.Sprintf("%s:%d", hostIpv4Endpoint.String(), hostListenPort)
+	}
+}