rename isstaticendpoint to isstatic

This commit is contained in:
Max Ma 2024-06-03 10:37:19 +02:00
parent 81a6c9cf8a
commit c7469c79d0
7 changed files with 30 additions and 30 deletions

View file

@ -19,7 +19,7 @@ var (
listenPort int listenPort int
mtu int mtu int
isStaticPort bool isStaticPort bool
isStaticEndpoint bool isStatic bool
isDefault bool isDefault bool
keepAlive int keepAlive int
) )
@ -47,7 +47,7 @@ var hostUpdateCmd = &cobra.Command{
apiHost.ListenPort = listenPort apiHost.ListenPort = listenPort
apiHost.MTU = mtu apiHost.MTU = mtu
apiHost.IsStaticPort = isStaticPort apiHost.IsStaticPort = isStaticPort
apiHost.IsStaticEndpoint = isStaticEndpoint apiHost.IsStatic = isStatic
apiHost.IsDefault = isDefault apiHost.IsDefault = isDefault
apiHost.PersistentKeepalive = keepAlive apiHost.PersistentKeepalive = keepAlive
} }
@ -64,7 +64,7 @@ func init() {
hostUpdateCmd.Flags().IntVar(&mtu, "mtu", 0, "Host MTU size") 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().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(&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 ?") hostUpdateCmd.Flags().BoolVar(&isDefault, "default", false, "Make Host Default ?")
rootCmd.AddCommand(hostUpdateCmd) rootCmd.AddCommand(hostUpdateCmd)
} }

View file

@ -151,7 +151,7 @@ func convertLegacyHostNode(legacy models.LegacyNode) (models.Host, models.Node)
host.IsDocker = models.ParseBool(legacy.IsDocker) host.IsDocker = models.ParseBool(legacy.IsDocker)
host.IsK8S = models.ParseBool(legacy.IsK8S) host.IsK8S = models.ParseBool(legacy.IsK8S)
host.IsStaticPort = models.ParseBool(legacy.IsStatic) 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 host.PersistentKeepalive = time.Duration(legacy.PersistentKeepalive) * time.Second
if host.PersistentKeepalive == 0 { if host.PersistentKeepalive == 0 {
host.PersistentKeepalive = models.DefaultPersistentKeepAlive host.PersistentKeepalive = models.DefaultPersistentKeepAlive

View file

@ -267,7 +267,7 @@ func UpdateHostFromClient(newHost, currHost *models.Host) (sendPeerUpdate bool)
currHost.Verbosity = newHost.Verbosity currHost.Verbosity = newHost.Verbosity
currHost.Version = newHost.Version currHost.Version = newHost.Version
currHost.IsStaticPort = newHost.IsStaticPort currHost.IsStaticPort = newHost.IsStaticPort
currHost.IsStaticEndpoint = newHost.IsStaticEndpoint currHost.IsStatic = newHost.IsStatic
currHost.MTU = newHost.MTU currHost.MTU = newHost.MTU
currHost.Name = newHost.Name currHost.Name = newHost.Name
if len(newHost.NatType) > 0 && newHost.NatType != currHost.NatType { if len(newHost.NatType) > 0 && newHost.NatType != currHost.NatType {

View file

@ -252,7 +252,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
Interfaces: peerHost.Interfaces, Interfaces: peerHost.Interfaces,
ListenPort: peerHost.ListenPort, ListenPort: peerHost.ListenPort,
IsStaticPort: peerHost.IsStaticPort, IsStaticPort: peerHost.IsStaticPort,
IsStaticEndpoint: peerHost.IsStaticEndpoint, IsStatic: peerHost.IsStatic,
} }
nodePeer = peerConfig nodePeer = peerConfig
} else { } else {
@ -264,7 +264,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
Interfaces: peerHost.Interfaces, Interfaces: peerHost.Interfaces,
ListenPort: peerHost.ListenPort, ListenPort: peerHost.ListenPort,
IsStaticPort: peerHost.IsStaticPort, IsStaticPort: peerHost.IsStaticPort,
IsStaticEndpoint: peerHost.IsStaticEndpoint, IsStatic: peerHost.IsStatic,
} }
nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]] nodePeer = hostPeerUpdate.Peers[peerIndexMap[peerHost.PublicKey.String()]]
} }

View file

@ -16,7 +16,7 @@ type ApiHost struct {
OS string `json:"os"` OS string `json:"os"`
Debug bool `json:"debug"` Debug bool `json:"debug"`
IsStaticPort bool `json:"isstaticport"` IsStaticPort bool `json:"isstaticport"`
IsStaticEndpoint bool `json:"isstaticendpoint"` IsStatic bool `json:"isstatic"`
ListenPort int `json:"listenport"` ListenPort int `json:"listenport"`
WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"` WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"`
MTU int `json:"mtu" yaml:"mtu"` MTU int `json:"mtu" yaml:"mtu"`
@ -63,7 +63,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost {
} }
a.DefaultInterface = h.DefaultInterface a.DefaultInterface = h.DefaultInterface
a.IsStaticPort = h.IsStaticPort a.IsStaticPort = h.IsStaticPort
a.IsStaticEndpoint = h.IsStaticEndpoint a.IsStatic = h.IsStatic
a.ListenPort = h.ListenPort a.ListenPort = h.ListenPort
a.MTU = h.MTU a.MTU = h.MTU
a.MacAddress = h.MacAddress.String() a.MacAddress = h.MacAddress.String()
@ -107,7 +107,7 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
h.IsDocker = currentHost.IsDocker h.IsDocker = currentHost.IsDocker
h.IsK8S = currentHost.IsK8S h.IsK8S = currentHost.IsK8S
h.IsStaticPort = a.IsStaticPort h.IsStaticPort = a.IsStaticPort
h.IsStaticEndpoint = a.IsStaticEndpoint h.IsStatic = a.IsStatic
h.ListenPort = a.ListenPort h.ListenPort = a.ListenPort
h.MTU = a.MTU h.MTU = a.MTU
h.MacAddress = currentHost.MacAddress h.MacAddress = currentHost.MacAddress

View file

@ -67,7 +67,7 @@ type Host struct {
IsDocker bool `json:"isdocker" yaml:"isdocker"` IsDocker bool `json:"isdocker" yaml:"isdocker"`
IsK8S bool `json:"isk8s" yaml:"isk8s"` IsK8S bool `json:"isk8s" yaml:"isk8s"`
IsStaticPort bool `json:"isstaticport" yaml:"isstaticport"` IsStaticPort bool `json:"isstaticport" yaml:"isstaticport"`
IsStaticEndpoint bool `json:"isstaticendpoint" yaml:"isstaticendpoint"` IsStatic bool `json:"isstatic" yaml:"isstatic"`
IsDefault bool `json:"isdefault" yaml:"isdefault"` IsDefault bool `json:"isdefault" yaml:"isdefault"`
NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"` NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"`
TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"` TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"`

View file

@ -45,7 +45,7 @@ type HostNetworkInfo struct {
Interfaces []Iface `json:"interfaces" yaml:"interfaces"` Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
ListenPort int `json:"listen_port" yaml:"listen_port"` ListenPort int `json:"listen_port" yaml:"listen_port"`
IsStaticPort bool `json:"is_static_port"` IsStaticPort bool `json:"is_static_port"`
IsStaticEndpoint bool `json:"is_static_endpoint"` IsStatic bool `json:"is_static"`
} }
// PeerMap - peer map for ids and addresses in metrics // PeerMap - peer map for ids and addresses in metrics