From f19b33a84c200ce929a0f469a64726740b3b693a Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Thu, 26 Jan 2023 14:01:46 +0400 Subject: [PATCH] add public port to api model --- logic/hosts.go | 5 ++--- models/api_host.go | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/logic/hosts.go b/logic/hosts.go index 31044128..4fb349ed 100644 --- a/logic/hosts.go +++ b/logic/hosts.go @@ -133,9 +133,8 @@ func UpdateHost(newHost, currentHost *models.Host) { if newHost.ProxyListenPort == 0 { 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 diff --git a/models/api_host.go b/models/api_host.go index b6a1ef9c..19acf604 100644 --- a/models/api_host.go +++ b/models/api_host.go @@ -15,6 +15,7 @@ type ApiHost struct { ListenPort int `json:"listenport"` LocalListenPort int `json:"locallistenport"` ProxyListenPort int `json:"proxy_listen_port"` + PublicListenPort int `json:"public_listen_port" yaml:"public_listen_port"` MTU int `json:"mtu" yaml:"mtu"` Interfaces []Iface `json:"interfaces" yaml:"interfaces"` DefaultInterface string `json:"defaultinterface" yaml:"defautlinterface"` @@ -55,6 +56,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost { a.OS = h.OS a.Nodes = h.Nodes a.ProxyEnabled = h.ProxyEnabled + a.PublicListenPort = h.PublicListenPort a.ProxyListenPort = h.ProxyListenPort a.PublicKey = h.PublicKey.String() a.Verbosity = h.Verbosity