diff --git a/cli/cmd/host/update.go b/cli/cmd/host/update.go index 025c16a4..3c8520a9 100644 --- a/cli/cmd/host/update.go +++ b/cli/cmd/host/update.go @@ -12,16 +12,16 @@ import ( ) var ( - apiHostFilePath string - endpoint string - endpoint6 string - name string - listenPort int - mtu int - isStaticPort bool - isStaticEndpoint bool - isDefault bool - keepAlive int + apiHostFilePath string + endpoint string + endpoint6 string + name string + listenPort int + mtu int + isStaticPort bool + isStatic bool + isDefault bool + keepAlive int ) var hostUpdateCmd = &cobra.Command{ @@ -47,7 +47,7 @@ var hostUpdateCmd = &cobra.Command{ apiHost.ListenPort = listenPort apiHost.MTU = mtu apiHost.IsStaticPort = isStaticPort - apiHost.IsStaticEndpoint = isStaticEndpoint + apiHost.IsStatic = isStatic apiHost.IsDefault = isDefault apiHost.PersistentKeepalive = keepAlive } @@ -64,7 +64,7 @@ func init() { hostUpdateCmd.Flags().IntVar(&mtu, "mtu", 0, "Host MTU size") hostUpdateCmd.Flags().IntVar(&keepAlive, "keep_alive", 0, "Interval (seconds) in which packets are sent to keep connections open with peers") hostUpdateCmd.Flags().BoolVar(&isStaticPort, "static_port", false, "Make Host Static Port?") - hostUpdateCmd.Flags().BoolVar(&isStaticEndpoint, "static_endpoint", false, "Make Host Static Endpoint?") + hostUpdateCmd.Flags().BoolVar(&isStatic, "static_endpoint", false, "Make Host Static Endpoint?") hostUpdateCmd.Flags().BoolVar(&isDefault, "default", false, "Make Host Default ?") rootCmd.AddCommand(hostUpdateCmd) } diff --git a/controllers/migrate.go b/controllers/migrate.go index e478a26b..53bbbc6d 100644 --- a/controllers/migrate.go +++ b/controllers/migrate.go @@ -151,7 +151,7 @@ func convertLegacyHostNode(legacy models.LegacyNode) (models.Host, models.Node) host.IsDocker = models.ParseBool(legacy.IsDocker) host.IsK8S = models.ParseBool(legacy.IsK8S) host.IsStaticPort = models.ParseBool(legacy.IsStatic) - host.IsStaticEndpoint = models.ParseBool(legacy.IsStatic) + host.IsStatic = models.ParseBool(legacy.IsStatic) host.PersistentKeepalive = time.Duration(legacy.PersistentKeepalive) * time.Second if host.PersistentKeepalive == 0 { host.PersistentKeepalive = models.DefaultPersistentKeepAlive diff --git a/logic/hosts.go b/logic/hosts.go index 29e477d7..9dc44e28 100644 --- a/logic/hosts.go +++ b/logic/hosts.go @@ -267,7 +267,7 @@ func UpdateHostFromClient(newHost, currHost *models.Host) (sendPeerUpdate bool) currHost.Verbosity = newHost.Verbosity currHost.Version = newHost.Version currHost.IsStaticPort = newHost.IsStaticPort - currHost.IsStaticEndpoint = newHost.IsStaticEndpoint + currHost.IsStatic = newHost.IsStatic currHost.MTU = newHost.MTU currHost.Name = newHost.Name if len(newHost.NatType) > 0 && newHost.NatType != currHost.NatType { diff --git a/logic/peers.go b/logic/peers.go index 887b4554..c976a3d8 100644 --- a/logic/peers.go +++ b/logic/peers.go @@ -249,10 +249,10 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N hostPeerUpdate.Peers = append(hostPeerUpdate.Peers, peerConfig) peerIndexMap[peerHost.PublicKey.String()] = len(hostPeerUpdate.Peers) - 1 hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{ - Interfaces: peerHost.Interfaces, - ListenPort: peerHost.ListenPort, - IsStaticPort: peerHost.IsStaticPort, - IsStaticEndpoint: peerHost.IsStaticEndpoint, + Interfaces: peerHost.Interfaces, + ListenPort: peerHost.ListenPort, + IsStaticPort: peerHost.IsStaticPort, + IsStatic: peerHost.IsStatic, } nodePeer = peerConfig } else { @@ -261,10 +261,10 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]].AllowedIPs = peerAllowedIPs hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]].Remove = false hostPeerUpdate.HostNetworkInfo[peerHost.PublicKey.String()] = models.HostNetworkInfo{ - Interfaces: peerHost.Interfaces, - ListenPort: peerHost.ListenPort, - IsStaticPort: peerHost.IsStaticPort, - IsStaticEndpoint: peerHost.IsStaticEndpoint, + Interfaces: peerHost.Interfaces, + ListenPort: peerHost.ListenPort, + IsStaticPort: peerHost.IsStaticPort, + IsStatic: peerHost.IsStatic, } nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]] } diff --git a/models/api_host.go b/models/api_host.go index ffa2791e..324bf9f8 100644 --- a/models/api_host.go +++ b/models/api_host.go @@ -16,7 +16,7 @@ type ApiHost struct { OS string `json:"os"` Debug bool `json:"debug"` IsStaticPort bool `json:"isstaticport"` - IsStaticEndpoint bool `json:"isstaticendpoint"` + IsStatic bool `json:"isstatic"` ListenPort int `json:"listenport"` WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"` MTU int `json:"mtu" yaml:"mtu"` @@ -63,7 +63,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost { } a.DefaultInterface = h.DefaultInterface a.IsStaticPort = h.IsStaticPort - a.IsStaticEndpoint = h.IsStaticEndpoint + a.IsStatic = h.IsStatic a.ListenPort = h.ListenPort a.MTU = h.MTU a.MacAddress = h.MacAddress.String() @@ -107,7 +107,7 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host { h.IsDocker = currentHost.IsDocker h.IsK8S = currentHost.IsK8S h.IsStaticPort = a.IsStaticPort - h.IsStaticEndpoint = a.IsStaticEndpoint + h.IsStatic = a.IsStatic h.ListenPort = a.ListenPort h.MTU = a.MTU h.MacAddress = currentHost.MacAddress diff --git a/models/host.go b/models/host.go index 8216cbdd..684cc7d1 100644 --- a/models/host.go +++ b/models/host.go @@ -67,7 +67,7 @@ type Host struct { IsDocker bool `json:"isdocker" yaml:"isdocker"` IsK8S bool `json:"isk8s" yaml:"isk8s"` IsStaticPort bool `json:"isstaticport" yaml:"isstaticport"` - IsStaticEndpoint bool `json:"isstaticendpoint" yaml:"isstaticendpoint"` + IsStatic bool `json:"isstatic" yaml:"isstatic"` IsDefault bool `json:"isdefault" yaml:"isdefault"` NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"` TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"` diff --git a/models/metrics.go b/models/metrics.go index 915b2f4e..686e3e96 100644 --- a/models/metrics.go +++ b/models/metrics.go @@ -42,10 +42,10 @@ type HostInfoMap map[string]HostNetworkInfo // HostNetworkInfo - holds info related to host networking (used for client side peer calculations) type HostNetworkInfo struct { - Interfaces []Iface `json:"interfaces" yaml:"interfaces"` - ListenPort int `json:"listen_port" yaml:"listen_port"` - IsStaticPort bool `json:"is_static_port"` - IsStaticEndpoint bool `json:"is_static_endpoint"` + Interfaces []Iface `json:"interfaces" yaml:"interfaces"` + ListenPort int `json:"listen_port" yaml:"listen_port"` + IsStaticPort bool `json:"is_static_port"` + IsStatic bool `json:"is_static"` } // PeerMap - peer map for ids and addresses in metrics