Browse Source

Merge pull request #1978 from gravitl/GRA-1060/bug_proxy_listen_port

Gra 1060/bug public listen port
dcarns 2 years ago
parent
commit
6e50011ceb
3 changed files with 5 additions and 4 deletions
  1. 2 3
      logic/hosts.go
  2. 2 0
      models/api_host.go
  3. 1 1
      mq/handlers.go

+ 2 - 3
logic/hosts.go

@@ -133,9 +133,8 @@ func UpdateHost(newHost, currentHost *models.Host) {
 	if newHost.ProxyListenPort == 0 {
 	if newHost.ProxyListenPort == 0 {
 		newHost.ProxyListenPort = currentHost.ProxyListenPort
 		newHost.ProxyListenPort = currentHost.ProxyListenPort
 	}
 	}
-	if newHost.PublicListenPort == 0 {
-		newHost.PublicListenPort = currentHost.PublicListenPort
-	}
+	newHost.PublicListenPort = currentHost.PublicListenPort
+
 }
 }
 
 
 // UpdateHostFromClient - used for updating host on server with update recieved from client
 // UpdateHostFromClient - used for updating host on server with update recieved from client

+ 2 - 0
models/api_host.go

@@ -15,6 +15,7 @@ type ApiHost struct {
 	ListenPort       int      `json:"listenport"`
 	ListenPort       int      `json:"listenport"`
 	LocalListenPort  int      `json:"locallistenport"`
 	LocalListenPort  int      `json:"locallistenport"`
 	ProxyListenPort  int      `json:"proxy_listen_port"`
 	ProxyListenPort  int      `json:"proxy_listen_port"`
+	PublicListenPort int      `json:"public_listen_port" yaml:"public_listen_port"`
 	MTU              int      `json:"mtu" yaml:"mtu"`
 	MTU              int      `json:"mtu" yaml:"mtu"`
 	Interfaces       []Iface  `json:"interfaces" yaml:"interfaces"`
 	Interfaces       []Iface  `json:"interfaces" yaml:"interfaces"`
 	DefaultInterface string   `json:"defaultinterface" yaml:"defautlinterface"`
 	DefaultInterface string   `json:"defaultinterface" yaml:"defautlinterface"`
@@ -55,6 +56,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost {
 	a.OS = h.OS
 	a.OS = h.OS
 	a.Nodes = h.Nodes
 	a.Nodes = h.Nodes
 	a.ProxyEnabled = h.ProxyEnabled
 	a.ProxyEnabled = h.ProxyEnabled
+	a.PublicListenPort = h.PublicListenPort
 	a.ProxyListenPort = h.ProxyListenPort
 	a.ProxyListenPort = h.ProxyListenPort
 	a.PublicKey = h.PublicKey.String()
 	a.PublicKey = h.PublicKey.String()
 	a.Verbosity = h.Verbosity
 	a.Verbosity = h.Verbosity

+ 1 - 1
mq/handlers.go

@@ -141,7 +141,7 @@ func UpdateHost(client mqtt.Client, msg mqtt.Message) {
 			logger.Log(1, "error unmarshaling payload ", err.Error())
 			logger.Log(1, "error unmarshaling payload ", err.Error())
 			return
 			return
 		}
 		}
-		logger.Log(3, fmt.Sprintf("recieved host update: %+v\n", hostUpdate))
+		logger.Log(3, fmt.Sprintf("recieved host update: %s\n", hostUpdate.Host.ID.String()))
 		var sendPeerUpdate bool
 		var sendPeerUpdate bool
 		switch hostUpdate.Action {
 		switch hostUpdate.Action {
 		case models.UpdateHost:
 		case models.UpdateHost: