mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 21:24:16 +08:00
rename isstaticendpoint to isstatic
This commit is contained in:
parent
81a6c9cf8a
commit
c7469c79d0
7 changed files with 30 additions and 30 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()]]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"`
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue