add public port to api model

This commit is contained in:
Abhishek Kondur 2023-01-26 14:01:46 +04:00
parent a4e5f84be8
commit f19b33a84c
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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